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

Published Oct 29, 2026
·
Updated

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.

Event History

Oct 29, 2026
CVE Published
via MITRE·11:36 AM
Data Sourced
via MITRE·11:36 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·12:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who is exposed to this issue?

Projects using oapi-codegen versions 2.0.0 through before 2.8.1 are exposed if they generate code from an OpenAPI document controlled by an attacker. The risk materializes when the generated Go package is built and imported.

2

What must an attacker control to exploit it?

The attacker must be able to supply or modify an OpenAPI document processed by oapi-codegen. They can use a non-literal enum entry in an integer, number, or boolean schema to terminate the generated const block and inject a Go init function.

3

How can I determine whether a project may be affected?

Check whether the project uses an oapi-codegen release from 2.0.0 to before 2.8.1 and whether its OpenAPI inputs can be attacker-controlled. Inspect integer, number, and boolean enum values in those inputs for non-literal entries, especially if generated code was subsequently built and imported.

4

What is the available remediation?

Upgrade oapi-codegen to version 2.8.1 or later. Until then, do not generate code from untrusted OpenAPI documents and validate that enum entries for integer, number, and boolean schemas are literal values before generation.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203