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

protect the cache from DNS responses that lack an Answer, add .gitign… #51

Merged
merged 1 commit into from Jul 13, 2022

Conversation

mikerott
Copy link
Contributor

Two changes in this PR:

  1. protect the DNS cache from entries that lack an Answer (explanation below)
  2. add .gitignore to ignore vendor/ folder

In testing Nuclei as an embedded library in an AWS lambda (even worse, in a lambda being run in localstack container in docker-compose), with a bit of fmt.Print* to print the value of b here:

b, _ := data.Marshal()
err = d.hm.Set(hostname, b)

I observed that when passing both https://something and http://something into the executor with Nuclei configured for BulkSize greater than 1, the value of b occasionally lacked an Answer, which would populate the cache with a bad entry.

I honestly don't know if it's due to odd behavior of docker-compose internal DNS, or a go bug or what, but the change in this PR adds some protection for the cache.

Related to this discussion: projectdiscovery/nuclei#2277

Detail:

I added code like:

if b != nil {
    fmt.Printf("MIKE: b is %v\n", b)  // not string(b) because for some reason the lambda panicked
}

Then inspected the output to observe there was no Answer in the b passed to d.hm.Set in some cases. I could not reliably reproduce the problem, but it was frequent enough to warrant the investigation and this PR.

@ehsandeep ehsandeep requested a review from Mzack9999 July 12, 2022 21:40
@ehsandeep ehsandeep merged commit 1250d5e into projectdiscovery:dev Jul 13, 2022
@mikerott mikerott deleted the dev branch July 14, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants