Skip to content
Noroxi
OSV ecosystem advisory

GHSA-2q42-4q24-7rgv: OpenAPI3 version value escapes `emitterOutputDir` and overwrites YAML/JSON outside the output tree

HighCVSS 7.1 · v3.1—No exploit No fix recorded

Noroxi assessment

Priority: Monitor (action score 28/100)

  • The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
  • Someone with local access to the system can trigger it. No account or password is required. A user must open a link or visit a page. No special conditions are required; it is repeatable.
  • No fixed version is recorded, but the references include a patch (commit or PR) link.

Low priority for now. See the fix and affected versions sections below.

Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it

Primary sources: OSV

### Summary The `@typespec/openapi3` emitter retains the value of a `@versioned` enum member and interpolates it into the output filename as `{version}` without sanitizing path separators or traversal components. The completed path reaches the compiler's `emitFile()`, which creates the parent directory and writes the file without verifying containment under `emitterOutputDir`. A crafted declarative `.tsp` input can therefore create or overwrite an OpenAPI-formatted `.yaml` or `.json` file outside the configured output tree, subject to the compiler process's filesystem permissions. No executable TypeSpec extension or attacker-controlled JavaScript is required. ### Affected version Confirmed on: - `@typespec/compiler` `1.15.0` - `@typespec/openapi3` `1.15.0` - `@typespec/http` `1.15.0` - `@typespec/versioning` `0.85.0` - release tag commit `f30cd352f93997e04c75d48c7ace6947a1d5d07a` The critical `openapi.ts` and `emitter-utils.ts` blobs are unchanged on main commit `365ec52b50b82cd9e1e037de4c6fcd5de7e32e90` as checked on 2026-08-19. No patched version was identified. ### Root cause The value originates at `packages/openapi3/src/openapi.ts:592-608`: ```ts serviceRecord.versions.push({ service, version: snapshot.version!.value, document: document[0], diagnostics: document[1], }); ``` It is interpolated without path validation at `openapi.ts:629-641`: ```ts return interpolatePath(options.outputFile, { "openapi-version": specVersion, "service-name-if-multiple": multipleService ? getNamespaceFullName(service.type) : undefined, "service-name": getNamespaceFullName(service.type), "file-type": fileType, version, }); ``` The path reaches `emitFile()` at `openapi.ts:392-401`. The sink at `packages/compiler/src/core/emitter-utils.ts:29-39` performs no output-root containment check: ```ts const outputFolder = getDirectoryPath(options.path); await program.host.mkdirp(outputFolder); return await program.host.writeFile(options.path, content); ``` `resolvePath()` joins the template to `emitterOutputDir` before `{version}` is interpolated, so it does not see the attacker-controlled `..` components. ### Proof of concept The relevant input in `poc/main.tsp` is: ```tsp @versioned(Versions) namespace Svc; enum Versions { v1: "../../../../../../../../../../tmp/TYPESPEC_PWNED/pwn" } ``` Run from PowerShell: ```powershell cd poc .\run-revalidation.ps1 ``` The supplied Docker runner uses a digest-pinned Node base, a committed npm integrity lock, disabled runtime networking, a benign control, a 90-second timeout, and cleanup enforcement. Observed in the preserved identity-locked replay (`1/1` attack and `1/1` negative control): ```text negative_before=02dc7d056c2f773e56e2c1849947888b039f127ddd630c0bd76a5d7a9ca29cbd negative_after=02dc7d056c2f773e56e2c1849947888b039f127ddd630c0bd76a5d7a9ca29cbd attack_before=7a8067bc04e42a025de90fd7aff9be4df59f005d192f2116eecfb107d7bffd78 attack_after=2992b399c1573c9bd2130794f8554c4026bf425861f74e78b5d89ae0324b5e38 outside_file_head=openapi: 3.0.0 inside_attack_files= ``` The benign version preserved the outside canary. The crafted version replaced it with emitted OpenAPI content, and no attack output file remained under `tsp-output`. ### Impact and constraints Proven impact is out-of-directory YAML/JSON creation or overwrite. The attacker can influence the traversal, final basename, and many strings in the OpenAPI-structured content. The extension is constrained to the selected emitter format, content is not arbitrary bytes, and the target must be writable. This report demonstrates file corruption. Denial of service is a potential impact when a writable critical file is targeted. It does not claim file disclosure, arbitrary-byte write, deployment takeover, or code execution by a downstream consumer. ### Suggested remediation After every filename token has been interpolated, resolve the completed destination against `emitterOutputDir` and reject any non-descendant using path-component-aware comparison. Reject or slugify absolute paths, path separators, and traversal components in spec-derived filename tokens. Add regression cases for POSIX and Windows separators, absolute values, sibling-prefix paths, and benign semantic versions.

Published
Sep 8, 2026
Updated
Sep 8, 2026
EPSS
—

Report tools

JSON

Action score

28

Monitor

Low priority for now.

CVSS
28 / 40 · 7.1 / 10
CISA KEV
0 / 30 · Not listed
EPSS
0 / 30 · —

Get told when this record changes

  • Not in KEV: no record of exploitation in the wild
  • No public exploit code on record
  • No fixed version yet

If any of these changes, we'll tell you in the daily email digest.

Follow GHSA-2q42-4q24-7rgv

When you'll hear from us

  • when it enters CISA KEV
  • when exploit code appears or is weaponized
  • when the record is updated (including a fixed version)
  • when EPSS rises 20 points in a week

One daily email digest (06:00 UTC); connect a webhook for KEV listings and weaponized exploits every 10 minutes on paid plans, on the hour on the free plan.

Your free account also gets you

  • CVE alerts: add the products and versions you run, get the new CVEs that affect them
  • Uptime monitoring: 1 site, instant email when it goes down
  • Add your domain: subdomains and takeover risk scanned every week (1 domain)
  • 10 scans an hour on the security tools, at most 30 a day (3 a day without an account), an API key and MCP
  • All your scans in one panel: findings, what changed in the last scan, a report per domain or per client (PDF, share link)
All free tools
Is your version affected? Check it

Noroxi analysis

What does it mean in your environment?

The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.

We use this product, ask for help

Affected systems

Is your version affected?

Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.

VendorProduct
npm@typespec/openapi3
npm@typespec/compiler

Package-level exposure

OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.

EcosystemPackageAffected rangeFix
npm@typespec/compilerup to and including 1.15.0—
npm@typespec/openapi3up to and including 1.15.0—

Remediation

Which version to upgrade to

Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.

No fix version is recorded for this entry. Check the references for vendor advisories.

Exploit status

No known public exploit

No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.

Research context

For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.

Timeline

From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.

No dated events beyond publication.

Patch and commit links

Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.

Not on record for this CVE: EPSS history · researcher credit · variant or chain candidate · public bounty program.

Technical details

Attack conditions

  • Someone with local access to the system can trigger it.
  • No account or password is required.
  • A user must open a link or visit a page.
  • No special conditions are required; it is repeatable.

If successful

Confidentiality
none
Integrity
high · data or configuration can be modified
Availability
high · the service can be disrupted
Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality impact
None
Integrity impact
High
Availability impact
High

CVSS vector

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H

osv

Root cause

A user-supplied file name is joined with the allowed directory, but the result is never checked to confirm it is still inside that directory.

A representative example of this vulnerability class. Not the vendor's source code; it shows the faulty pattern and its fix.

Vulnerable

ts
const file = path.join(ROOT, req.query.name);res.sendFile(file);

Fixed

ts
const file = path.resolve(ROOT, req.query.name);if (!file.startsWith(ROOT + path.sep)) {  return res.sendStatus(400);}res.sendFile(file);

References

All records