Skip to content

Error : Invalid memory address or nil pointer dereference #27

Closed

Description

@rtcms

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 +0x36c

simplehttpserver -listen 0.0.0.0:3000 works as expected

Activity

  1. rtcms commented on Apr 17, 2021

    @rtcms
    Author

    OOPS Github spoiled the formatting
    Please check the Error - https://pastebin.com/yKEtg2mB

  2. ehsandeep commented on Apr 17, 2021

    @ehsandeep
    Member

    @rtcms

    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/
    
  3. added
    Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.
    Type: QuestionA query or seeking clarification on parts of the spec. Probably doesn't need the attention of all.
    on Apr 17, 2021
  4. rtcms commented on Apr 17, 2021

    @rtcms
    Author

    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

  5. added a commit that references this issue on Apr 17, 2021
  6. self-assigned this
    on Apr 17, 2021
  7. linked a pull request that will close this issuefixing crash #29on Apr 17, 2021
  8. bing0o commented on Apr 17, 2021

    @bing0o

    I have the same problem when I try to upload a file
    error

  9. linked a pull request that will close this issueMinor crash fix #33on Apr 18, 2021
  10. ehsandeep commented on Apr 18, 2021

    @ehsandeep
    Member

    @bing0o @rtcms this crash is now fixed with #29, we also created a new release, just update the to latest version and this should be fixed now.

  11. bing0o commented on Apr 18, 2021

    @bing0o

    @ehsandeep thank you, it works now :)

  12. rtcms commented on Apr 18, 2021

    @rtcms
    Author

    @ehsandeep thank you, it works now :)

    +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.Type: QuestionA query or seeking clarification on parts of the spec. Probably doesn't need the attention of all.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions