CVE-2023-29401 — Vulnerability in github.com/gin-gonic/gin
Gin Web Framework does not properly sanitize filename parameter of Context.FileAttachment function
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.53%). Schedule for your next planned update.
Does your project use an affected github.com/gin-gonic/gin version?
Paste your go.sum to check it for CVE-2023-29401 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
The filename parameter of the Context.FileAttachment function is not properly sanitized. A maliciously crafted filename can cause the Content-Disposition header to be sent with an unexpected filename value or otherwise modify the Content-Disposition header. For example, a filename of "setup.bat";x=.txt" will be sent as a file named "setup.bat".
If the FileAttachment function is called with names provided by an untrusted source, this may permit an attacker to cause a file to be served with a name different than provided. Maliciously crafted attachment file name can modify the Content-Disposition header.
Advisory Timeline
- First published May 12, 2023 (1294 days ago).
- Last revised November 8, 2023 — 179 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
go get github.com/gin-gonic/gin@v1.9.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| github.com/gin-gonic/gin Go · Affected: All versions | 1.9.1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-494
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 4.3 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
References
Frequently Asked Questions
- What is CVE-2023-29401?
- Gin Web Framework does not properly sanitize filename parameter of Context.FileAttachment function. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 4.3/10).
- How do I check if my project is affected by CVE-2023-29401?
- CVE-2023-29401 affects github.com/gin-gonic/gin. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2023-29401 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 38.1% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2019-25211CRITICAL
Gin mishandles a wildcard at the end of an origin string
- CVE-2020-28483HIGH
Inconsistent Interpretation of HTTP Requests in github.com/gin-gonic/gin
- CVE-2023-26125MEDIUM
Improper input validation in github.com/gin-gonic/gin
- CVE-2026-54765MEDIUM
Traefik: Gateway HTTPRoute backendRef filters can leak backend context across routes sharing a Service:port
- CVE-2026-88011MEDIUM
Traefik: ForwardAuth identity spoofing via dot-form header alias
- CVE-2020-28483
Inconsistent interpretation of HTTP Requests in github.com/gin-gonic/gin