CWE-96: Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')

low-risk

The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before inserting the input into an executable resource, such as a library, configuration file, or template.

Abstraction: Base

Common Consequences

Confidentiality Read Files or Directories
Access Control Bypass Protection Mechanism
Access Control Gain Privileges or Assume Identity
Integrity Execute Unauthorized Code or Commands
Non-Repudiation Hide Activities

Detection Methods

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.)

Real-World Examples (10)

CVE CVSS EPSS KEV
CVE-2024-55877 9.9 27.5%
CVE-2021-39115 7.2 25.7%
CVE-2020-6144 9.8 10.8%
CVE-2020-6143 9.8 10.8%
CVE-2024-55662 9.9 9.8%
CVE-2022-43938 8.8 6.5%
CVE-2024-43400 9.0 5.7%
CVE-2024-37900 6.4 5.3%
CVE-2015-2079 9.9 2.8%
CVE-2023-39726 9.8 1.6%
15
/ 100
low-risk
Active Threat 15/50 · Low
Exploit Availability 0/50 · Minimal