CVE-2026-54662 swagger-typescript-api vulnerable to code injection via unescaped `servers[0].url` in fetch http-client template
Attackers can inject malicious TypeScript code via OpenAPI specs, leading to code execution when the generated client is imported.
- 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-54662?
CVE-2026-54662 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 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.
Which versions are affected by CVE-2026-54662?
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-54662?
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-54662 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-54662 exists.
Sources
Also known as GHSA-hqj5-cw9f-rx67.