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

BaseDraft

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.

View on MITRE
Back to CWE Lookup

Technical Details

Structure
Simple

Applicable To

Languages
PHPPerlInterpreted
Platforms

Frequently Asked Questions

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

CWE-96: Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.

What are the security consequences of Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')?+

If exploited, CWE-96 (Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')) it can compromise Confidentiality, Access Control, Integrity, Availability, Other and Non-Repudiation, leading to outcomes such as Read Files or Directories, Read Application Data, Gain Privileges or Assume Identity, Execute Unauthorized Code or Commands and Hide Activities.

How do you prevent or mitigate Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')?+

Recommended mitigations for CWE-96 include: Perform proper output validation and escaping to neutralize all code syntax from data written to code files.

Which programming languages are affected by Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')?+

CWE-96 commonly affects PHP, Perl and Interpreted. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')?+

MITRE documents real CVEs mapped to CWE-96, including CVE-2002-0495, CVE-2005-1876, CVE-2005-1894, CVE-2003-0395 and CVE-2007-6652. 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-96 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.

Learn More