Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessControl or tamper an OpenAPI document
-
DeliveryEmbed malicious Go in servers[].x-go-name
-
ExploitVictim runs oapi-codegen with server-urls enabled
-
ExecutionInjected func init() compiled into generated package
-
ImpactArbitrary Go code executes at build/import
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the oapi-codegen |
| Impact | The signals point to a real-but-conditional supply-chain/build-time risk rather than an urgent remote-service RCE. The CVSS 4.0 base score is 7.7 (High), but two metrics materially temper it: AT:P (a specific attack requirement - the non-default |
| Exploit ScenarioDerived | An attacker who supplies or tampers with an OpenAPI document embeds a crafted |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 29, 2026
The oapi-codegen Go code generator (versions 2.5.0 up to but not including 2.8.1) emits the untrusted OpenAPI field servers[].x-go-name unescaped into generated Go source, letting whoever controls the consumed spec splice arbitrary code - for example a top-level func init() - into the generated package, which executes when a downstream project imports or builds it. Exploitation is conditional: it requires the non-default generate: server-urls: true option and a victim pipeline that generates, builds, and imports the output without catching the injected lines in review (CVSS:4.0 7.7 from the CVE record; independently assessed CVSS:3.1 7.8, AV:N/AC:H/PR:N/UI:R, High confidentiality, integrity and availability impact within the generated package). The priority signal is this_week rather than act_now, and the picture is a real but conditional supply-chain/build-time risk rather than an urgent remote-service RCE; no CISA KEV entry or confirmed working public exploit code is identified, though the upstream advisory does document reproduction payloads demonstrating the injection.
RemediationAI
Vendor-released patch: upgrade to oapi-codegen v2.8.1 (https://github.com/oapi-codegen/oapi-codegen/releases/tag/v2.8.1), which implements the fix from PR https://github.com/oapi-codegen/oapi-codegen/pull/2626 (commit 068f1bcd16e4724c72d78d6774008a877b8297b1) and also hardens echo operationId middleware keys, non-string enum constants, security scopes and webhook content types - so bumping the pinned generator version closes the sibling injection paths at the same time. Update the go.mod dependency, the go generate directive and any CI-pinned tool version together, then regenerate and review the resulting diff. Where upgrading is blocked, remove generate: server-urls: true from the configuration so the vulnerable template is not emitted (side effect: generated ServerURLs constants and helpers disappear and code referencing them must be adjusted), and treat any OpenAPI document sourced from outside the repository as privileged input - diff generated packages in code review before they are built or imported, since the payload executes at import time and a build in CI is sufficient to trigger it. Any package already generated with 2.5.0-2.8.0 from an untrusted spec should be regenerated with 2.8.1, and the specification itself inspected for injected x-go-name, operationId, enum, security-scope or content-type values.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
oapi-codegen renders OpenAPI/Swagger documents into Go through Go's text/template package, which performs no contextual escaping of its own - quoting is entirely the template author's responsibility. This is CWE-94 (improper control of generation of code): the server-urls template writes the .GoName value derived from servers[].x-go-name directly into the generated source, and the project's ValidateSpec routine never walks spec.Servers, so the crafted identifier passes validation and reaches the template unchanged. Because gofmt and goimports accept the splice as valid Go (payloads carry no newlines), the injected top-level func init() compiles and runs at package import time. This is the same defect class as GHSA-rjwr-m7qx-3fjr (server description, fixed in 2.7.1); that fix did not cover this field. The maintainer patch in PR 2626 generalises the hardening: it adds a ValidateServerURLs walk over spec.Servers, restricts unquoted non-string enum constants to number or boolean literals via strconv.ParseFloat, and applies strconv.Quote to the echo operationId-derived middleware key, webhook initiator content types, and individual security scopes rather than joining raw values. Note that the advisory text correspondingly shows an accompanying report covering echo-register operationId keys and enum constant rendering, indicating sibling injection paths in adjacent templates that the same release hardens.
Know when Oapi Codegen gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
Attacker only controls the spec so PR:N; AC:H and UI:R reflect the non-default server-urls option plus the victim building/importing; code runs in the generated package, so S:U with full C/I/A impact.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
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.
Technical POC Analysis
CWE-94 (Improper Control of Generation of Code).
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
CVE-2026-119027 is a high-severity vulnerability in the oapi-codegen Go code generator (versions 2.5.0 to 2.8.0) that allows code injection into generated Go source when a non-default option is enabled. This affects development teams using code generation, potentially enabling supply-chain attacks. Leadership should prioritize remediation due to the risk of malicious code injection into software builds.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
EUVD-2026-112755
GHSA-prxp-239m-mh9f
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB