Skip to main content

oapi-codegen EUVDEUVD-2026-112755

| CVE-2026-119027 HIGH
Code Injection (CWE-94)
2026-10-29 VulnCheck GHSA-prxp-239m-mh9f
7.7
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Control or tamper an OpenAPI document
  2. Delivery
    Embed malicious Go in servers[].x-go-name
  3. Exploit
    Victim runs oapi-codegen with server-urls enabled
  4. Execution
    Injected func init() compiled into generated package
  5. Impact
    Arbitrary 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 generate: server-urls: true option is enabled (the vulnerable server-urls template is not emitted by default) AND that the attacker controls or can tamper with the OpenAPI document consumed by the victim. The concrete trigger is a crafted servers[].x-go-name value: ValidateSpec does not walk spec.Servers, so the value reaches text/template unescaped and is emitted as a top-level func init() that runs at package import/build time. Limiting factors: the victim must generate, build, and import/execute the generated package without catching the injected code in code review (UI:P); the payload must be valid Go that survives gofmt/goimports; and only oapi-codegen 2.5.0 before 2.8.1 with server-urls generation is affected. These conditions confine exploitation to build/CI pipelines that ingest untrusted specs.

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 generate: server-urls: true option must be enabled and the victim must build the generated package) and UI:P (the victim must perform the build/import action). PR:N is justified because the attacker only needs control of the OpenAPI document, not any authentication to the victim. No EPSS score was provided and the CVE is not in CISA KEV, so there is no evidence of widespread or active exploitation; the vuln.today decision label is 'this_week', consistent with a meaningful but non-emergency priority. A public reproduction (vendor GHSA advisory, execution-confirmed by the reporter) raises practical exploitability above a purely theoretical finding. Net: this is a legitimate code-injection flaw worth patching on a near-term cadence, but its real-world likelihood is gated by the opt-in server-urls generation, attacker control of the spec, and the victim building generated code without reviewing the diff - not a drop-everything internet-facing RCE.

Exploit ScenarioDerived

An attacker who supplies or tampers with an OpenAPI document embeds a crafted servers[].x-go-name value containing Go source; because the server-urls template emits it unescaped, the generated package includes an attacker-defined func init(). When the victim runs oapi-codegen with server-urls generation enabled and then builds and imports the package, the injected init function executes arbitrary Go code in the victim's build/CI environment. A vendor advisory (GHSA-g2vv-83pm-v2hc) documents execution-confirmed reproduction of this class, so a public PoC reference exists, though it is not a packaged, verified working exploit.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

oapi-codegen 2.5.0 <2.8.1

Affected Packages

euvd oapi_codegen fix: 2.8.1

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

Vendor (VulnCheck) PRIMARY 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
vuln.today AI 7.5 HIGH

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.

3.1 AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat 7.8 HIGH

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

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

Why It Matters

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.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 66% exploitable
Prevalence
Medium
popular Go OpenAPI code generator, build-time developer tool not runtime-deployed
Data Quality
5 sources
Confidence: Medium
EUVD NVD CVE.org EPSS Vulnrichment Vendor GitHub

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

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.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy