CVE-2026-119027
oapi-codegen 2.5.0 before 2.8.1 Code Injection via servers[].x-go-name Extension
- State
- Published
- Severity
- 7.7 High
- Published
- Oct 29, 2026
- Updated
- Oct 29, 2026
- Reserved
- Oct 29, 2026
Description
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.
Scores
| CVSS | Score | Vector | Source |
|---|---|---|---|
| 4.0 | 7.7 High | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N | VulnCheck |
| 3.1 | 7.5 High | CVSS:3.1/AV:N/AC:H/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/server-urls.tmpl#L5-L7technical-description
- https://github.com/oapi-codegen/oapi-codegen/blob/v2.5.0/pkg/codegen/templates/server-urls.tmpl#L4-L5technical-description
- oapi-codegen v2.8.1 Release Notesrelease-notes
- GitHub Security Advisory (GHSA-rjwr-m7qx-3fjr)relatedvendor-advisory
- VulnCheck Advisory: oapi-codegen 2.5.0 before 2.8.1 Code Injection via servers[].x-go-name Extensionthird-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.