CVE-2026-54664 swagger-typescript-api vulnerable to code injection via unescaped enum string values
Attackers can inject malicious code into generated TypeScript clients via crafted OpenAPI specs, leading to execution upon import.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-54664?
CVE-2026-54664 is a high-severity code injection vulnerability in acacode swagger-typescript-api, published on 29 Jul 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
swagger-typescript-api generates API clients for Fetch or Axios from an OpenAPI Specification. Prior to 13.12.2, src/schema-parser/base-schema-parsers/enum.ts passes components.schemas.*.enum[i] values to Ts.StringValue in src/configuration.ts without escaping before templates/base/enum-data-contract.ejs renders TypeScript enum declarations, allowing an attacker-controlled OpenAPI spec to inject code that executes when the generated module is imported. This issue is fixed in version 13.12.2.
Which versions are affected by CVE-2026-54664?
2 open source packages ship an affected version, including swagger-typescript-api.
| Package | Affected | Fixed in |
|---|---|---|
swagger-typescript-api npm | All versions | 13.12.2 |
swagger-typescript-api npm | All versions | 13.12.2 |
How do I fix CVE-2026-54664?
Upgrade swagger-typescript-api to 13.12.2 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2026-54664 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-54664 exists.
Sources
Also known as GHSA-5f94-x226-ccpm.