CVE-2023-29401 Improper handling of filenames in Content-Disposition HTTP header in github.com/gin-gonic/gin

Medium 4.3 Published Updated

Attackers can manipulate Content-Disposition headers via unsanitized filenames, potentially tricking users into executing malicious files.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2023-29401?

CVE-2023-29401 is a medium-severity vulnerability in github.com/gin-gonic/gin, published on 8 Jun 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

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.

Weakness: CWE-494

Which versions are affected by CVE-2023-29401?

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

PackageAffectedFixed in
github.com/gin-gonic/gin GoFrom 1.3.1-0.20190301021747-ccb9e902956d1.9.1
github.com/gin-gonic/gin GoFrom 1.3.1-0.20190301021747-ccb9e902956d1.9.1
github.com/gin-gonic/gin GoFrom 1.3.1-0.20190301021747-ccb9e902956d1.9.1

Products include Gin-Gonic Gin.

How do I fix CVE-2023-29401?

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

Is CVE-2023-29401 being exploited?

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

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as CLEANSTART-2026-UO59647, DEBIAN-CVE-2023-29401, GHSA-2c4m-59x9-fr2g, GO-2023-1737, MINI-c496-28jp-3pcm, UBUNTU-CVE-2023-29401.

Is CVE-2023-29401 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free