CWE-913: Improper Control of Dynamically-Managed Code Resources
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product does not properly restrict reading from or writing to dynamically-managed code resources such as variables, objects, classes, attributes, functions, or executable instructions or statements.
扩展描述
Many languages offer powerful features that allow the programmer to dynamically create or modify existing code, or resources used by code such as variables and objects. While these features can offer significant flexibility and reduce development time, they can be extremely dangerous if attackers can directly influence these code resources in unexpected ways.
常见后果
影响范围: Integrity
技术影响: Execute Unauthorized Code or Commands
影响范围: Other Integrity
技术影响: Varies by Context Alter Execution Logic
潜在缓解措施
阶段: Implementation
策略: Input Validation
描述: For any externally-influenced input, check the input against an allowlist of acceptable values.
阶段: Implementation Architecture and Design
策略: Refactoring
描述: Refactor the code so that it does not need to be dynamically managed.
检测方法
方法: Fuzzing
Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
有效性: High
观察示例
参考: CVE-2022-2054
Python compiler uses eval() to execute malicious strings as Python code.
参考: CVE-2018-1000613
Cryptography API uses unsafe reflection when deserializing a private key
参考: CVE-2015-8103
Deserialization issue in commonly-used Java library allows remote execution.
参考: CVE-2006-7079
Chain: extract used for register_globals compatibility layer, enables path traversal (CWE-22)
参考: CVE-2012-2055
Source version control product allows modification of trusted key using mass assignment.
引入模式
| 阶段 | 说明 |
|---|---|
| Architecture and Design | - |
| Implementation | - |