CWE-282, Improper Ownership Management, is a class weakness: the product assigns the wrong ownership to an object or resource, or does not verify the ownership properly.
It matters wherever trust follows ownership, which on Unix systems is nearly everywhere.
How it happens
A program makes a decision based on who owns a file, directory, or socket, or it creates something and leaves it owned by the wrong account. Either mistake means someone gets influence they should not have.
MITRE's example is CVE-1999-1125 (Gold): a program runs setuid root but relies on a configuration file owned by a non-root user. Whoever owns the file controls what a root process reads.
What an attacker gains
MITRE lists gaining privileges or assuming identity. If a privileged process trusts data an unprivileged user can edit, the unprivileged user effectively steers the privileged process.
How to find it
- List setuid and setgid binaries and check what files they read.
- Audit ownership of config files, sockets, and directories used by services.
- Static analysis can find some instances of this weakness.
find / -xdev -perm -4000 -type f 2>/dev/null
How to fix it
- Make files that privileged code reads owned by a privileged account and not writable by others.
- Verify ownership explicitly before trusting a resource.
- Create files with the right owner from the start rather than fixing afterward.
Quick check
Why is a root owned program reading a user owned config file risky?
The user can change the file, so they control input to a process running as root.
Sources
- MITRE CWE-282: https://cwe.mitre.org/data/definitions/282.html
- Safeguard Gold entry: https://gold.safeguard.sh/cwe/CWE-282