Skip to content

Commit

Permalink
[Bugfix] gin web framework does not properly sanitize filename parame…
Browse files Browse the repository at this point in the history
…ter of `Context.FileAttachment` function

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.
  • Loading branch information
sufatmawati authored May 13, 2024
1 parent 4b23fe9 commit adfa292
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions module/apmgin/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module go.elastic.co/apm/module/apmgin/v2

require (
github.com/gin-gonic/gin v1.8.2
github.com/gin-gonic/gin v1.9.1
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
go.elastic.co/apm/module/apmhttp/v2 v2.6.0
Expand All @@ -10,6 +10,8 @@ require (

require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/elastic/go-sysinfo v1.7.1 // indirect
github.com/elastic/go-windows v1.0.0 // indirect
Expand All @@ -22,21 +24,23 @@ require (
github.com/google/go-cmp v0.5.5 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.elastic.co/fastjson v1.1.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
)
Expand Down

0 comments on commit adfa292

Please sign in to comment.