You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A directory listing provides an attacker with the complete index of all the resources located inside of the directory. The specific risks and consequences vary depending on which files are listed and accessible.
Summary of the Bug
A directory listing provides an attacker with the complete index of all the resources located inside of the directory. The specific risks and consequences vary depending on which files are listed and accessible.
Steps to Reproduce
Steps to reproduce the behavior:
https://github.com/shentufoundation/shentu/blob/master/app/app.go#L654-L654 -- Problematic code : staticServer := http.FileServer(statikFS)
https://github.com/shentufoundation/shentu/blob/master/simapp/simapp.go#L726-L726 -- Problematic code staticServer := http.FileServer(statikFS)
DESCRIPTION:
A directory listing is inappropriately exposed using net/http.FileServer, yielding potentially sensitive information to attackers.
BAD PRACTICE
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("/")))
_ = http.ListenAndServe(":3000", nil)
}
Ref:
https://docs.gitlab.com/ee/user/application_security/dast/checks/548.1.html
https://cwe.mitre.org/data/definitions/548.html
Possible fix: https://stackoverflow.com/questions/49589685/good-way-to-disable-directory-listing-with-http-fileserver-in-go
The text was updated successfully, but these errors were encountered: