Oapi-codegen
oapi-codegen 2.0.0 before 2.8.1 Code Injection via Non-String Enum Values
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.
First public PoC
None yetno public PoC found
Public PoCs00 on GitHub
CVSS8.8high · scored by CNA · CWE-94
CISA KEV
Not listednot known exploited
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
oapi-codegen oapi-codegen
- >= 2.0.0, < 2.8.1
Fixed in 2.8.1
Mitigation
Upgrade oapi-codegen to 2.8.1 or later.
References
- Vendor advisory github.com/oapi-codegen/oapi-codegen/security/…
- Patch github.com/oapi-codegen/oapi-codegen/pull/2626
- Patch github.com/oapi-codegen/oapi-codegen/commit/06…
2 more
- Release notes github.com/oapi-codegen/oapi-codegen/releases/…
- Vendor advisory github.com/oapi-codegen/oapi-codegen/security/…
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.