Nov 19, 2026·9 min read·2 visits
Improper escaping of PHPDoc comment blocks in Jane PHP before version 7.12.0 allows attackers to break out of multi-line comments via crafted OpenAPI parameter names and inject arbitrary executable PHP code into generated client classes.
CVE-2026-63412 is a code injection vulnerability in the Jane PHP library suite (affecting jane-php/open-api-3, jane-php/open-api-2, jane-php/open-api-31, and jane-php/json-schema) prior to version 7.12.0. The flaw occurs during the automated generation of PHP client SDKs and data models from OpenAPI specifications. While Jane uses an Abstract Syntax Tree (AST) for safe generation of standard PHP tokens, it constructs PHPDoc comments via raw string interpolation without neutralizing multi-line comment closing delimiters (*/). An attacker who provides or modifies an OpenAPI specification can inject a closing comment sequence inside a query parameter name, escaping the docblock context and writing arbitrary PHP code directly into the class body of generated endpoints or clients. When the consuming application instantiates the generated class, injected methods such as __construct() execute automatically, resulting in remote code execution.
Jane PHP (janephp/janephp) is a library ecosystem used in PHP applications to generate data models and API client SDKs from JSON Schema and OpenAPI (Swagger) specifications. Developers use Jane during build pipelines or dynamic integration workflows to translate external API contracts into strongly typed PHP classes, endpoints, and normalizers.
Because code generators translate unstructured or semi-structured external definitions into executable source files, they expose a distinct attack surface if they process untrusted specifications. To prevent code injection within standard PHP constructs—such as class names, property declarations, and method signatures—Jane utilizes nikic/php-parser to construct an Abstract Syntax Tree (AST). When the AST is serialized into source code, the parser library enforces syntactic validity and escapes string literals.
However, CVE-2026-63412 bypasses this AST protection by targeting the generation of PHPDoc comment blocks. In versions of Jane prior to 7.12.0, docblocks are assembled through direct string concatenation and attached to AST nodes as raw comment attributes. Because nikic/php-parser does not validate or escape the internal contents of comment nodes, any input containing the multi-line comment termination sequence (*/) prematurely closes the docblock in the emitted PHP file.
Classified under CWE-94 (Improper Control of Generation of Code) and CWE-116 (Improper Encoding or Escaping of Output), this flaw allows an attacker controlling an OpenAPI specification to inject arbitrary PHP code into the generated files. When the consuming application loads and instantiates the generated client or endpoint class, the injected code executes under the privilege context of the PHP runtime.
The root cause of CVE-2026-63412 is the lack of output sanitization when interpolating OpenAPI specification fields into multi-line PHP comments (/** ... */). When nikic/php-parser prints an AST node with an associated PhpParser\Comment\Doc attribute, it outputs the comment string verbatim immediately preceding the node definition.
In the OpenAPI 3 generator component (jane-php/open-api-3), the class NonBodyParameterGenerator is responsible for documenting query, header, and path parameters within the generated Endpoint and Client classes. Specifically, the generateOptionDocParameter() method formats each non-body parameter into a structured PHPDoc list indicating the parameter's name, type, optionality, and description.
During this formatting step, the generator retrieves the parameter name directly from the parsed OpenAPI specification via $parameter->getName() and inserts it into a sprintf() template without escaping comment delimiters. A similar lack of sanitization occurs when processing parameter descriptions, model property descriptions, and endpoint constructor documentation across the OpenAPI 2, OpenAPI 3, OpenAPI 3.1, and JSON Schema components.
Because the PHPDoc block for an endpoint method or class constructor sits directly inside the class body scope, terminating the comment early places any subsequent characters directly into the class declaration context. By supplying a parameter name that closes the comment, defines a new class method, and opens a trailing block comment (/*), an attacker can inject syntactically valid PHP methods into the generated class without triggering syntax errors during parsing.
In src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php, the vulnerable implementation of generateOptionDocParameter() constructs the documentation line for array options as follows:
public function generateOptionDocParameter(Parameter $parameter): string
{
// ...
$description = implode("\n", array_map(rtrim(...), explode("\n", $parameter->getDescription() ?: '')));
return rtrim(
\sprintf(
' * "%s"%s: %s%s',
$parameter->getName(), // Vulnerable: emitted verbatim without escaping '*/'
$parameter->getRequired() ? '' : '?',
$type,
$description !== '' ? ', //' . $description : ',' // Vulnerable if description contains '*/'
)
);
}A parallel issue existed in generateMethodDocParameter() within the same class, where camelized parameter names and descriptions were concatenated directly into @param annotations. Furthermore, GetConstructorTrait.php, GetterSetterGenerator.php, and PropertyGenerator.php across the OpenApi2, OpenApi3, OpenApi31, and JsonSchema components exhibited identical unescaped interpolation of specification metadata into docblocks.
Commit 0ea379deab5689475d62653b408de62ad3611c7a (Pull Request #960) addresses this vulnerability by applying str_replace('*/', '*\\/', ...) to all user-controlled specification strings before inserting them into docblock templates.
// Patched implementation in src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php
public function generateOptionDocParameter(Parameter $parameter): string
{
// ...
$description = implode("\n", array_map(fn ($line) => str_replace('*/', '*\\/', rtrim($line)), explode("\n", $parameter->getDescription() ?: '')));
return rtrim(
\sprintf(
' * "%s"%s: %s%s',
str_replace('*/', '*\\/', $parameter->getName()), // Fix: neutralizes closing comment tag
$parameter->getRequired() ? '' : '?',
$type,
$description !== '' ? ', //' . $description : ','
)
);
}The patch applies this sanitization across nine distinct generator files, covering parameter names, camelized parameter variable names, parameter descriptions, endpoint constructor documentation, and JSON Schema model getter/setter descriptions.
> [!NOTE]
> Evaluating fix completeness: Replacing */ with *\/ is sufficient to prevent premature termination of multi-line /* ... */ and /** ... */ comments in PHP because the PHP lexer does not recognize *\/ as a comment terminator, nor does PHP support nested multi-line comments where an injected /* could alter lexical state inside an already open docblock. However, because the fix relies on manual str_replace() calls at individual call sites rather than centralizing sanitization inside a dedicated DocBlock builder wrapper around PhpParser\Comment\Doc, future generator additions must manually implement this escaping to avoid reintroducing variants.
Exploiting CVE-2026-63412 requires an application or build system to process an attacker-controlled or modified OpenAPI specification using an affected version of Jane PHP, and subsequently load or instantiate the generated code. No special runtime flags or privileges are required beyond standard SDK generation and usage.
To construct a clean exploit payload that maintains valid PHP syntax throughout the generated file, the attacker crafts a query parameter definition inside an OpenAPI specification. The payload must perform three lexical actions: close the active PHPDoc block, inject a valid class-level declaration, and open a new block comment to consume the remainder of the original PHPDoc block.
{
"openapi": "3.0.0",
"info": {
"title": "Exploit API",
"version": "1.0.0"
},
"paths": {
"/items": {
"get": {
"operationId": "getItems",
"parameters": [
{
"name": "*/ public function __construct(){ system('id'); } /*",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}When Jane generates the corresponding PHP class from this specification, generateOptionDocParameter() interpolates the malicious name field into the class or method docblock, producing the following PHP output:
/**
* @param array $queryParameters {
* "*/ public function __construct(){ system('id'); } /*": string,
* }
*/When the PHP interpreter parses this generated file, the docblock terminates at the first */ inside the quotation marks. The interpreter then encounters public function __construct(){ system('id'); } at the class body level, registering it as the class constructor (provided the target class does not already define a conflicting __construct method, or if injected into an endpoint/client class where a constructor or invoked method can be hijacked). The trailing /* opens a standard multi-line comment that cleanly encapsulates the leftover ": string, * } characters until the original docblock closing token */ is reached.
Once the generated file is included by the application's autoloader, instantiating the generated class (e.g., $client = new \Jane\Generated\Client(); or instantiating the generated Endpoint) immediately triggers the injected __construct() method, executing arbitrary system commands.
The primary impact of CVE-2026-63412 is arbitrary remote code execution within the context of the PHP application or CI/CD pipeline consuming the generated code. Once arbitrary PHP code executes, an attacker gains full access to the application's memory space, filesystem permissions, environment variables (including API keys and database credentials), and internal network resources.
The vulnerability is rated Critical with a CVSS v4.0 base score of 9.3 (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). The Network (AV:N) attack vector and Low (AC:L) complexity reflect scenarios where automated systems, API gateways, or developer platforms dynamically fetch and compile remote OpenAPI specifications without manual code review of the generated artifacts.
In environments where Jane PHP is executed strictly by developers on local machines or during CI/CD build pipelines against third-party specifications, the vulnerability acts as a supply-chain compromise vector. If an upstream API provider is compromised or serves a malicious OpenAPI schema update, an automated SDK regeneration workflow will embed the backdoor directly into the resulting PHP package or deployment artifact.
According to threat intelligence metrics, the Exploit Prediction Scoring System (EPSS) score for CVE-2026-63412 is 0.00391 (33.98th percentile), and it is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The vulnerability was disclosed alongside three related advisories (GHSA-xwcw-j52r-34x4, GHSA-x9xr-53qx-9qcf, and GHSA-c3cj-3p6p-j822) addressing code generation safety in the 7.12.0 release.
To remediate CVE-2026-63412, organizations must upgrade all installed Jane PHP components—specifically jane-php/open-api-3, jane-php/open-api-2, jane-php/open-api-31, jane-php/json-schema, and jane-php/open-api-common—to version 7.12.0 or later.
Because Jane PHP is a code generator that writes persistent PHP source files to disk, updating the Composer package dependency alone does not remove code that was already injected into existing builds. After upgrading to version 7.12.0, teams must delete all previously generated model, endpoint, normalizer, and client files, and re-run the jane-openapi generate (or jane-json-schema generate) command to produce sanitized artifacts.
For environments where immediate upgrading is not feasible, implement the following compensating controls:
*/ within parameter names, property names, operation IDs, or description fields.php -l) on generated code inside CI/CD pipelines, and require manual pull request review for all changes to generated SDK directories.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| Product | Affected Versions | Fixed Version |
|---|---|---|
jane-php/open-api-3 janephp | < 7.12.0 | 7.12.0 |
jane-php/open-api-2 janephp | < 7.12.0 | 7.12.0 |
jane-php/open-api-31 janephp | < 7.12.0 | 7.12.0 |
jane-php/json-schema janephp | < 7.12.0 | 7.12.0 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-63412 (GHSA-q8v2-3j4h-xg2p) |
| Weakness Class | CWE-94 (Code Injection) / CWE-116 (Improper Escaping) |
| CVSS v4.0 Score | 9.3 Critical (AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H) |
| EPSS Score | 0.39% (33.98th Percentile) |
| Affected Versions | janephp/janephp < 7.12.0 |
| Patched Version | 7.12.0 |
| Exploit Status | Public PoC Available |
| CISA KEV Status | Not Listed |
The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
CVE-2026-58214 is an incorrect authorization vulnerability (CWE-863) in the MQTT bridge implementation of NATS Server. The vulnerability results from an incomplete fix for CVE-2026-33217 within the subscription processing routine in server/mqtt.go. Because internal delivery subscriptions bypass standard account-level allow-list validation in canSubscribe, the MQTT session manager relies on explicit prefix filtering in processSubs to prevent clients from subscribing to internal broker subjects. Affected versions fail to validate incoming MQTT subscription filters against the internal QoS 2 PubRel delivery prefix ($MQTT.deliver.pubrel.), allowing authenticated MQTT clients to subscribe to internal operational subjects and monitor QoS 2 protocol metadata across all sessions within the same NATS account.
CVE-2026-69155 (GHSA-x277-3wcg-g9r2) is a stored cross-site scripting (XSS) vulnerability in Atomic Server versions 0.30.0 prior to 0.40.3. The vulnerability resides in the HTTP file-download handler (server/src/handlers/download.rs), which serves user-uploaded files with an inline Content-Disposition and attacker-controlled MIME types such as text/html or image/svg+xml. Because the endpoint lacks X-Content-Type-Options: nosniff and Content-Security-Policy restrictions, an authenticated user with upload privileges can store malicious JavaScript that executes within a victim's browser in the primary application origin. Executing code in this context grants access to non-HttpOnly session cookies and unencrypted Ed25519 cryptographic private keys stored in IndexedDB, leading to full account takeover.
CVE-2026-69156 is an authenticated path traversal and arbitrary file read vulnerability in Ontola Atomic Server versions 0.30.0 prior to 0.40.3. The flaw arises from a failure to restrict server-managed properties during Commit ingestion in lib/src/commit.rs, combined with unsanitized filesystem path construction in the /download endpoint handler in server/src/handlers/download.rs. An authenticated Agent can assign an arbitrary relative or absolute filesystem path to the internalId property of an owned resource and retrieve the target file via the download endpoint, exposing the server configuration file (config.toml) and the root Agent ED25519 private key.
CVE-2026-69157 (GHSA-pfwx-xjp4-qxcj) is a critical missing authentication vulnerability (CWE-306) affecting Atomic Server versions 0.29.0 through 0.40.2. During initial deployment, the server exposes an unauthenticated /setup endpoint that generates an invite token granting root write permissions across the entire Drive. Because the invite redemption handler discards the redeemer identity, an unauthenticated remote attacker can intercept or request this setup invite on an unclaimed instance, register an arbitrary Agent public key, and assume full administrative control over the database.
CVE-2026-69158 is a high-severity Server-Side Request Forgery (SSRF) vulnerability in Ontola Atomic Server (atomic-server) and its underlying Rust library (atomic_lib). Prior to versions 0.40.2 and 0.40.3, the server exposed an unauthenticated HTTP GET endpoint at /bookmark (and handled user-supplied URLs via POST to /import) that fetched arbitrary caller-supplied URLs after performing only a naive string prefix check. Because endpoint routing bypassed read authorization checks and reflected the retrieved content back to the client, unauthenticated remote attackers can force the server to issue HTTP GET requests to internal network destinations, localhost services, and cloud instance metadata endpoints.
CVE-2026-71425 (GHSA-7jvc-9xq8-frff) is a Server-Side Request Forgery (SSRF) and credential exposure vulnerability in Outstatic, an open-source Next.js-based static site Content Management System (CMS). In versions prior to 2.2.1, the authenticated GitHub REST proxy (/api/outstatic/github) constructed upstream URLs via insecure string concatenation of an unvalidated endpoint parameter and merged arbitrary user-supplied HTTP headers directly into outbound requests. Because the proxy automatically attaches the active user's GitHub OAuth access token to these requests, an authenticated caller or an attacker leveraging a cross-origin request primitive can redirect the server's outbound request to an arbitrary external host and exfiltrate the OAuth bearer token.