-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.16.4 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/sym01/Library/Caches/go-build" GOENV="/Users/sym01/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/sym01/Workspace/Go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/sym01/Workspace/Go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.16.4" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cr/jbhvnrzx39s46k8btfr1s2_r0000gp/T/go-build52418455=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
https://play.golang.org/p/JLYLXf40j8y
What did you expect to see?
net/http
has a secure-by-default implement for multipart/form-data
that doesn't allow multi boundaries.
Lines 188 to 191 in 507cc34
if _, exists := pmap[key]; exists { | |
// Duplicate parameter name is bogus. | |
return "", nil, errors.New("mime: duplicate parameter name") | |
} |
E.g., It will stop parsing the form with header
Content-Type: multipart/form-data;boundary="boundary";boundary="another-boundary"
.
What did you see instead?
Due to the support of RFC 2231, we can bypass this security check with header Content-Type: multipart/form-data;boundary="boundary";boundary*0="another";boundary*1="-boundary"
This incorrect implementation could be used for bypassing some security mechanisms, such as Web Application Firewall.
andrius4669
Metadata
Metadata
Assignees
Labels
NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.