All vulnerabilities

Go

CVE-2026-119028

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

Severity
High 8.7
Published
29 Oct 2026
Last changed
29 Oct 2026
Added to UpHeron
23 Nov 2026
Fixed in
2.8.1
Exploit chance
0.4% in the next 30 daysHigher than 36% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Code injection (CWE-94)
Attack
Over the network · No login needed · Needs someone to view a page or file
Attacker can
Read data · Change data · Take it down
CVSS vector
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
Sources
CVE Program

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.

From the CVE Program.

Affected software

SoftwareAffected versions
github.com/oapi-codegen/oapi-codegen/v2Go · osv:Go:github.com/oapi-codegen/oapi-codegen/v2
  • From 2.0.0 before 2.8.1

About github.com/oapi-codegen/oapi-codegen/v2

Vulnerabilities in github.com/oapi-codegen/oapi-codegen/v2

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
2
Known exploited
0
Search the list for github.com/oapi-codegen/oapi-codegen/v2

References

  • CVE.org https://www.cve.org/CVERecord?id=CVE-2026-119028