CSIRTS // UNIFIED SECURITY ADVISORY FEEDSYS ● ONLINE · POWERED BY INTELFUSIONS.COM

GHSA-5f94-x226-ccpm: swagger-typescript-api vulnerable to code injection via unescaped enum string values

highCVSS 8.3CVE-2026-54664
Summary swagger-typescript-api interpolates components.schemas.*.enum[i] string values into the body of generated TypeScript enum declarations without escaping. A malicious enum value can close the enclosing string literal, terminate the enum body, and inject a bare-block IIFE that executes at module load the first time the generated client is imported. The trigger requires no instantiation and no method call — only an import of the generated module. The attacker controls the OpenAPI spec (remote --url, third-party / public spec, multi-tenant platform); the victim is whoever runs the generator and imports the result (the developer, their CI runner, or any downstream consumer of the generated package). Impact is arbitrary code execution with the importing process's privileges — read any file the importer can read, write any file, exfiltrate secrets, etc. Details The root cause is Ts.StringValue in src/configuration.ts:250: StringValue: (content: unknown) => "${content}", It wraps a value in double quotes with zero escaping — no handling of ", \, newlines, or anything else. The codebase's only escape function (escapeJSDocContent in src/schema-parser/schema-formatters.ts:127) only replaces */ and is never applied to this path. Enum string values reach Ts.StringValue at src/schema-parser/base-schema-parsers/enum.ts:100 and :116: return this.config.Ts.StringValue(value); // ... value: this.config.Ts.StringValue(enumName), The result is interpolated raw into the enum body in templates/base/enum-data-contract.ejs (default enumStyle: "enum" branch, lines 24-31): export enum <%~ name %> { <%~ _.map($content, ({ key, value, description }) => { ... return [ formattedDescription && /** ${formattedDescription} */, ${key} = ${value} ].filter(Boolean).join("\n"); }).join(",\n") %> } Where ${value} is the result of Ts.StringValue — raw "${content}". An attacker-controlled enum value containing a " closes the string and exposes the surrounding code position to injection.

Details

Source
GitHub Security Advisories (INTL · database · site)
Severity
high — CVSS 8.3
Published
2026-07-29
Last updated
2026-07-29
Exploitation
Not in CISA KEV at last sync

Original advisory: https://github.com/advisories/GHSA-5f94-x226-ccpm

Exploitation outlook

EPSS (FIRST.org) estimates each CVE’s probability of exploitation in the next 30 days — here is the CSIRTS.com read on those numbers.

Referenced CVEs

CVECSIRTS overviewExternal
CVE-2026-54664coverage & exploitation statusNVD · CVE.org

Same CVEs, other sources

How other CERTs, PSIRTs and databases cover the vulnerabilities in this advisory.

More from GitHub Security Advisories