Technical impact
The vulnerability arises because oapi-codegen’s server‑urls template emits the servers[].x-go-name extension without escaping it. An attacker who can supply or tamper with an OpenAPI document can embed arbitrary Go code, such as a func init, that is compiled and executed when the victim builds and imports the generated package. This results in the ability to run attacker‑supplied code with the privileges of the build environment, potentially compromising confidentiality, integrity, or availability of built applications.
Affected Systems
The affected product is the Go OpenAPI generator, oapi-codegen, for all releases from 2.5.0 up to but excluding 2.8.1. Developers using these versions to generate client or server code from any OpenAPI specification that may contain a servers[].x-go-name field are at risk.
Risk and Exploitability
With a CVSS score of 7.7 the vulnerability is classified as high severity. The EPSS score is not available and the issue is not recorded in the CISA KEV list. The likely attack vector involves an attacker providing or manipulating the OpenAPI specification that the build pipeline consumes. Once the victim’s build system runs oapi-codegen against the malicious spec, the injected Go code is compiled and executed, giving the attacker arbitrary code execution on the build host.