CWE-913

Improper Control of Dynamically-Managed Code Resources
AI Translation Available

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.

Status
incomplete
Abstraction
class
Interpreted Not Language-Specific

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.

Common Consequences

integrity other
Impacts
execute unauthorized code or commands varies by context alter execution logic

Detection Methods

fuzzing

Potential Mitigations

Phases:
implementation architecture and design
Descriptions:
• Refactor the code so that it does not need to be dynamically managed.
• For any externally-influenced input, check the input against an allowlist of acceptable values.