Can creating directories with 777 permission inside system directories cause any security weakness?
For example, say I open a directory called Custom
inside /usr/share/backgrounds/
and give it 777 permission. Is it going to create any kind of security vulnerability?
Your question needs to be answered with NO. For it to become an issue: someone first needs to gain access to your machine. If there is no way for someone to gain access exploiting it will be impossible. You do not mention having a web server active. You do not mention this machine being connected to the internet. So the answer is no.
Still ... WHY would you need 777 for a directory inside "/usr/share/backgrounds/? There is absolutely NO reason for it. 775 is more than enough.
And it should be noted that not using 777 is the better approach. Thing is... in 1/2 a years time you consider using a web server on your machine. Of course you totally forgot about doing setting a directory to 777 and oops it is inside your virtual host... It would be rather easy to drop a script inside that directory that scans for files that contains the password to your MySQL server.