CWE-250: Execution with Unnecessary Privileges
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product performs an operation at a privilege level that is higher than the minimum level required, which creates new weaknesses or amplifies the consequences of other weaknesses.
常见后果
影响范围: Confidentiality Integrity Availability Access Control
技术影响: Gain Privileges or Assume Identity Execute Unauthorized Code or Commands Read Application Data DoS: Crash, Exit, or Restart
说明: An attacker will be able to gain access to any resources that are allowed by the extra privileges. Common results include executing code, disabling services, and reading restricted data. New weaknesses can be exposed because running with extra privileges, such as root or Administrator, can disable the normal security checks being performed by the operating system or surrounding environment. Other pre-existing weaknesses can turn into security vulnerabilities if they occur while operating at raised privileges.
潜在缓解措施
阶段: Architecture and Design Operation
策略: Environment Hardening
描述: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
阶段: Architecture and Design
策略: Separation of Privilege
描述: Identify the functionality that requires additional privileges, such as access to privileged operating system resources. Wrap and centralize this functionality if possible, and isolate the privileged code as much as possible from other code [REF-76]. Raise privileges as late as possible, and drop them as soon as possible to avoid CWE-271. Avoid weaknesses such as CWE-288 and CWE-420 by protecting all possible communication channels that could interact with the privileged code, such as a secondary socket that is only intended to be accessed by administrators.
阶段: Architecture and Design
策略: Attack Surface Reduction
描述: Identify the functionality that requires additional privileges, such as access to privileged operating system resources. Wrap and centralize this functionality if possible, and isolate the privileged code as much as possible from other code [REF-76]. Raise privileges as late as possible, and drop them as soon as possible to avoid CWE-271. Avoid weaknesses such as CWE-288 and CWE-420 by protecting all possible communication channels that could interact with the privileged code, such as a secondary socket that is only intended to be accessed by administrators.
阶段: Implementation
描述: Perform extensive input validation for any privileged code that must be exposed to the user and reject anything that does not fit your strict requirements.
阶段: Implementation
描述: When dropping privileges, ensure that they have been dropped successfully to avoid CWE-273. As protection mechanisms in the environment get stronger, privilege-dropping calls may fail even if it seems like they would always succeed.
阶段: Implementation
描述: If circumstances force you to run with extra privileges, then determine the minimum access level necessary. First identify the different permissions that the software and its users will need to perform their actions, such as file read and write permissions, network socket permissions, and so forth. Then explicitly allow those actions while denying all else [REF-76]. Perform extensive input validation and canonicalization to minimize the chances of introducing a separate vulnerability. This mitigation is much more prone to error than dropping the privileges in the first place.
阶段: Operation System Configuration
策略: Environment Hardening
描述: Ensure that the software runs properly under the United States Government Configuration Baseline (USGCB) [REF-199] or an equivalent hardening configuration guide, which many organizations use to limit the attack surface and potential risk of deployed software.
检测方法
方法: Manual Analysis
This weakness can be detected using tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session.
方法: Black Box
方法: Automated Static Analysis - Binary or Bytecode
有效性: High
方法: Manual Static Analysis - Binary or Bytecode
有效性: SOAR Partial
方法: Dynamic Analysis with Automated Results Interpretation
有效性: SOAR Partial
方法: Dynamic Analysis with Manual Results Interpretation
有效性: SOAR Partial
方法: Manual Static Analysis - Source Code
有效性: High
方法: Automated Static Analysis - Source Code
有效性: SOAR Partial
方法: Automated Static Analysis
有效性: SOAR Partial
方法: Architecture or Design Review
有效性: High
观察示例
参考: CVE-2007-4217
FTP client program on a certain OS runs with setuid privileges and has a buffer overflow. Most clients do not need extra privileges, so an overflow is not a vulnerability for those clients.
参考: CVE-2008-1877
Program runs with privileges and calls another program with the same privileges, which allows read of arbitrary files.
参考: CVE-2007-5159
OS incorrectly installs a program with setuid privileges, allowing users to gain privileges.
参考: CVE-2008-4638
Composite: application running with high privileges (CWE-250) allows user to specify a restricted file to process, which generates a parsing error that leaks the contents of the file (CWE-209).
参考: CVE-2008-0162
Program does not drop privileges before calling another program, allowing code execution.
参考: CVE-2008-0368
setuid root program allows creation of arbitrary files through command line argument.
参考: CVE-2007-3931
Installation script installs some programs as setuid when they shouldn't be.
参考: CVE-2020-3812
mail program runs as root but does not drop its privileges before attempting to access a file. Attacker can use a symlink from their home directory to a directory only readable by root, then determine whether the file exists based on the response.
参考: CVE-2003-0908
Product launches Help functionality while running with raised privileges, allowing command execution using Windows message to access "open file" dialog.
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | - |
| Installation | - |
| Architecture and Design | - |
| Operation | - |
适用平台
编程语言
技术
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| 7 Pernicious Kingdoms | - | Often Misused: Privilege Management | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | SER09-J | Minimize privileges before deserializing from a privilege context | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.03.05 BR | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.03.08 BR | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.03.08 RE(1) | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.05.07 BR | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.09.02 RE(4) | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.09.03 BR | - |
| ISA/IEC 62443 | Part 2-4 | Req SP.09.04 BR | - |
| ISA/IEC 62443 | Part 3-3 | Req SR 1.1 | - |
| ISA/IEC 62443 | Part 3-3 | Req SR 1.2 | - |
| ISA/IEC 62443 | Part 3-3 | Req SR 2.1 | - |
| ISA/IEC 62443 | Part 3-3 | Req SR 2.1 RE 1 | - |
| ISA/IEC 62443 | Part 4-1 | Req SD-4 | - |
| ISA/IEC 62443 | Part 4-2 | Req CCSC 3 | - |
| ISA/IEC 62443 | Part 4-2 | Req CR 1.1 | - |
关键信息
CWE ID: CWE-250
抽象级别: Base
结构: Simple
状态: Draft
利用可能性: Medium