This vulnerability occurs when software fails to reduce its elevated system privileges after completing a sensitive operation, leaving it with unnecessary and dangerous access rights.
Many critical system functions, like changing the root directory with `chroot()`, require temporary high-level privileges. The secure pattern is to request these elevated rights, perform the single specific task, and then immediately and deliberately drop back down to a normal, restricted privilege level. Failing to do this creates a prolonged attack window where any subsequent bug or compromise in the software can be exploited with those high privileges, leading to severe system damage. For developers, this means your code should follow a 'need-to-know' and 'need-to-use' principle for permissions. Structure your program to operate with the least privilege possible by default, escalate only for discrete operations, and revert immediately. This practice, often called privilege dropping or shedding, is a core defense-in-depth strategy that limits the potential impact of other security flaws in your application.
Impact: Gain Privileges or Assume IdentityRead Application DataRead Files or Directories
An attacker may be able to access resources with the elevated privilege that could not be accessed with the attacker's original privileges. This is particularly likely in conjunction with another flaw, such as a buffer overflow.
Strategy: Separation of Privilege
Strategy: Separation of Privilege
c
// Do some important stuff* setuid(old_uid);
cjava
// privileged code goes here, for example:* System.loadLibrary("awt"); return null;
javac