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

Source: https://aplosec.si/cve/CVE-2026-119027/

[AploSec](https://aplosec.si/) / [Disclosures](https://aplosec.si/disclosures/) / CVE-2026-119027

High 7.7 · Reported · Fixed in 2.8.1 · CWE-94 · Go

# oapi-codegen 2.5.0 before 2.8.1 Code Injection via servers[].x-go-name Extension

CVE-2026-119027 · published 2026-10-29

In plain words: this type of bug lets someone run their own code inside the application (code injection). A fixed release is listed.

## Summary

CVE-2026-119027 affects oapi-codegen (Go) >= 2.5.0, < 2.8.1: Code injection via servers[].x-go-name extension (CWE-94). Fixed in 2.8.1. CVSS 4.0 base score 7.7 (High), assigned by VulnCheck. Published 2026-10-29 by VulnCheck. Credit: Zachariah Mithani.

oapi-codegen 2.5.0 before 2.8.1 contains a code injection vulnerability: a crafted servers[].x-go-name value is emitted unescaped by the server-urls template, so an attacker who controls an OpenAPI document can define an injected func init() that executes when the victim builds and imports the generated package.

## Evidence

Reported to the maintainer. The public advisory and references below describe the evidence and preconditions; reporting status alone does not establish independent reproduction.

## Remediation

Upgrade oapi-codegen to 2.8.1 or later. Releases in the affected range (>= 2.5.0, < 2.8.1) are vulnerable. See the linked advisory for details on affected release lines.

## Timeline

- 2026-10-29 CVE published

- 2026-10-31 Public record last updated

## References

- [VulnCheck advisoryhttps://www.vulncheck.com/advisories/oapi-codegen-2.5.0-before-2.8.1-code-injection-via-servers-x-go-name-extension](https://www.vulncheck.com/advisories/oapi-codegen-2.5.0-before-2.8.1-code-injection-via-servers-x-go-name-extension)

- [Referencehttps://github.com/oapi-codegen/oapi-codegen/security/advisories/GHSA-g2vv-83pm-v2hc](https://github.com/oapi-codegen/oapi-codegen/security/advisories/GHSA-g2vv-83pm-v2hc)

- [Releasehttps://github.com/oapi-codegen/oapi-codegen/releases/tag/v2.8.1](https://github.com/oapi-codegen/oapi-codegen/releases/tag/v2.8.1)

- [Fix pull requesthttps://github.com/oapi-codegen/oapi-codegen/pull/2626](https://github.com/oapi-codegen/oapi-codegen/pull/2626)

- [Vulnerable codehttps://github.com/oapi-codegen/oapi-codegen/blob/v2.5.0/pkg/codegen/templates/server-urls.tmpl#L4-L5](https://github.com/oapi-codegen/oapi-codegen/blob/v2.5.0/pkg/codegen/templates/server-urls.tmpl#L4-L5)

- [CVE recordhttps://www.cve.org/CVERecord?id=CVE-2026-119027](https://www.cve.org/CVERecord?id=CVE-2026-119027)

- [NVD recordhttps://nvd.nist.gov/vuln/detail/CVE-2026-119027](https://nvd.nist.gov/vuln/detail/CVE-2026-119027)

- [Fix commithttps://github.com/oapi-codegen/oapi-codegen/commit/068f1bcd16e4724c72d78d6774008a877b8297b1](https://github.com/oapi-codegen/oapi-codegen/commit/068f1bcd16e4724c72d78d6774008a877b8297b1)

**Severity:** High 7.7 CVSS 4.0, scored by VulnCheck in the [CVE record](https://www.cve.org/CVERecord?id=CVE-2026-119027)

**Package:** oapi-codegen

**Ecosystem:** Go

**Affected:** >= 2.5.0, < 2.8.1

**Fixed:** 2.8.1

**Weakness:** CWE-94

**CNA:** VulnCheck

**Credit:** Zachariah Mithani finder
