CWE-913: Improper Control of Dynamically-Managed Code Resources
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.
View on MITREExtended Description
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.
Technical Details
- Structure
- Simple
Applicable To
Security Consequences
Scope
Impact
Scope
Impact
Mitigation Strategies
Phase
Description
For any externally-influenced input, check the input against an allowlist of acceptable values.
Strategy
Input ValidationPhase
Description
Refactor the code so that it does not need to be dynamically managed.
Strategy
RefactoringDetection Methods
No detection method information available for this CWE.
Code Examples & CVEs
Observed CVE Examples (5)
Cryptography API uses unsafe reflection when deserializing a private key
View DetailsDeserialization issue in commonly-used Java library allows remote execution.
View DetailsChain: extract used for register_globals compatibility layer, enables path traversal (CWE-22)
View DetailsSource version control product allows modification of trusted key using mass assignment.
View DetailsCWE Relationships
Frequently Asked Questions
What is CWE-913: Improper Control of Dynamically-Managed Code Resources?+
CWE-913: Improper Control of Dynamically-Managed Code Resources is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.
What are the security consequences of Improper Control of Dynamically-Managed Code Resources?+
If exploited, CWE-913 (Improper Control of Dynamically-Managed Code Resources) it can compromise Integrity and Other, leading to outcomes such as Execute Unauthorized Code or Commands, Varies by Context and Alter Execution Logic.
How do you prevent or mitigate Improper Control of Dynamically-Managed Code Resources?+
Recommended mitigations for CWE-913 include: For any externally-influenced input, check the input against an allowlist of acceptable values. Refactor the code so that it does not need to be dynamically managed.
What are real-world examples of Improper Control of Dynamically-Managed Code Resources?+
MITRE documents real CVEs mapped to CWE-913, including CVE-2022-2054, CVE-2018-1000613, CVE-2015-8103, CVE-2006-7079 and CVE-2012-2055. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.
What is the difference between a CWE and a CVE?+
A CWE (Common Weakness Enumeration) like CWE-913 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.