World-Writable Sensitive Files
Files that affect how the system or its services behave can be changed by every local user, because write access to them is granted to all.
| Severity | Medium |
| CVSS 3.1 | 5.5 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N Open in the calculator |
| CVSS 4.0 | 6.8 CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-732: Incorrect Permission Assignment for Critical Resource |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1546.004 Unix Shell Configuration Modification, T1543.002 Systemd Service, T1136.001 Local Account |
| Category | Broken Access Control |
Description
Files and directories whose content affects the security of the system, of a service or of other users can be written to by all users on the host, through the write permission for other users on Linux and Unix, or write access for Everyone, Users or Authenticated Users on Windows, so any local user, or an attacker who has compromised any account or service on the host, can change them. Typical examples are configuration files of services and applications, files that privileged processes read or include, log files relied on for auditing, login and environment scripts such as those in /etc/profile.d, systemd unit files and, in the most serious cases, system files such as /etc/passwd. World-writable directories without the sticky bit, in which any user can delete or replace other users' files, are a related form. Executables run directly by privileged services and scheduled tasks are covered by the findings for those.
Depending on the file, write access lets an attacker alter a service's behaviour or point it at a resource they control, plant commands that a privileged process or another user later runs, remove evidence from logs, corrupt data, or deny service by emptying or breaking a file the system needs. Where the file is read or run with root or SYSTEM privileges, as with /etc/passwd, a systemd unit or a login script, the result is full control of the host, so the impact depends on which files are affected and what uses them.
These permissions usually come from installation scripts, quick fixes to access problems (such as chmod 777), archives extracted with their original permissions, or permissive defaults in third-party software. They are identified with searches such as find / -xdev -type f -perm -0002 and find / -xdev -type d -perm -0002 ! -perm -1000 on Linux, or with icacls and Sysinternals AccessChk on Windows, followed by working out which process uses each file and with what privileges.
Remediation
Remove write access for all users from every file and directory that affects security, and stop it returning:
- For each world-writable file and directory found, identify its owner and what reads or runs it. Remove the write permission for other users where it is not needed (
chmod o-w) and set ownership to the account that should maintain the file. On Windows, remove write and modify rights forEveryone,UsersandAuthenticated Userswithicaclsor Group Policy file system settings. - Where several accounts genuinely need to write to a file, grant access to a specific group instead, and make sure no privileged process reads or runs it.
- Set the sticky bit (
chmod +t) on shared directories that must stay writable, such as/tmp, so that users cannot delete or rename each other's files. - Correct the source of the permissions in installation scripts, deployment tooling and packages, and use a restrictive default
umask, such as027, for services and users. - Check the integrity of files that were world-writable, since they may already have been changed, and restore any that differ from a known good copy.
- Add a regular check for world-writable files to configuration compliance scanning or file integrity monitoring.
Confirm the fix by repeating the search and checking that every remaining world-writable location is expected, and that such directories have the sticky bit set.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.