-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Hello, I found another bug security on windows.
example - curl http://localhost:8081/api/\../\../\../\../\../\../\../\../windows/win.ini -k
SOLUTION
file strings.go
var (
...
strBackSlashDotDotSlash = []byte(`\../`)
...
)file uri.go
func normalizePath(dst, src []byte) []byte {
...
if filepath.Separator == '\\' {
...
// remove /foo\../ parts
for {
n := bytes.Index(b, strBackSlashDotDotSlash)
if n < 0 {
break
}
nn := bytes.LastIndexByte(b[:n], '/')
if nn < 0 {
nn = 0
}
n += len(strBackSlashDotDotSlash) - 1
copy(b[nn:], b[n:])
b = b[:len(b)-n+nn]
}
...
}Metadata
Metadata
Assignees
Labels
No labels