Don't recursively mutate mutations (by default)#3131
Merged
Conversation
dnsbrute and dnscommonsrv now filter out events tagged mutation-* (emitted by dnsbrute_mutations). The static 5k SecLists wordlist and the SRV brute heavily overlap with the mutation algorithm's own output, so re-running per-host brute force on every mutation hit creates a long tail of near-redundant massdns work. Both modules expose `recursive_mutations` (default False). The kitchen-sink preset re-enables it for maximum coverage.
Contributor
🚀 Performance Benchmark Report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3131 +/- ##
=====================================
+ Coverage 90% 90% +1%
=====================================
Files 441 441
Lines 38743 38788 +45
=====================================
+ Hits 34663 34707 +44
- Misses 4080 4081 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ausmaster
approved these changes
May 29, 2026
ausmaster
left a comment
Contributor
There was a problem hiding this comment.
Approved with one optional:
The if not self.config... return False, ... could be pulled out into a separate function for DRY but its only called twice and its not really substantial. Up to you if you wanna do that, not required for merge.
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.
Background
Long-running BBOT scans frequently exhibit a "cliff + tail" throughput pattern: high steady-state throughput for several hours, a sharp drop (often >99% in a single heartbeat), then a long slow drain that can last 10+ hours.
Tracing a representative scan, throughput dropped from ~6,000 events/15s to <100 events/15s in a single tick. At the cliff, four modules carried the remaining queue depth, all with
processing=1(single-threaded handlers):dnscommonsrvdnsbrutewaybackpgpAt those rates,
dnscommonsrvalone projected to ~158 hours to fully drain. The other modules' arithmetic was similar.Root cause
dnsbrute_mutationsruns infinish()and can emit tens of thousands of new in-scope subdomains. Every one of those then entersdnsbrute/dnscommonsrv(bothdedup_strategy="lowest_parent", so every unique subdomain triggers an independent massdns run). The 4-module set above is now doing per-host bruteforce against the entire mutation output.The pathological part: this work is mostly redundant. The SecLists
subdomains-top1million-5000.txtwordlist is dominated by ~50 universally common labels (www,mail,admin,api,dev,staging,vpn,ftp,ns1,cpanel,autodiscover, etc.), which are exactly the labelsdnsbrute_mutationsderives from its own corpus. The module's mutation Source 1 explicitly does:So the first segment of every discovered subdomain anywhere in the scan becomes a mutation candidate. By the time mutations runs, the wordcloud already contains nearly the entire useful prefix of the SecLists list. Re-running that static list against each mutation output is ~150M massdns queries for, generously, single-digit-percent unique discoveries.
What this PR does
Adds a
recursive_mutationsoption todnsbruteanddnscommonsrv(defaultFalse). When False, events carrying anymutation-*tag (emitted bydnsbrute_mutations) are rejected by the module'sfilter_event. The events still queue but drain at thousands/sec because no massdns work runs; the expensive per-host brute is skipped.The filter handles arbitrary mutation depth (
mutation-1,mutation-2,mutation-3, ...) because it matches the tag prefix.dnsbrute_mutationsis untouched - it can still iterate internally on its own output. We're cutting the amplification loop where each mutation tier triggers a full SecLists brute against every host.Defaults
recursive_mutations: false(skip the redundant work).kitchen-sinkpreset overrides totruefor users explicitly opting into maximum coverage.Tradeoff
The skipped work occasionally catches names that mutations can't generate - the tail of the SecLists wordlist contains software-specific labels (
roundcube,phpmyadmin,webmin, etc.) that only end up in the wordcloud if some target host already runs that software. Coverage loss is small, and the option exists for users who want it back.