DEV Community

CVE Reports
CVE Reports

Posted on Originally published at cvereports.com

CVE-2026-63413: CVE-2026-63413: Remote Code Execution via PHPDoc Comment Breakout in Jane PHP OpenAPI 3 Generator

CVE-2026-63413: Remote Code Execution via PHPDoc Comment Breakout in Jane PHP OpenAPI 3 Generator

Vulnerability ID: CVE-2026-63413
CVSS Score: 9.3
Published: 2026-11-19

CVE-2026-63413 is a code injection vulnerability in the Jane PHP OpenAPI 3 SDK generator (jane-php/open-api-3) prior to version 7.12.0. The vulnerability occurs because the generator interpolates OpenAPI header and query parameter names directly into generated PHPDoc comment blocks without sanitizing comment closing delimiters (*/). An attacker who supplies or modifies an OpenAPI specification can break out of the docblock context and inject arbitrary PHP methods, such as a class constructor, into the generated Client or Endpoint class body. When the consuming application instantiates the generated SDK, the injected code executes with the privileges of the host PHP process.

TL;DR

Jane PHP OpenAPI 3 generator versions prior to 7.12.0 fail to escape PHPDoc closing delimiters (*/) in parameter names and descriptions. Generating a PHP client from a malicious OpenAPI specification allows an attacker to inject arbitrary class-level PHP code, resulting in remote code execution upon client instantiation.


⚠️ Exploit Status: POC

Technical Details

  • Vulnerability Type: CWE-94: Improper Control of Generation of Code (Code Injection)
  • CVSS v4.0 Score: 9.3 Critical (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)
  • Affected Component: jane-php/open-api-3 (NonBodyParameterGenerator.php)
  • Affected Versions: < 7.12.0
  • Patched Version: 7.12.0
  • EPSS Score: 0.31% (24.64th percentile)
  • Exploit Status: Proof-of-Concept (Regression tests in official repository)
  • CISA KEV Status: Not Listed

Affected Systems

  • jane-php/open-api-3
  • janephp/janephp
  • jane-php/open-api-3: < 7.12.0 (Fixed in: 7.12.0)

Code Analysis

Commit: 0ea379d

Escape */ in generated PHPDoc comments across OpenAPI and JsonSchema generators (PR #960)

diff --git a/src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php b/src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php
--- a/src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php
+++ b/src/Component/OpenApi3/Generator/Parameter/NonBodyParameterGenerator.php
@@ -145,7 +145,7 @@ public function generateMethodDocParameter($parameter, Context $context, string
             $type = implode('|', $this->convertParameterType($parameter->getSchema()));
         }

-        return rtrim(\sprintf(' * @param %s $%s %s', $type, $this->getInflector()->camelize($parameter->getName()), $parameter->getDescription() ?: ''));
+        return rtrim(\sprintf(' * @param %s $%s %s', $type, str_replace('*/', '*\\/', $this->getInflector()->camelize($parameter->getName())), str_replace('*/', '*\\/', $parameter->getDescription() ?: '')));
     }

     public function generateOptionDocParameter(Parameter $parameter): string
@@ -156,12 +156,12 @@ public function generateOptionDocParameter(Parameter $parameter): string
             $type = implode('|', $this->convertParameterType($parameter->getSchema()));
         }

-        $description = implode("\n", array_map(rtrim(...), explode("\n", $parameter->getDescription() ?: '')));
+        $description = implode("\n", array_map(fn (string $line): string => str_replace('*/', '*\\/', rtrim($line)), explode("\n", $parameter->getDescription() ?: '')));

         return rtrim(
             \sprintf(
                 ' *    "%s"%s: %s%s',
-                $parameter->getName(),
+                str_replace('*/', '*\\/', $parameter->getName()),
                 $parameter->getRequired() ? '' : '?',
                 $type,
                 $description !== '' ? ', //' . $description : ','
Enter fullscreen mode Exit fullscreen mode

Exploit Details

  • GitHub: Official fix commit including IssuePhpDocInjectionRegressionTest.php demonstrating the PHPDoc breakout payload.
  • GitHub: GitHub Security Advisory describing the header parameter PHPDoc breakout mechanism.

Mitigation Strategies

  • Upgrade jane-php/open-api-3 and associated Jane PHP packages to version 7.12.0 or later.
  • Regenerate all PHP client and endpoint classes from clean OpenAPI specifications after upgrading.
  • Validate and sanitize untrusted OpenAPI specifications prior to code generation, restricting parameter names to RFC 7230 token characters.
  • Integrate static analysis checks in CI/CD pipelines to detect unexpected methods or docblock breakouts in generated code directories.

Remediation Steps:

  1. Run composer require jane-php/open-api-3:^7.12.0 to update the generator library to the patched release.
  2. Audit OpenAPI specification files for the presence of */ or /* tokens in parameter names and descriptions.
  3. Execute vendor/bin/jane-openapi generate to rebuild all generated Client, Endpoint, and Model PHP files.
  4. Inspect the git diff of the generated output directory to verify that no unauthorized class methods or constructors exist.

References


Read the full report for CVE-2026-63413 on our website for more details including interactive diagrams and full exploit analysis.

Top comments (0)