Skip to main content

CVE-2023-29401 — Vulnerability in github.com/gin-gonic/gin

MEDIUM

Gin Web Framework does not properly sanitize filename parameter of Context.FileAttachment function

Published May 12, 2023Updated November 8, 2023Source: OSV

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.

Check my go.sum

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
Update github.com/gin-gonic/gin to 1.9.1 or later
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).

PackageFixed In
github.com/gin-gonic/gin Go · Affected: All versions1.9.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 4.3 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N

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

CVSS Score
4.3

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
0.53%
EPSS percentile: 38.1

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

GHSA-2c4m-59x9-fr2g
GO-2023-1737

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my go.sum