CWE-642: External Control of Critical State Data
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product stores security-critical state information about its users, or the product itself, in a location that is accessible to unauthorized actors.
常见后果
影响范围: Access Control
技术影响: Bypass Protection Mechanism Gain Privileges or Assume Identity
说明: An attacker could potentially modify the state in malicious ways. If the state is related to the privileges or level of authentication that the user has, then state modification might allow the user to bypass authentication or elevate privileges.
影响范围: Confidentiality
技术影响: Read Application Data
说明: The state variables may contain sensitive information that should not be known by the client.
影响范围: Availability
技术影响: DoS: Crash, Exit, or Restart
说明: By modifying state variables, the attacker could violate the application's expectations for the contents of the state, leading to a denial of service due to an unexpected error condition.
潜在缓解措施
阶段: Architecture and Design
描述: Understand all the potential locations that are accessible to attackers. For example, some programmers assume that cookies and hidden form fields cannot be modified by an attacker, or they may not consider that environment variables can be modified before a privileged program is invoked.
阶段: Architecture and Design
策略: Attack Surface Reduction
阶段: Architecture and Design
描述: Store state information on the server side only. Ensure that the system definitively and unambiguously keeps track of its own state and user state and has rules defined for legitimate state transitions. Do not allow any application user to affect state directly in any way other than through legitimate actions leading to state transitions.
阶段: Architecture and Design
策略: Libraries or Frameworks
阶段: Architecture and Design
描述: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
阶段: Operation Implementation
策略: Environment Hardening
描述: When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
阶段: Testing
描述: Use automated static analysis tools that target this type of weakness. Many modern techniques use data flow analysis to minimize the number of false positives. This is not a perfect solution, since 100% accuracy and coverage are not feasible.
阶段: Testing
描述: Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
阶段: Testing
描述: Use 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. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.
检测方法
方法: Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
有效性: High
观察示例
参考: CVE-2005-2428
Mail client stores password hashes for unrelated accounts in a hidden form field.
参考: CVE-2008-0306
Privileged program trusts user-specified environment variable to modify critical configuration settings.
参考: CVE-1999-0073
Telnet daemon allows remote clients to specify critical environment variables for the server, leading to code execution.
参考: CVE-2007-4432
Untrusted search path vulnerability through modified LD_LIBRARY_PATH environment variable.
参考: CVE-2006-7191
Untrusted search path vulnerability through modified LD_LIBRARY_PATH environment variable.
参考: CVE-2008-5738
Calendar application allows bypass of authentication by setting a certain cookie value to 1.
参考: CVE-2008-5642
Setting of a language preference in a cookie enables path traversal attack.
参考: CVE-2008-5125
Application allows admin privileges by setting a cookie value to "admin."
参考: CVE-2008-5065
Application allows admin privileges by setting a cookie value to "admin."
参考: CVE-2008-4752
Application allows admin privileges by setting a cookie value to "admin."
参考: CVE-2000-0102
Shopping cart allows price modification via hidden form field.
参考: CVE-2000-0253
Shopping cart allows price modification via hidden form field.
参考: CVE-2008-1319
Server allows client to specify the search path, which can be modified to point to a program that the client has uploaded.
引入模式
| 阶段 | 说明 |
|---|---|
| Architecture and Design | OMISSION: This weakness is caused by missing a security tactic during the architecture and design phase. |
| Implementation | - |
适用平台
编程语言
技术
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| Software Fault Patterns | SFP23 | Exposed Data | - |
关键信息
CWE ID: CWE-642
抽象级别: Class
结构: Simple
状态: Draft
利用可能性: High