Safeguard
Application Security•

CWE-282 Improper Ownership Management: Wrong Owner, Wrong Trust

CWE-282 covers assigning the wrong owner to an object, or failing to verify who owns it. Learn why setuid programs and config files make this dangerous.

Safeguard Security Team
2 min read

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

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.