CVE-2026-108551

openapi-typescript-codegen through 0.31.0 Code Injection via Handlebars Templates

Published Oct 10, 2026 CVSS 4.0 · 9.3 Critical EPSS < 1% KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

openapi‑typescript‑codegen up to version 0.31.0 contains a code injection flaw that allows a malicious actor to embed arbitrary JavaScript code in the OpenAPI specification. By inserting unescaped single quotes in path keys, parameter names, the first servers URL, or the info.version field, the templating engine will interpolate these values into single‑quoted string literals, causing the generated client to execute the injected script when the client is imported or service methods are invoked. This flaw can lead to remote code execution in any runtime that consumes the generated client, undermining confidentiality, integrity and availability for affected applications.

Affected Systems

The affected product is the openapi‑typescript‑codegen package maintained by ferdikoomen on GitHub. Versions through 0.31.0, including the 0.31.0 release, are vulnerable. Users who depend on any of these releases or older pinned versions are at risk unless they obtain a later patch or mitigate the input.

Risk and Exploitability

The CVSS score of 9.3 marks this vulnerability as critical. Although the EPSS score is not available, the lack of a known exploit does not diminish the potential for abuse, especially in environments that automatically generate clients from untrusted OpenAPI documents. The attack requires an attacker to supply a malicious OpenAPI file to the code generation process; if the target application imports the resulting client or invokes its service functions, the injected JavaScript will execute with the privileges of the consuming process. The vulnerability is not listed in the CISA KEV catalog, but its high severity warrants immediate attention.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to the latest openapi‑typescript‑codegen release that contains the fix (any version newer than 0.31.0).
  • If an upgrade is not immediately possible, sanitize the OpenAPI specification before feeding it to the code generator by removing or escaping single quotes in path keys, parameter names, servers[0].url, and info.version.
  • Ensure the OpenAPI specification originates from a trusted source, and implement validation or linting to reject malformed or suspicious fields before they reach the generator.

Generated by OpenCVE AI on October 10, 2026 at 15:20 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Ferdikoomen
Ferdikoomen openapi-typescript-codegen
Vendors & Products Ferdikoomen
Ferdikoomen openapi-typescript-codegen
Type Values Removed Values Added
Description 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.
Title openapi-typescript-codegen through 0.31.0 Code Injection via Handlebars Templates
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.3, 'vector': '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'}

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Oct 13, 2026, 6:27 PM
Reserved
Oct 10, 2026, 2:24 PM
Status
Deferred
Published
Oct 10, 2026, 3:16 PM
Modified
Oct 16, 2026, 7:21 PM