CVE-2026-54662
Deferred Deferred - Pending Action

TypeScript Fetch Client Code Injection in swagger-typescript-api

Vulnerability report for CVE-2026-54662, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-07-29

Last updated on: 2026-07-29

Assigner: GitHub, Inc.

Description

swagger-typescript-api generates API clients for Fetch or Axios from OpenAPI specifications. Prior to 13.12.2, src/code-gen-process.ts createApiConfig copies servers[0].url into apiConfig.baseUrl, and templates/base/http-clients/fetch-http-client.ejs interpolates apiConfig.baseUrl into the generated HttpClient baseUrl field without escaping, allowing an attacker-controlled OpenAPI spec to inject TypeScript static field code that executes when the generated fetch client module is imported. This issue is fixed in version 13.12.2.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-07-29
Last Modified
2026-07-29
Generated
2026-08-19
AI Q&A
2026-07-30
EPSS Evaluated
2026-08-18
NVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
swagger_typescript_api swagger_typescript_api 13.12.2

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-94 The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
CWE-74 The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
CWE-1336 The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability affects swagger-typescript-api versions before 13.12.2. It allows an attacker to inject malicious TypeScript code into the generated API client by manipulating the OpenAPI specification. The code executes when the client module is imported due to improper handling of the baseUrl field.

Detection Guidance

Check if your project uses swagger-typescript-api versions prior to 13.12.2. Inspect generated API client code for unescaped server URLs in baseUrl fields. Review OpenAPI specs for suspicious server URLs that may inject TypeScript code.

Impact Analysis

If you use a vulnerable version of swagger-typescript-api and import a client generated from an attacker-controlled OpenAPI spec, the injected code could execute arbitrary commands on your system. This could lead to data theft, system compromise, or further network attacks.

Compliance Impact

This vulnerability could lead to unauthorized code execution, potentially causing data breaches. Such breaches may violate GDPR (data protection) or HIPAA (healthcare data privacy) requirements, leading to legal penalties, reputational damage, and loss of trust.

Mitigation Strategies

Upgrade swagger-typescript-api to version 13.12.2 or later. Regenerate API clients from OpenAPI specs. Audit and sanitize OpenAPI specs to remove any malicious server URLs or code injection attempts.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-54662. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart