Privilege Dropping / Lowering Errors

Incomplete Class
Structure: Simple
Description

The product does not drop privileges before passing control of a resource to an actor that does not have those privileges.

Extended Description

In some contexts, a system executing with elevated permissions will hand off a process/file/etc. to another process or user. If the privileges of an entity are not reduced, then elevated privileges are spread throughout a system and possibly to an attacker.

Common Consequences 2
Scope: Access Control

Impact: Gain Privileges or Assume Identity

If privileges are not dropped, neither are access rights of the user. Often these rights can be prevented from being dropped.

Scope: Access ControlNon-Repudiation

Impact: Gain Privileges or Assume IdentityHide Activities

If privileges are not dropped, in some cases the system may record actions as the user which is being impersonated rather than the impersonator.

Potential Mitigations 3
Phase: Architecture and Design

Strategy: Separation of Privilege

Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.
Phase: Architecture and DesignOperation
Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.
Phase: Architecture and Design

Strategy: Separation of Privilege

Consider following the principle of separation of privilege. Require multiple conditions to be met before permitting access to a system resource.
Demonstrative Examples 1

ID : DX-98

The following code calls chroot() to restrict the application to a subset of the filesystem below APP_HOME in order to prevent an attacker from using the program to gain unauthorized access to files located elsewhere. The code then opens a file specified by the user and processes the contents of the file.

Code Example:

Bad
C
c
Constraining the process inside the application's home directory before opening any files is a valuable security measure. However, the absence of a call to setuid() with some non-zero value means the application is continuing to operate with unnecessary root privileges. Any successful exploit carried out by an attacker against the application can now result in a privilege escalation attack because any malicious operations will be performed with the privileges of the superuser. If the application drops to the privilege level of a non-root user, the potential for damage is substantially reduced.
Observed Examples 13
CVE-2000-1213Program does not drop privileges after acquiring the raw socket.
CVE-2001-0559Setuid program does not drop privileges after a parsing error occurs, then calls another program to handle the error.
CVE-2001-0787Does not drop privileges in related groups when lowering privileges.
CVE-2002-0080Does not drop privileges in related groups when lowering privileges.
CVE-2001-1029Does not drop privileges before determining access to certain files.
CVE-1999-0813Finger daemon does not drop privileges when executing programs on behalf of the user being fingered.
CVE-1999-1326FTP server does not drop privileges if a connection is aborted during file transfer.
CVE-2000-0172Program only uses seteuid to drop privileges.
CVE-2004-2504Windows program running as SYSTEM does not drop privileges before executing other programs (many others like this, especially involving the Help facility).
CVE-2004-0213Utility Manager launches winhlp32.exe while running with raised privileges, which allows local users to gain system privileges.
CVE-2004-0806Setuid program does not drop privileges before executing program specified in an environment variable.
CVE-2004-0828Setuid program does not drop privileges before processing file specified on command line.
CVE-2004-2070Service on Windows does not drop privileges before using "view file" option, allowing code execution.
References 2
24 Deadly Sins of Software Security
Michael Howard, David LeBlanc, and John Viega
McGraw-Hill
2010
ID: REF-44
The Art of Software Security Assessment
Mark Dowd, John McDonald, and Justin Schuh
Addison Wesley
2006
ID: REF-62
Likelihood of Exploit

High

Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Modes of Introduction
Architecture and Design
Implementation
Operation
Related Weaknesses
Taxonomy Mapping
  • PLOVER
Notes
MaintenancePrivilege Dropping / Lowering Errors, Least Privilege Violation, and Execution with Unnecessary Privileges are all closely related and possibly overlapping. Privilege Dropping / Lowering Errors is probably better suited as a category.