CWEweakness
CWE-96 Improper Neutralization of Directives in Statically Saved Code
- Alternate terms
- Static Code Injection
- Abstraction
- Base
- Structure
- Simple
- Status
- Draft
- Languages
- Interpreted, PHP, Perl
- CWE version
- 5.0
Description
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.
Common consequences
• Confidentiality: Read Files or Directories, Read Application Data — The injected code could access restricted data / files.
• Access Control: Bypass Protection Mechanism — In some cases, injectable code controls authentication; this may lead to a remote vulnerability.
• Access Control: Gain Privileges or Assume Identity — Injected code can access resources that the attacker is directly prevented from accessing.
• Integrity, Confidentiality, Availability, Other: Execute Unauthorized Code or Commands — Code injection attacks can lead to loss of data integrity in nearly all cases as the control-plane data injected is always incidental to data recall or writing. Additionally, code injection can often result in the execution of arbitrary code.
• Non-Repudiation: Hide Activities — Often the actions performed by injected control code are unlogged.
Potential mitigations
• [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
• [Implementation] Perform proper output validation and escaping to neutralize all code syntax from data written to code files.
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.)
Observed examples
• CVE-2002-0495: Perl code directly injected into CGI library file from parameters to another CGI program.
• CVE-2005-1876: Direct PHP code injection into supporting template file.
• CVE-2005-1894: Direct code injection into PHP script that can be accessed by attacker.
• CVE-2003-0395: PHP code from User-Agent HTTP header directly inserted into log file implemented as PHP script.
• CVE-2007-6652: Chain: execution after redirect allows non-administrator to perform static code injection.
Related
Attack pattern · CAPEC (5)
Observed example · CVE (5)
- CVE-2007-6652 cpie.php in XCMS 1.83 and earlier sends a redirect to the web browser but does not exit, which allows remote attackers to conduct direct… vulnerability
- CVE-2005-1876 Direct code injection vulnerability in CuteNews 1.3.6 and earlier allows remote attackers with administrative privileges to execute… vulnerability
- CVE-2005-1894 Direct code injection vulnerability in FlatNuke 2.5.3 allows remote attackers to execute arbitrary PHP code by placing the code into the… vulnerability
- CVE-2003-0395 Ultimate PHP Board (UPB) 1.9 allows remote attackers to execute arbitrary PHP code with UPB administrator privileges via an HTTP request… vulnerability
- CVE-2002-0495 csSearch.cgi in csSearch 2.3 and earlier allows remote attackers to execute arbitrary Perl code via the savesetup command and the setup… vulnerability
Child of · CWE (1)
- CWE-94 Improper Control of Generation of Code weakness
Referenced by CAPEC · weakness (5)
Referenced by CVE · weakness (27)
- CVE-2026-108121 Brian Mariani from DigitalCanion SA has discovered a vulnerability in the domain creation functionality of koozali's SME Server version… vulnerability
- CVE-2026-85475 A flaw was found in the Ansible Automation Platform automation controller. vulnerability
- CVE-2026-68489 Static Code Injection in Plesk extensions "Ruby" before 1.6.6 and "Node.js Toolkit" before 2.5.0 allows remote authenticated users to… vulnerability
- CVE-2026-86218 N-central is vulnerable to a pre-auth remote code execution This issue affects N-central: before 2026.3.1.14. vulnerability
- CVE-2025-57707 An improper neutralization of directives in statically saved code ('Static Code Injection') vulnerability has been reported to affect File… vulnerability
- CVE-2025-7825 The Schema Plugin For Divi, Gutenberg & Shortcodes plugin for WordPress is vulnerable to Object Instantiation in all versions up to, and… vulnerability
- CVE-2025-36595 Dell Unisphere for PowerMax vApp, version(s) 9.2.4.x, contain(s) an Improper Neutralization of Directives in Statically Saved Code ('Static… vulnerability
- CVE-2015-2079 Usermin 0.980 through 1.x before 1.660 allows uconfig_save.cgi sig_file_free remote code execution because it uses the two argument (not… vulnerability
- CVE-2025-30091 In Tiny MoxieManager PHP before 4.0.0, remote code execution can occur in the installer command. vulnerability
- CVE-2024-13263 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') vulnerability in Drupal Opigno group manager… vulnerability
- CVE-2024-13264 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') vulnerability in Drupal Opigno module allows PHP… vulnerability
- CVE-2024-13265 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') vulnerability in Drupal Opigno Learning path… vulnerability
- CVE-2024-13267 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') vulnerability in Drupal Opigno TinCan Question… vulnerability
- CVE-2024-13268 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') vulnerability in Drupal Opigno allows PHP Local… vulnerability
- CVE-2024-55662 XWiki Platform is a generic wiki platform. vulnerability
- CVE-2024-55877 XWiki Platform is a generic wiki platform. vulnerability
- CVE-2024-43400 XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. vulnerability
- CVE-2024-37900 XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. vulnerability
- CVE-2024-32487 less through 653 allows OS command execution via a newline character in the name of a file, because quoting is mishandled in filename.c. vulnerability
- CVE-2024-0788 SUPERAntiSpyware Pro X v10.0.1260 is vulnerable to kernel-level API parameters manipulation and Denial of Service vulnerabilities by… vulnerability
- CVE-2023-39726 An issue in Mintty v.3.6.4 and before allows a remote attacker to execute arbitrary code via crafted commands to the terminal. vulnerability
- CVE-2022-3960 Hitachi Vantara Pentaho Business Analytics Server prior to versions 9.4.0.1 and 9.3.0.2, including 8.3.x cannot allow a system… vulnerability
- CVE-2022-43938 Hitachi Vantara Pentaho Business Analytics Server prior to versions 9.4.0.1 and 9.3.0.2, including 8.3.x cannot allow a system… vulnerability
- CVE-2022-0895 Static Code Injection in GitHub repository microweber/microweber prior to 1.3. vulnerability
- CVE-2021-39115 Affected versions of Atlassian Jira Service Management Server and Data Center allow remote attackers with "Jira Administrators" access to… vulnerability
- CVE-2020-6143 A remote code execution vulnerability exists in the install functionality of OS4Ed openSIS 7.4. vulnerability
- CVE-2020-6144 A remote code execution vulnerability exists in the install functionality of OS4Ed openSIS 7.4. vulnerability
Referenced by CWE · child of (1)
- CWE-97 Improper Neutralization of Server-Side Includes (SSI) Within a Web Page weakness
Referenced by CWE · has member (1)
- CWE-884 CWE Cross-section view