CWE-95
Weakness AllowedImproper Neutralization of Directives in Dynamically Evaluated Code
Abstraction: Variant · Status: Incomplete
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").
Mapping guidance
This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.
Modes of introduction
REALIZATION: This weakness is caused during implementation of an architectural security tactic.
This weakness is prevalent in handler/dispatch procedures that might want to invoke a large number of functions, or set a large number of variables.
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.)
Effectiveness: High
Notes
Other
Factors: special character errors can play a role in increasing the variety of code that can be injected, although some vulnerabilities do not require special characters at all, e.g. when a single function without arguments can be referenced and a terminator character is not necessary.
Content history
updated Time_of_Introduction
Suggested OWASP Top Ten 2004 mapping
updated Applicable_Platforms, Description, Modes_of_Introduction, Relationships, Other_Notes, Taxonomy_Mappings, Weakness_Ordinalities
updated Description, Observed_Examples, Other_Notes, Research_Gaps
updated Alternate_Terms, Applicable_Platforms, Demonstrative_Examples, Description, Name, References
updated Potential_Mitigations
updated Description, Name
updated Common_Consequences
updated Common_Consequences, Demonstrative_Examples, References, Relationships
updated Potential_Mitigations
updated Observed_Examples
updated Relationships, Taxonomy_Mappings
updated Causal_Nature, Modes_of_Introduction, References, Relationships, Taxonomy_Mappings
updated Taxonomy_Mappings
updated Type
updated Potential_Mitigations, Relationships
updated Potential_Mitigations
updated Relationships
updated Relationships
updated Research_Gaps
updated Observed_Examples
updated Observed_Examples
updated Demonstrative_Examples, Description
updated Demonstrative_Examples, Detection_Factors, Relationships, Time_of_Introduction
updated Mapping_Notes
updated Demonstrative_Examples, Potential_Mitigations, References
updated Applicable_Platforms, Observed_Examples
updated Common_Consequences, Description, Diagram
updated Demonstrative_Examples, Relationships
updated Applicable_Platforms, Potential_Mitigations, Relationships
updated Alternate_Terms, Name, Observed_Examples
441 vulnerabilities reference this CWE, most recent first.
GHSA-XWCW-J52R-34X4
Vulnerability from github – Published: 2026-11-19 16:12 – Updated: 2026-11-19 16:12Summary
jane-php (open-api-3) builds PHP via nikic/php-parser (AST), so string literals are escaped -- but PHPDoc comment text is emitted RAW. The generated Client/Endpoint method docblocks embed the parameter description verbatim in a @param array{ "<name>"?: ... } block. A */ in the parameter description closes the /** ... */ docblock early and lands in class-body position; because the name is a raw string key (not identifier-mangled), the */ and following PHP survive. Injecting */ public function __construct(){ <code> } /* adds an attacker-controlled __construct to the generated Client class, which runs when the client is instantiated -> RCE (CWE-94). Verified 7.11.2/PHP8.1.
Impact
Generating a client from an attacker-influenced OpenAPI document and using the generated SDK (instantiating the client, which apps do on every call) runs attacker PHP. CWE-94/95/116.
PoC
reproduce.sh (+ make_spec.py, gen.php): scaffolds a composer project with jane-php/open-api-3, generates, instantiates the generated Client, shows the marker.
Suggested fix
Neutralize */ (e.g. */->* /) in all generated PHPDoc text (parameter names, descriptions). Regression-test with a parameter name/description containing */.
maintainer-report.txt
reproduce.sh
gen.php
make_spec.py
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "jane-php/open-api-3"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "7.12.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-63411"
],
"database_specific": {
"cwe_ids": [
"CWE-116",
"CWE-94",
"CWE-95"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-19T16:12:11Z",
"nvd_published_at": "2026-11-18T22:17:22Z",
"severity": "CRITICAL"
},
"details": "### Summary\njane-php (open-api-3) builds PHP via nikic/php-parser (AST), so string literals are escaped -- but PHPDoc comment text is emitted RAW. The generated Client/Endpoint method docblocks embed the parameter description verbatim in a `@param array{ \"\u003cname\u003e\"?: ... }` block. A `*/` in the parameter description closes the `/** ... */` docblock early and lands in class-body position; because the name is a raw string key (not identifier-mangled), the `*/` and following PHP survive. Injecting `*/ public function __construct(){ \u003ccode\u003e } /*` adds an attacker-controlled __construct to the generated Client class, which runs when the client is instantiated -\u003e RCE (CWE-94). Verified 7.11.2/PHP8.1.\n\n### Impact\nGenerating a client from an attacker-influenced OpenAPI document and using the generated SDK (instantiating the client, which apps do on every call) runs attacker PHP. CWE-94/95/116.\n\n### PoC\n`reproduce.sh` (+ `make_spec.py`, `gen.php`): scaffolds a composer project with jane-php/open-api-3, generates, instantiates the generated Client, shows the marker.\n\n### Suggested fix\nNeutralize `*/` (e.g. `*/`-\u003e`* /`) in all generated PHPDoc text (parameter names, descriptions). Regression-test with a parameter name/description containing `*/`.\n[maintainer-report.txt](https://github.com/user-attachments/files/29497314/maintainer-report.txt)\n[reproduce.sh](https://github.com/user-attachments/files/29497317/reproduce.sh)\n[gen.php](https://github.com/user-attachments/files/29497319/gen.php)\n[make_spec.py](https://github.com/user-attachments/files/29497322/make_spec.py)",
"id": "GHSA-xwcw-j52r-34x4",
"modified": "2026-11-19T16:12:11Z",
"published": "2026-11-19T16:12:11Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/janephp/janephp/security/advisories/GHSA-xwcw-j52r-34x4"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-63411"
},
{
"type": "WEB",
"url": "https://github.com/janephp/janephp/pull/960"
},
{
"type": "WEB",
"url": "https://github.com/janephp/janephp/commit/0ea379deab5689475d62653b408de62ad3611c7a"
},
{
"type": "PACKAGE",
"url": "https://github.com/janephp/janephp"
},
{
"type": "WEB",
"url": "https://github.com/janephp/janephp/releases/tag/v7.12.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "Jane: Instantiation RCE via parameter description -\u003e raw PHPDoc */ breakout (jane-php/open-api-3)"
}
Mitigation
Strategy: Refactoring
If possible, refactor your code so that it does not need to use eval() at all.
Mitigation MIT-5
Strategy: Input Validation
- 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.
Mitigation
- 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.
Mitigation
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].
CAPEC-35: Leverage Executable Code in Non-Executable Files
An attack of this type exploits a system's trust in configuration and resource files. When the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.