Description
Group or other-user write permissions let people other than the owner change a sensitive file.
Potential impact
If the application trusts altered configuration, code or data, it may perform actions beyond the other user’s permissions.
Remediation
Create sensitive files at trusted paths, generally with owner-only mode 0600 or a stricter mode. Check who can modify the parent directories.
Examples
Before
c
open("/var/app/config", O_CREAT | O_WRONLY, 0666);
After
c
open("/var/app/config", O_CREAT | O_WRONLY, 0600);
For a new file, open requests 0600 in place of 0666. The effective permissions also depend on the umask and ACLs. For an existing file, this mode argument has no effect. Check its owner and actual permissions separately.