Error : Invalid memory address or nil pointer dereference
rtcms opened this issue · 7 comments
rtcms commented
Syntax Used - simplehttpserver -basic-auth root:root -upload -listen 0.0.0.0:3000
Error
Serving /home/r on http://0.0.0.0:3000/
2021/04/17 05:57:29 http: panic serving X.X.X.X:29799: runtime error: invalid memory address or nil pointer dereference
goroutine 6 [running]:
net/http.(*conn).serve.func1(0xc000099040)
/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x7f5e00, 0xb0c220)
/usr/local/go/src/runtime/panic.go:975 +0x47a
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).basicauthlayer.func1(0x8d72e0, 0xc0000d8810, 0xc0000de400)
/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/authlayer.go:12 +0xd7
net/http.HandlerFunc.ServeHTTP(0xc00000eae0, 0x8d72e0, 0xc0000d8810, 0xc0000de400)
/usr/local/go/src/net/http/server.go:2042 +0x44
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).loglayer.func1(0x8d75e0, 0xc0000962a0, 0xc0000de400)
/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/loglayer.go:23 +0x109
net/http.HandlerFunc.ServeHTTP(0xc00000eb00, 0x8d75e0, 0xc0000962a0, 0xc0000de400)
/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc0000961c0, 0x8d75e0, 0xc0000962a0, 0xc0000de400)
/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000099040, 0x8d8220, 0xc000068bc0)
/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2969 +0x36c
2021/04/17 05:57:59 http: panic serving X.X.X.X:29800: runtime error: invalid memory address or nil pointer dereference
goroutine 18 [running]:
net/http.(*conn).serve.func1(0xc000124000)
/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x7f5e00, 0xb0c220)
/usr/local/go/src/runtime/panic.go:975 +0x47a
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).basicauthlayer.func1(0x8d72e0, 0xc0001201b0, 0xc000134000)
/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/authlayer.go:12 +0xd7
net/http.HandlerFunc.ServeHTTP(0xc00000eae0, 0x8d72e0, 0xc0001201b0, 0xc000134000)
/usr/local/go/src/net/http/server.go:2042 +0x44
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).loglayer.func1(0x8d75e0, 0xc000140000, 0xc000134000)
/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/loglayer.go:23 +0x109
net/http.HandlerFunc.ServeHTTP(0xc00000eb00, 0x8d75e0, 0xc000140000, 0xc000134000)
/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc0000961c0, 0x8d75e0, 0xc000140000, 0xc000134000)
/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000124000, 0x8d8220, 0xc00012c000)
/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2969 +0x36c
2021/04/17 05:58:00 http: panic serving X.X.X.X:29801: runtime error: invalid memory address or nil pointer dereference
goroutine 8 [running]:
net/http.(*conn).serve.func1(0xc0000990e0)
/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x7f5e00, 0xb0c220)
/usr/local/go/src/runtime/panic.go:975 +0x47a
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).basicauthlayer.func1(0x8d72e0, 0xc0001202d0, 0xc0000de700)
/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/authlayer.go:12 +0xd7
net/http.HandlerFunc.ServeHTTP(0xc00000eae0, 0x8d72e0, 0xc0001202d0, 0xc0000de700)
/usr/local/go/src/net/http/server.go:2042 +0x44
github.com/projectdiscovery/simplehttpserver/pkg/httpserver.(*HTTPServer).loglayer.func1(0x8d75e0, 0xc0001400e0, 0xc0000de700)
/home/r/go/pkg/mod/github.com/projectdiscovery/simplehttpserver@v0.0.2/pkg/httpserver/loglayer.go:23 +0x109
net/http.HandlerFunc.ServeHTTP(0xc00000eb00, 0x8d75e0, 0xc0001400e0, 0xc0000de700)
/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc0000961c0, 0x8d75e0, 0xc0001400e0, 0xc0000de700)
/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc0000990e0, 0x8d8220, 0xc000068d40)
/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2969 +0x36csimplehttpserver -listen 0.0.0.0:3000 works as expected
rtcms commented
OOPS Github spoiled the formatting
Please check the Error - https://pastebin.com/yKEtg2mB
ehsandeep commented
Did you make an additional POST request or any more steps to reproduce this?
simplehttpserver -basic-auth root:root -upload -listen 0.0.0.0:3000
_____ _ __ __ __________________
/ ___/(_)___ ___ ____ / /__ / / / /_ __/_ __/ __ \________ ______ _____ _____
\__ \/ / __ -__ \/ __ \/ / _ \/ /_/ / / / / / / /_/ / ___/ _ \/ ___/ | / / _ \/ ___/
___/ / / / / / / / /_/ / / __/ __ / / / / / / ____(__ ) __/ / | |/ / __/ /
/____/_/_/ /_/ /_/ .___/_/\___/_/ /_/ /_/ /_/ /_/ /____/\___/_/ |___/\___/_/
/_/ - v0.0.2
projectdiscovery.io
Use with caution. You are responsible for your actions
Developers assume no liability and are not responsible for any misuse or damage.
Serving test on http://0.0.0.0:3000/
rtcms commented
Nope I made a GET request (Visit my VPS's IP:3000 URL) - in-fact 3 GET requests for the error to occur three times
I just tried and POST method which also gives me similar error
bing0o commented
ehsandeep commented
bing0o commented
@ehsandeep thank you, it works now :)
rtcms commented
@ehsandeep thank you, it works now :)
+1
