CVE-2026-119028
oapi-codegen 2.0.0 before 2.8.1 Code Injection via Non-String Enum Values
- State
- Published
- Severity
- 8.7 High
- Published
- Oct 29, 2026
- Updated
- Oct 29, 2026
- Reserved
- Oct 29, 2026
Description
oapi-codegen 2.0.0 before 2.8.1 contains a code injection vulnerability that allows attackers to inject Go code by supplying non-literal enum entries in integer, number, or boolean schemas. Attackers controlling an OpenAPI document can craft an enum entry that closes the const block in constants.tmpl and injects a func init(), executing code when the generated package is built and imported.
Scores
| CVSS | Score | Vector | Source |
|---|---|---|---|
| 4.0 | 8.7 High | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N | VulnCheck |
| 3.1 | 8.8 High | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | VulnCheck |
Weaknesses
- CWE-94 Improper Control of Generation of Code ('Code Injection')
Affected Products
| Product | Versions |
|---|---|
oapi-codegenoapi-codegen |
|
References
- GitHub Security Advisory (GHSA-g2vv-83pm-v2hc)vendor-advisory
- Pull Request #2626patchissue-tracking
- Patch Commitpatch
- https://github.com/oapi-codegen/oapi-codegen/blob/v2.8.0/pkg/codegen/templates/constants.tmpl#L16technical-description
- https://github.com/oapi-codegen/oapi-codegen/blob/v2.0.0/pkg/codegen/templates/constants.tmpl#L12technical-description
- oapi-codegen v2.8.1 Release Notesrelease-notes
- GitHub Security Advisory (GHSA-xrqw-w576-xgj2)relatedvendor-advisory
- VulnCheck Advisory: oapi-codegen 2.0.0 before 2.8.1 Code Injection via Non-String Enum Valuesthird-party-advisory
Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.