Add a trailing dot to DNS domains by default to speed up discovery when a search domain is configured#418
Conversation
…nting the DNS search domain being added. Added a flag "--no-fqdn" that disables this behaviour and operates like the original implementation.
Collaborator
|
nice catch thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
If a DNS search domain is configured in the system resolver, gobuster will re-issue queries for every NXDOMAIN result with the DNS search domain appended. This occurs even when using a custom resolver. This PR simply adds a trailing dot to the domain if one isn't already present, so the search domain isn't applied. It also adds a flag to revert this behaviour if required.
While it is possible to work around by removing the search domain from resolv, or stipulating a base domain with a trailing dot, this is not something I always remember to do.
Details
The current behaviour results in an extraneous query for each word that doesn't exist if a DNS search domain is configured, and the domain is not supplied with a trailing dot.
For example, with the following
/etc/resolv.conf:Running a simple test with four subdomains:
This ends up sending 20 queries. All queries that returned NXDOMAIN are re-issued with the search domain:
If we either remove the search domain from resolv, or supply a domain with a trailing dot (
-d example.com.) , this is cut down to 12 queries:On a larger wordlist, eliminating these extraneous queries results in a significant speedup:
With the code from the PR applied we don't need to supply the trailing dot by default.: