IT SBIT Services
Schneeberger
DEEN
CVE tracker

oapi-codegen: Code injection via crafted servers[].x-go-name value

CVE-2026-119027High 7.7

← All vulnerabilities

Summary

oapi-codegen, a Go tool that generates Go code from OpenAPI specifications, does not escape the servers[].x-go-name value in its server-urls template. An attacker who controls an OpenAPI document can inject Go code, including a func init() that runs when a victim builds or imports the generated package. The attack requires that a developer or CI/CD pipeline generates code from the malicious document.

Affected

  • oapi-codegen 2.5.0 up to, but not including, 2.8.1

Fixed in

  • Fixed in oapi-codegen 2.8.1 and later

Workaround

Unknown.

  • No official workaround is published. Upgrading to 2.8.1 or later is required.

Exploitation

  • No known exploitation according to OffSeq.
  • Not listed in CISA's Known Exploited Vulnerabilities catalogue.
  • EPSS: 0.39 % (percentile 34).
  • CISA SSVC: exploitation none, automatable no.
  • No public proof of concept found.

Our recommendation

  • Check go.mod, tools.go and CI configuration for oapi-codegen and confirm version 2.8.1 or later. Check vendored or distribution packages too.
  • Until upgraded, do not generate code from OpenAPI documents you do not control.
  • Review changes to generated code in code review.
  • Priority: medium if you build Go services from externally supplied API specifications, otherwise low.

Public exploits

PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.

Research sources

Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 2 Nov 2026, 07:42.

Original description (NVD)

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.

NVD references (8)

Sources

The tracker combines official, freely usable data sources – updated continuously:

This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.

Affected? We can help.

We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.