Swagger-typescript-api Vulnerable to Authorization Token Exfiltration via Spec $ref
The `swagger-typescript-api` tool is vulnerable to authorization token exfiltration. When a developer provides an `--authorizationToken` to fetch an OpenAPI specification, the tool attaches this token to all subsequent HTTP requests made while resolving external `$ref` URLs within the spec. Critically, it lacks same-origin checks, allowing a malicious OpenAPI spec containing a `$ref` to an attacker-controlled URL to cause the authorization token (e.g., GitHub PAT, OAuth bearer) to be sent verbatim to the attacker. This credential disclosure provides an attacker with the same scope of access as the stolen token, affecting development environments, CI/CD pipelines, and multi-tenant SaaS platforms.
What's new
- l2 added detection rule: Detect Node.js Processes Accessing Sensitive System Files Jul 29, 14:33 via ghsa
The swagger-typescript-api tool, specifically versions up to and including 13.12.1, is vulnerable to authorization token exfiltration (CVE-2026-54660). This vulnerability arises when the tool is used to generate API clients from an OpenAPI specification, and a developer provides an --authorizationToken flag to authenticate against a private spec. The tool's getRemoteRequestHeaders() function unconditionally attaches this token to the Authorization header of every subsequent HTTP request made while resolving external $ref URLs within the specification. Crucially, it fails to perform a same-origin check, host allowlist, or scope-down, meaning that a maliciously crafted OpenAPI spec with an external $ref pointing to an attacker-controlled domain will cause the developer's sensitive token (such as a GitHub Personal Access Token, OAuth bearer token, or API key) to be sent verbatim to the attacker. This flaw poses a significant risk to development environments, CI/CD pipelines, and multi-tenant SaaS platforms, as the captured token grants attackers the same level of access as the legitimate developer.
Attack Chain
- An attacker crafts a malicious OpenAPI specification containing an external
$refpointing to an attacker-controlled URL (e.g.,http://attacker.example/exfil-endpoint/data.json). - The attacker delivers this malicious spec to a developer or injects it into a trusted spec (e.g., via a compromised repository or supply chain attack).
- A developer or automated CI/CD pipeline executes
swagger-typescript-api generateagainst the malicious or compromised OpenAPI specification, supplying a sensitive authorization token via the--authorizationTokenflag. - During the code generation process,
swagger-typescript-apiattempts to resolve the external$refURLs defined within the spec. - The vulnerable
swagger-typescript-apicomponentgetRemoteRequestHeaders()attaches the developer's full--authorizationTokenvalue to the HTTP request without performing a same-origin check. swagger-typescript-apimakes an outbound HTTP GET request to the attacker-controlled URL, including the sensitive token in theAuthorizationheader.- The attacker's server receives the request and captures the exposed authorization token.
- The attacker can then use the stolen token to gain unauthorized access to the services or resources associated with the token's scope, mimicking the developer's privileges.
Impact
The vulnerability, identified as CVE-2026-54660, directly leads to the exposure of sensitive credentials, typically high-value authorization tokens. The impact is significant, as the stolen token grants attackers the same scope of access as the developer or system it was stolen from. This could include full source-code read/write access via a GitHub Personal Access Token, full impersonation on an API via an OAuth bearer token, or extensive account access through an AWS-style API key, depending on the token's privileges. Affected use cases include developers fetching private OpenAPI specs, CI/CD pipelines regenerating clients from private specs, and multi-tenant SaaS platforms that generate per-tenant clients. The credential theft occurs at generation time, meaning the risk is realized as soon as swagger-typescript-api generate is run with a malicious spec and an authorization token.
Recommendation
- Patch CVE-2026-54660 by upgrading
swagger-typescript-apito a version greater than 13.12.1 as soon as a fix is released by the maintainers. - Implement robust network egress filtering for systems running
swagger-typescript-apito prevent outbound connections to untrusted external URLs, particularly on non-standard ports. - Review and restrict the scope and lifetime of
--authorizationTokens used withswagger-typescript-api, adhering to the principle of least privilege. - Run
swagger-typescript-apiin isolated environments (e.g., containers, ephemeral build agents) with minimal network access and permissions, similar to the SSRF mitigations suggested in the companion advisory.
Detection coverage 1
Detect Node.js Processes Accessing Sensitive System Files
highDetects CVE-2026-54661 post-exploitation behavior where a Node.js process might attempt to read sensitive system files like /etc/passwd or /etc/shadow as a result of arbitrary code execution.
Detection queries are available on the platform. Get full rules →