CVE-2026-119028: oapi-codegen code injection in enum constant generation

CVE-2026-119028 · Severity: high · CVSS 8.8 · Published 2026-10-29

oapi-codegen is a tool that generates Go code from OpenAPI documents. Attackers can craft malicious OpenAPI files with specially-crafted enum values to inject arbitrary Go code, which executes when the generated code is compiled and imported into a project. This allows remote code execution during the build process.

Technologies: Oapi-Codegen. Vendors: Oapi-Codegen.

Quick answers

Is CVE-2026-119028 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-119028 being exploited in the wild.
How severe is CVE-2026-119028?
High severity, with a CVSS score of 8.8, published 29 October 2026.
Which products and versions are affected?
Oapi-Codegen 2.0.0 before 2.8.1.
Is there a fix for CVE-2026-119028?
Yes: fixed in 2.8.1. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-119028 attacked?
It is attacked over the network.
Am I affected by CVE-2026-119028?
Check whether you run Oapi-Codegen at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Fixed in: 2.8.1

Technical details

The vulnerability is a template injection in constants.tmpl where unsanitized enum values from an OpenAPI document are directly embedded into generated Go const blocks. An attacker controlling an OpenAPI input can inject non-literal enum entries that close the const block and define a func init() to execute arbitrary code at import time. The fix in v2.8.1 applies proper string escaping (toGoString filter) to enum values.

Affected products

  • oapi-codegen oapi-codegen 2.0.0 before 2.8.1

Timeline

  • 2026-10-29: disclosed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.