Gin Web Framework does not properly sanitize filename parameter of Context.FileAttachment function
Published 12 May 2023 · Updated 8 Nov 2023
Is your project on an affected github.com/gin-gonic/gin?
Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- >=1.3.1-0.20190301021747-ccb9e902956d <1.9.1
- Fixed in
- 1.9.1
go get github.com/gin-gonic/gin@v1.9.1Details
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.
Is GHSA-2c4m-59x9-fr2g in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected github.com/gin-gonic/gin, and gives you the command that fixes it.
More advisories for github.com/gin-gonic/gin
- CriticalCVE-2019-25211Gin mishandles a wildcard at the end of an origin string · 29 Jun 2024
- MediumCVE-2023-26125Improper input validation in github.com/gin-gonic/gin · 4 May 2023
- HighCVE-2020-36567Gin's default logger allows unsanitized input that can allow remote attackers to inject arbitrary log lines · 27 Dec 2022
- HighCVE-2020-28483Inconsistent Interpretation of HTTP Requests in github.com/gin-gonic/gin · 23 Jun 2021
- LowCVE-2020-36567Arbitrary log line injection in github.com/gin-gonic/gin · 14 Apr 2021
- LowCVE-2020-28483Inconsistent interpretation of HTTP Requests in github.com/gin-gonic/gin · 14 Apr 2021
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.