Skip to main content
Menu
Advisories

jane-php/json-schema-runtime path traversal

GHSA-V937-CJ22-V527Published Updated GitHub

Description

The CVE-2026-63415 local-$ref fix is bypassed via file://localhost/<abs-path>: PHP's file:// wrapper ignores the localhost authority, so the allow-list validates a different path than the fetch reads — arbitrary local file disclosure inlined into generated code

Summary

The fix for CVE-2026-63415 (GHSA-c3cj-3p6p-j822, SSRF+LFI via $ref resolution; fix commit 75f2bbf79c in jane-php/json-schema-runtime Reference.php::validateLocalPath) restricts local file references to paths inside the specification's directory. The check strips the file:// prefix and treats the remainder as a filesystem path — but PHP's file:// wrapper ignores the localhost authority and reads the rest as an absolute path. So for file://localhost/etc/hostname the validator checks the relative path localhost/etc/hostname (contained in the spec directory → allowed) while the fetch reads /etc/hostname. Case variants (File://localhost) and traversal (file://localhost/../…) work identically.

Verified against both the published v7.12.0 vendor dist (packagist jane-php/open-api-3, class path asserted via ReflectionClass) and the current next branch @ 9c2362d, inside Docker php:8.3.37:

  • Unit level: file://localhost/etc/hostname resolves to real /etc/hostname content on both versions; controls correctly rejected — file:///abs (no authority), ../ traversal, http://, php://, protocol-relative //host, sibling-prefix directories, and URL-source variants (a polluted source port breaks the merge → blocked; local source is the bypass route).
  • End-to-end: a spec whose query-parameter schema carries $ref: "file://localhost/tmp/lfi-canary.json" (absolute path outside the spec dir) generates successfully, and the generated Endpoint/GetCanary.php contains $optionsResolver->setDefaults(['canaryParam' => 'CANARY_LEAK_FromTmpFile']) — arbitrary local file contents inlined into generated code, on both versions.

Works under the default configuration (no allow-external-refs), with a local spec source — Jane's standard usage.

Affected version

jane-php/json-schema-runtime used by janephp 7.12.0 (released fix) and current next branch.

Impact

Arbitrary local file disclosure during code generation from untrusted OpenAPI specs (CI pipelines, spec catalogs): /etc/passwd, cloud credentials, application secrets — inlined into generated PHP. Suggested CVSS v4 7.0 (same as the accepted advisory).

Remediation

Fetch the path that the allow-list validated: normalize by stripping file:// case-insensitively along with any authority component, or reject any file:// URI carrying an authority (file://localhost/...); add these three URI shapes to the regression tests.

Dedup

GHSA-c3cj-3p6p-j822 / CVE-2026-63415 is the advisory whose fix this report bypasses (fix verified present; bypass measured on the fixed release). The PHPDoc */ RCE family (CVE-2026-63411/63413/63412) was audited in the same round: all output points verified escaped — clean.

Proof of concept

Unit harness (tests/unit_ref_v712_only.php) and end-to-end generator run (tests/e2e_lfi_v712.php), with generated evidence tests/out_v712_e2e/generated/Endpoint/GetCanary.php — available on request.

Affected versions

References

GitHub · janephp/janephp