# CVE-2023-26125: Improper input validation in github.com/gin-gonic/gin

> An attacker can poison caches via the X-Forwarded-Prefix header in the Gin web framework, potentially aiding other attacks.

- **Severity:** Medium 5.6 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 4 May 2023
- **Updated:** 29 Jan 2025
- **Also known as:** CLEANSTART-2026-DB86759, DEBIAN-CVE-2023-26125, GHSA-3vp4-m3rf-835h, MINI-jxjc-j22c-jfj3, UBUNTU-CVE-2023-26125

## What is CVE-2023-26125?

CVE-2023-26125 is a medium-severity vulnerability in github.com/gin-gonic/gin, published on 4 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Versions of the package github.com/gin-gonic/gin before 1.9.0 are vulnerable to Improper Input Validation by allowing an attacker to use a specially crafted request via the X-Forwarded-Prefix header, potentially leading to cache poisoning.**Note:** Although this issue does not pose a significant threat on its own it can serve as an input vector for other more impactful vulnerabilities. However, successful exploitation may depend on the server configuration and whether the header is used in the application logic.

Weakness: CWE-77 (Improper Neutralization of Special Elements used in a Command), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2023-26125?

2 open source packages ship an affected version, including github.com/gin-gonic/gin. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/gin-gonic/gin` | Go | All versions | 1.9.0 |
| `github.com/gin-gonic/gin` | Go | All versions | 1.9.0 |

Products: Gin-Gonic Gin.

## How do I fix CVE-2023-26125?

Upgrade github.com/gin-gonic/gin to 1.9.0 or later.

## Is CVE-2023-26125 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-26125 exists.

## Other vulnerabilities in github.com/gin-gonic/gin

- [CVE-2020-36567](https://insights.sbomify.com/CVE-2020-36567/): Arbitrary log line injection in github.com/gin-gonic/gin (high 7.5)
- [CVE-2020-28483](https://insights.sbomify.com/CVE-2020-28483/): HTTP Response Splitting (high 7.1)
- [CVE-2023-29401](https://insights.sbomify.com/CVE-2023-29401/): Improper handling of filenames in Content-Disposition HTTP header in github.com/gin-gonic/gin (medium 4.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-26125 and fix it if it is affected.

What it is: CVE-2023-26125 is a medium-severity vulnerability in github.com/gin-gonic/gin, published on 4 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-26125 exists.

Affected packages and fixed versions:
- github.com/gin-gonic/gin (Go): affected all versions; fixed in 1.9.0
- github.com/gin-gonic/gin (Go): affected all versions; fixed in 1.9.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-26125/ (Markdown: https://insights.sbomify.com/CVE-2023-26125/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-26125
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-26125
- OSV: https://osv.dev/vulnerability/CVE-2023-26125

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-26125/
Summaries are generated and may contain mistakes; the official description above is the record.
