PT-2026-50682 · Npm · Swagger-Typescript-Api
CVE-2026-54664
·
Published
2026-06-18
·
Updated
2026-07-29
CVSS v3.1
8.3
High
| Vector | AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H |
Name of the Vulnerable Software and Affected Versions
swagger-typescript-api versions prior to 13.12.2
Description
swagger-typescript-api fails to escape string values from
components.schemas.*.enum[i] when generating TypeScript enum declarations. An attacker providing a malicious OpenAPI specification can inject arbitrary code into the generated module. This code executes at module load time—the moment the generated client is imported—without requiring any function calls or object instantiation. The vulnerability stems from the Ts.StringValue function in src/configuration.ts, which wraps content in double quotes without escaping characters such as quotes or backslashes. This allows an attacker to close the string literal and the enum body to execute a bare-block Immediately Invoked Function Expression (IIFE). The impact is arbitrary code execution with the privileges of the process importing the module, potentially allowing the attacker to read or write files and exfiltrate secrets.Recommendations
Update swagger-typescript-api to version 13.12.2 or later.
Exploit
Fix
Special Elements Injection
Code Injection
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
Swagger-Typescript-Api