# CVE-2026-119028: oapi-codegen 2.0.0 before 2.8.1 Code Injection via Non-String Enum Values

Source: https://aplosec.si/cve/CVE-2026-119028/

[AploSec](https://aplosec.si/) / [Disclosures](https://aplosec.si/disclosures/) / CVE-2026-119028

High 8.7 · Reported · Fixed in 2.8.1 · CWE-94 · Go

# oapi-codegen 2.0.0 before 2.8.1 Code Injection via Non-String Enum Values

CVE-2026-119028 · published 2026-10-29

In plain words: this type of bug lets someone run their own code inside the application (code injection). A fixed release is listed.

## Summary

CVE-2026-119028 affects oapi-codegen (Go) >= 2.0.0, < 2.8.1: Code injection via non-string enum values (CWE-94). Fixed in 2.8.1. CVSS 4.0 base score 8.7 (High), assigned by VulnCheck. Published 2026-10-29 by VulnCheck. Credit: Zachariah Mithani.

oapi-codegen 2.0.0 before 2.8.1 contains a code injection vulnerability: a non-literal enum entry in an integer, number or boolean schema closes the const block in constants.tmpl and injects a func init(), so an attacker who controls an OpenAPI document executes code when the generated package is built and imported.

## Evidence

Reported to the maintainer. The public advisory and references below describe the evidence and preconditions; reporting status alone does not establish independent reproduction.

## Remediation

Upgrade oapi-codegen to 2.8.1 or later. Releases in the affected range (>= 2.0.0, < 2.8.1) are vulnerable. See the linked advisory for details on affected release lines.

## Timeline

- 2026-10-29 CVE published

- 2026-10-31 Public record last updated

## References

- [VulnCheck advisoryhttps://www.vulncheck.com/advisories/oapi-codegen-2.0.0-before-2.8.1-code-injection-via-non-string-enum-values](https://www.vulncheck.com/advisories/oapi-codegen-2.0.0-before-2.8.1-code-injection-via-non-string-enum-values)

- [Referencehttps://github.com/oapi-codegen/oapi-codegen/security/advisories/GHSA-g2vv-83pm-v2hc](https://github.com/oapi-codegen/oapi-codegen/security/advisories/GHSA-g2vv-83pm-v2hc)

- [Releasehttps://github.com/oapi-codegen/oapi-codegen/releases/tag/v2.8.1](https://github.com/oapi-codegen/oapi-codegen/releases/tag/v2.8.1)

- [Fix pull requesthttps://github.com/oapi-codegen/oapi-codegen/pull/2626](https://github.com/oapi-codegen/oapi-codegen/pull/2626)

- [Vulnerable codehttps://github.com/oapi-codegen/oapi-codegen/blob/v2.0.0/pkg/codegen/templates/constants.tmpl#L12](https://github.com/oapi-codegen/oapi-codegen/blob/v2.0.0/pkg/codegen/templates/constants.tmpl#L12)

- [CVE recordhttps://www.cve.org/CVERecord?id=CVE-2026-119028](https://www.cve.org/CVERecord?id=CVE-2026-119028)

- [NVD recordhttps://nvd.nist.gov/vuln/detail/CVE-2026-119028](https://nvd.nist.gov/vuln/detail/CVE-2026-119028)

- [Fix commithttps://github.com/oapi-codegen/oapi-codegen/commit/068f1bcd16e4724c72d78d6774008a877b8297b1](https://github.com/oapi-codegen/oapi-codegen/commit/068f1bcd16e4724c72d78d6774008a877b8297b1)

**Severity:** High 8.7 CVSS 4.0, scored by VulnCheck in the [CVE record](https://www.cve.org/CVERecord?id=CVE-2026-119028)

**Package:** oapi-codegen

**Ecosystem:** Go

**Affected:** >= 2.0.0, < 2.8.1

**Fixed:** 2.8.1

**Weakness:** CWE-94

**CNA:** VulnCheck

**Credit:** Zachariah Mithani finder
