Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft OpenAPI document with single-quote payload
-
DeliveryVictim runs openapi-typescript-codegen against it
-
ExploitPayload breaks out of single-quoted template literal
-
ExecutionGenerated client imported or service method called
-
ImpactArbitrary JavaScript executes in consumer context
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the victim generate a TypeScript client with openapi-typescript-codegen (version <=0.31.0) from an OpenAPI document that is wholly or partly attacker-controlled, and then import the generated code or call a generated service method. The concrete injection points named in the description are path keys, parameter names, servers[0].url, and info.version - any of which, if containing an unescaped single quote plus JavaScript, breaks out of a single-quoted string literal in the Handlebars-generated output. Limiting factors: the attacker must be able to influence the OpenAPI spec consumed at generation time (e.g. third-party, public, or user-submitted specs), and a build/generation step followed by import or invocation must occur - purely trusted, first-party specs are not exposed. There is no runtime network-service exposure; this is a build-time/supply-chain code-execution condition against environments that generate clients from untrusted API definitions. |
| Impact | This is a CWE-94 code-injection flaw in openapi-typescript-codegen (through 0.31.0), a developer code-generation library, carrying a vendor/VulnCheck CVSS 4.0 base score of 9.3 (AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H). The headline score treats this as a network, no-interaction, no-privilege critical, but that is misleading for real-world triage: exploitation is NOT a remote attack on a running service - it requires a developer (or build pipeline) to run the generator against an attacker-supplied OpenAPI document and then import/execute the generated client. That is a meaningful user-interaction/trust-boundary step the CVSS 4.0 UI:N does not capture, so I independently add UI:R (see assessed vectors below). On the exploitation signals: there is no CISA KEV listing, no EPSS probability supplied, and no public exploit code identified at time of analysis - so there is no evidence of active or at-scale exploitation; this is a disclosure-stage finding from VulnCheck with concrete source-line references to the vulnerable Handlebars templates. Net: genuinely high technical impact (arbitrary JavaScript execution) within a specific supply-chain/build-time threat model, but real-world risk is bounded by the need to process an untrusted spec. Treat as a priority for teams that generate clients from third-party or user-supplied OpenAPI documents, and as lower urgency for teams generating only from their own trusted specs. Note also the product is a deprecated project, so a maintained upstream fix may not be available - verify remediation path. |
| Exploit ScenarioDerived | An attacker publishes or supplies a crafted OpenAPI document containing a single quote plus JavaScript in a field such as a path key, parameter name, servers[0].url, or info.version. A victim developer or CI pipeline runs openapi-typescript-codegen (<=0.31.0) against that document, and the unescaped value breaks out of a single-quoted string literal in the generated TypeScript. The injected JavaScript then executes when the generated client is imported or a service method is called. No public exploit code was identified at time of analysis, though the VulnCheck advisory and CVE references point directly to the vulnerable template lines. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 10, 2026
Code injection in openapi-typescript-codegen through 0.31.0 allows attackers who control or influence an OpenAPI document to inject arbitrary JavaScript into generated TypeScript clients, which then executes when the client is imported or its service methods are called. Exploitation requires the victim to generate a client from an attacker-controlled spec (user interaction), and no public exploit code has been identified at time of analysis. The vendor/VulnCheck CVSS 4.0 base score is 9.3, though the independent assessment notes a CVSS 3.1 vector of AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H reflecting the required user interaction; it is not listed in CISA KEV.
RemediationAI
No vendor-released patch has been identified at time of analysis. To mitigate, avoid generating TypeScript clients from untrusted OpenAPI documents; if this is not possible, sanitize all string inputs before generation by escaping single quotes in path keys, parameter names, servers[0].url, and info.version, or fork the library and modify the Handlebars templates to use proper escaping (e.g., a helper function or triple-brace expressions). As a compensating control, run code generation in an isolated, sandboxed environment without access to secrets or production systems, and treat generated code as untrusted-review it before import. Monitor the GitHub repository and issue #2809 for an official fix; the VulnCheck advisory (https://www.vulncheck.com/advisories/openapi-typescript-codegen-through-0.31.0-code-injection-via-handlebars-templates) may be updated. Trade-offs: input sanitization may be complex and error-prone, forking incurs maintenance overhead, and sandboxing can hinder development workflows.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
openapi-typescript-codegen is a Node.js library that generates TypeScript client code from OpenAPI specifications using Handlebars templates. The vulnerability arises because several template files, including exportService.hbs (lines 89-110) and OpenAPI.hbs (lines 20-23), interpolate attacker-controllable values directly into single-quoted string literals without proper escaping. This is a CWE-94 code injection flaw: a malicious OpenAPI document can include a single quote in path keys, parameter names, servers[0].url, or info.version, breaking out of the string context and allowing arbitrary JavaScript to be embedded in the generated client. The injected code executes when the generated client is imported or when service methods are called, giving attackers code execution in the context of the developer or build system that uses the generated code. The attack is build-time/supply-chain oriented and requires the victim to generate a client from an attacker-controlled spec; no runtime network service is exposed by the vulnerability itself. The CPE cpe:2.3:a:ferdikoomen:openapi-typescript-codegen:*:*:*:*:*:*:*:* identifies the affected package.
Know when Openapi Typescript Codegen gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Attacker needs no privileges and the spec can be delivered over the network (AV:N), but a developer/pipeline must run the generator and import the output, so UI:R; successful injection yields full code execution (C/I/A:H).
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
openapi-typescript-codegen through 0.31.0 contains a code injection vulnerability that allows attackers controlling an OpenAPI document to inject JavaScript by supplying unescaped values interpolated into single-quoted string literals. Attackers can embed a single quote in path keys, parameter names, servers[0].url, or info.version to execute arbitrary JavaScript when generated clients are imported or service methods called.
Executive ViewAI
A critical code-injection flaw in openapi-typescript-codegen (all versions through 0.31.0) allows an attacker-controlled OpenAPI specification to plant arbitrary JavaScript inside the TypeScript client code the tool generates, which then executes on developer workstations or build infrastructure whenever that client is imported or its service methods are called. Because no vendor patch is currently available, any team that generates API clients from specifications it did not author - including partner, vendor, or community-sourced specs - carries unmitigated exposure. Leadership should care because the blast radius is not limited to one library: a compromised developer endpoint or CI runner can be leveraged to reach source repositories, credentials, and downstream production services.
No vendor-released patch identified at time of analysis; no public exploit identified at time of analysis. The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H) indicates the issue is unauthenticated but requires the victim to generate a client from the malicious specification, so the strongest interim mitigations are process and isolation controls: treat all externally sourced OpenAPI documents as hostile and generate only from first-party, reviewed, hash-pinned specs; review and diff every generated client before it is imported or executed; perform generation in a sandboxed, network-restricted CI environment without production credentials or write access to source control; scan existing generated clients for injected or obfuscated JavaScript; limit and rotate credentials available to build agents; and migrate to a maintained fork or alternative generator until a vendor fix is released.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
EUVD-2026-96346
GHSA-3pr5-x7xf-mg4g
NVD
CVE.org
EPSS
Exploit-DB