CVE-2026-119027: oapi-codegen 2.5.0 before 2.8.1 Code Injection via servers[].x-go-name Extension

Published Oct 29, 2026
·
Updated

oapi-codegen 2.5.0 before 2.8.1 contains a code injection vulnerability that allows attackers to inject Go code by supplying a crafted servers[].x-go-name value emitted unescaped by the server-urls template. Attackers who control an OpenAPI document can define an injected func init() that executes when the victim builds and imports the generated package.

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?

Users of oapi-codegen versions 2.5.0 through before 2.8.1 are exposed if they generate code from an OpenAPI document controlled by an attacker and then build and import the generated package.

2

What does an attacker need to exploit it?

The attacker must be able to supply or modify an OpenAPI document used for generation. They can place crafted Go code in the servers[].x-go-name extension, which is emitted unescaped by the server-urls template.

3

What can be done if updating is not immediately possible?

Do not generate, build, or import packages generated from untrusted OpenAPI documents. Restrict control of OpenAPI inputs and review servers[].x-go-name values before generation.

4

How can I identify potentially affected generated code?

Check whether code was generated with an affected oapi-codegen version from an OpenAPI document that was not fully trusted. Inspect generated packages for unexpected injected Go code, including a func init() definition.

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