Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid memory address or nil pointer dereference #24

Closed
0xibram opened this issue Sep 25, 2019 · 7 comments
Closed

invalid memory address or nil pointer dereference #24

0xibram opened this issue Sep 25, 2019 · 7 comments
Labels

Comments

@0xibram
Copy link

0xibram commented Sep 25, 2019

gowitness constantly gives the following error after updating to 1.1.0

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x14093c6]

goroutine 5183 [running]:
github.com/sensepost/gowitness/utils.getPageTitle(0xc0001bee70, 0xc000ae4d98, 0x100e448)
	/Users/leonjza/Documents/git/gowitness/utils/processor.go:124 +0xa6
github.com/sensepost/gowitness/utils.getPageTitle(0xc0001bee00, 0xc000ae4de0, 0x138c945)
	/Users/leonjza/Documents/git/gowitness/utils/processor.go:128 +0x7a
github.com/sensepost/gowitness/utils.getPageTitle(0xc0001bed90, 0x0, 0x0)
	/Users/leonjza/Documents/git/gowitness/utils/processor.go:128 +0x7a
github.com/sensepost/gowitness/utils.getPageTitle(0xc0001becb0, 0xc000c0d0a0, 0xc0001becb0)
	/Users/leonjza/Documents/git/gowitness/utils/processor.go:128 +0x7a
github.com/sensepost/gowitness/utils.ProcessURL(0xc000121480, 0x1b62de0, 0x1b60bb0, 0x9)
	/Users/leonjza/Documents/git/gowitness/utils/processor.go:47 +0x51c
github.com/sensepost/gowitness/cmd.glob..func1.1(0xc00021e500, 0xc000241ac0, 0xc0002446c0, 0xc000121480)
	/Users/leonjza/Documents/git/gowitness/cmd/file.go:94 +0x8a
created by github.com/sensepost/gowitness/cmd.glob..func1
	/Users/leonjza/Documents/git/gowitness/cmd/file.go:90 +0x5ec
@leonjza
Copy link
Member

leonjza commented Sep 25, 2019

I am having trouble replicating this. It looks like the page title grabber is failing, but I am not sure why yet. I tested with malformed HTML, empty HTML and HTML without a <title> tag but could not replicate the crash.

Since the stack trace hints towards you using the file command, any chance you could share contents of your source file? Otherwise, if you could generate an endpoint on https://httpbin.org/ that replicates this that would be awesome too.

@leonjza leonjza added the bug label Sep 25, 2019
@leonjza
Copy link
Member

leonjza commented Sep 25, 2019

Nvm, just managed to replicate it. Fix incoming.

@BBerastegui
Copy link

Latest version with the same problem when hitting pages that are returning just a JSON string (for example).

(...)
ERRO[2020-01-25 12:57:55] Screenshot failed                             destination=https-REDACTED.com.png err="exit status 1" url="https://REDACTED/"
panic: runtime error: invalid memory address or nil pointer dereference
(...)

The page returned this when using curl:

> GET / HTTP/1.1
> Host: REDACTED.com
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Content-Type: application/json
< Client-IP: REDACTED
< GatewayMessage: error
< WWW-Authenticate: Bearer
< X-Backside-Transport: FAIL FAIL
< Connection: close
<
* TLSv1.2 (IN), TLS alert, close notify (256):
* Closing connection 1
* TLSv1.2 (OUT), TLS alert, close notify (256):
{ "ServiceStatus":{ "StatusType":"Error", "ServiceCode":"", "ServiceName":"
(REDACTED)
 "InnerException":"", "ServerName":"" }

@BBerastegui
Copy link

Same crash with pages with this kind of response:

> GET / HTTP/1.1
> Host: REDACTED.com
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 403 Forbidden
< Vary: Accept-Encoding
< P3P: CP="CAO PSA OUR"
< Content-Type: text/html;charset=ISO-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 0
< Set-Cookie: sess=!p7(REDACTED)gnk=; path=/
<

@leonjza
Copy link
Member

leonjza commented Jan 25, 2020

Any stack trace when it crashes?

@BBerastegui
Copy link

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7fe555]

goroutine 12 [running]:
github.com/tidwall/buntdb.(*Tx).lock(0xc00028aec0)
        /go/pkg/mod/github.com/tidwall/buntdb@v0.0.0-20170824144000-b67b1b8c1658/buntdb.go:1068 +0x65
github.com/tidwall/buntdb.(*DB).Begin(0x0, 0xc000102501, 0x1, 0xc000300b50, 0x5cbc67)
        /go/pkg/mod/github.com/tidwall/buntdb@v0.0.0-20170824144000-b67b1b8c1658/buntdb.go:1047 +0x61
github.com/tidwall/buntdb.(*DB).managed(0x0, 0xc000300c01, 0xc000300c70, 0x0, 0x0)
        /go/pkg/mod/github.com/tidwall/buntdb@v0.0.0-20170824144000-b67b1b8c1658/buntdb.go:919 +0x57
github.com/tidwall/buntdb.(*DB).Update(...)
        /go/pkg/mod/github.com/tidwall/buntdb@v0.0.0-20170824144000-b67b1b8c1658/buntdb.go:964
github.com/sensepost/gowitness/storage.(*Storage).SetHTTPData(0xf5af30, 0xc0001ae500)
        /src/storage/storage.go:64 +0x506
github.com/sensepost/gowitness/utils.ProcessURL(0xc000022f80, 0xf5d0e0, 0xf5af30, 0x3)
        /src/utils/processor.go:115 +0x20b4
github.com/sensepost/gowitness/cmd.glob..func1.1(0xc00000f7e0, 0xc000027980, 0xc0001b03c0, 0xc000022f80)
        /src/cmd/file.go:96 +0x8a
created by github.com/sensepost/gowitness/cmd.glob..func1
        /src/cmd/file.go:92 +0x5fe

@leonjza
Copy link
Member

leonjza commented Jan 25, 2020

Thanks. This does not look like the same crash as OP though. Will create a new ticket for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants