CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code
193 CVEs have CWE-95 as their primary weakness. 3 of them are in the CISA KEV catalog. The highest EPSS score among them is 99.974%.
The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. eval).
Child of CWE-94: Improper Control of Generation of Code
Mitigations
- Architecture and Design Implementation: If possible, refactor your code so that it does not need to use eval() at all.
- 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,…
- Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180, CWE-181). Make sure that your application does not inadvertently decode the same input twice (CWE-174). Such errors could be used to bypass allowlist schemes by introducing dangerous inputs after they have been checked. Use libraries such as the OWASP ESAPI Canonicalization control. Consider performing repeated canonicalization until your input does not change any more. This will avoid double-decoding and similar scenarios, but it might inadvertently modify inputs that are allowed to contain properly-encoded dangerous content.
- Implementation: For Python programs, it is frequently encouraged to use the ast.literal_eval() function instead of eval, since it is intentionally designed to avoid executing code. However, an adversary could still cause excessive memory or stack consumption via deeply nested structures [REF-1372], so the python documentation discourages use of ast.literal_eval() on untrusted data [REF-1373].
Observed examples
- CVE-2024-4181: Framework for LLM applications allows eval injection via a crafted response from a hosting provider.
- CVE-2022-2054: Python compiler uses eval() to execute malicious strings as Python code.
- CVE-2021-22204: Chain: regex in EXIF processor code does not correctly determine where a string ends (CWE-625), enabling eval injection (CWE-95), as exploited in the wild per CISA KEV.
- CVE-2021-22205: Chain: backslash followed by a newline can bypass a validation step (CWE-20), leading to eval injection (CWE-95), as exploited in the wild per CISA KEV.
- CVE-2008-5071: Eval injection in PHP program.
- CVE-2002-1750: Eval injection in Perl program.
- CVE-2008-5305: Eval injection in Perl program using an ID that should only contain hyphens and numbers.
- CVE-2002-1752: Direct code injection into Perl eval function.
- CVE-2002-1753: Eval injection in Perl program.
- CVE-2005-1527: Direct code injection into Perl eval function.
- CVE-2005-2837: Direct code injection into Perl eval function.
- CVE-2005-1921: MFV. code injection into PHP eval statement using nested constructs that should not be nested.
- CVE-2005-2498: MFV. code injection into PHP eval statement using nested constructs that should not be nested.
- CVE-2005-3302: Code injection into Python eval statement from a field in a formatted file.
- CVE-2007-1253: Eval injection in Python program.
- CVE-2001-1471: Chain: Resultant eval injection. An invalid value prevents initialization of variables, which can be modified by attacker and later injected into PHP eval statement.
Top released CVEs
KEV first, then the highest EPSS score, the highest CVSS score and the newest.
| CVE | Published | Severity | CVSS | EPSS | Description |
|---|---|---|---|---|---|
| CVE-2025-24893 | 2025-02-20 | CRITICAL | 9.8 | 99.974% | XWiki Platform is a generic wiki platform offering runtime services for applications built on top of it. Any guest can perform arbitrary remote code execution… |
| CVE-2024-36401 | 2024-07-01 | CRITICAL | 9.8 | 99.813% | GeoServer is an open source server that allows users to share and edit geospatial data. Prior to versions 2.22.6, 2.23.6, 2.24.4, and 2.25.2, multiple OGC… |
| CVE-2023-7101 | 2023-12-24 | HIGH | 7.8 | 18.959% | Spreadsheet::ParseExcel version 0.65 is a Perl module used for parsing Excel files. Spreadsheet::ParseExcel is vulnerable to an arbitrary code execution (ACE)… |
| CVE-2026-129948 | 2026-11-16 | HIGH | 8.8 | 0.340% | Contentlayer @contentlayer/source-files through 0.3.4 contains a code injection vulnerability that allows attackers who control content files to execute… |
Get more CVE data from the API.
curl 'https://api.contrastcyber.com/cwe_lookup/CWE-95'curl 'https://api.contrastcyber.com/cve_search?cwe_id=CWE-95'
Sources
- Vulnerability data from the National Vulnerability Database (NIST) and the CVE Program. CVE records: Copyright © 1999-2026, The MITRE Corporation, used under the CVE Program Terms of Use. CVE® is a registered trademark of The MITRE Corporation.
- CWE definitions: Copyright © 2006-2026, The MITRE Corporation, used under the CWE Terms of Use. CWE is a trademark of The MITRE Corporation.
- EPSS scores by FIRST.org EPSS, used with attribution.
- KEV catalog and SSVC decisions by CISA.
- Advisory data from the GitHub Advisory Database through OSV.dev (CC BY 4.0).
- Exploit metadata from the Exploit Database (GPL-2.0-only, metadata only).
- Nuclei template names from nuclei-templates (MIT).