The recursive internet scanner for hackers. 🧡
Python asmattack-surface-managementautomationbugbountyclieasmhackingneo4josintosint-frameworkpentestingpythonreconrecursionscannersubdomain-enumerationsubdomain-scannersubdomainsthreat-intelligencethreatintel
baddns: update to 2.5.0
liquidseccebc4631aa58
diff --git a/bbot/modules/baddns.py b/bbot/modules/baddns.pyindex ddc86ab3a..e650dacaf 100644--- a/bbot/modules/baddns.py+++ b/bbot/modules/baddns.py@@ -1,5 +1,6 @@from baddns.base import get_all_modulesfrom baddns.lib.loader import load_signatures+from baddns.lib.matcher import WordMatcherfrom .base import BaseModuleimport logging@@ -11,7 +12,7 @@ CONFIDENCE_LEVELS = ("UNKNOWN", "LOW", "MEDIUM", "HIGH", "CONFIRMED")SUBMODULE_MAX_SEVERITY = {"CNAME": "MEDIUM",- "NS": "MEDIUM",+ "NS": "HIGH","MX": "MEDIUM","TXT": "LOW","references": "MEDIUM",@@ -21,11 +22,12 @@ SUBMODULE_MAX_SEVERITY = {"SPF": "MEDIUM","MTA-STS": "HIGH","WILDCARD": "HIGH",+ "DELEGATION": "HIGH",}SUBMODULE_MAX_CONFIDENCE = {"CNAME": "CONFIRMED",- "NS": "HIGH",+ "NS": "CONFIRMED","MX": "CONFIRMED","TXT": "CONFIRMED","references": "CONFIRMED",@@ -35,6 +37,7 @@ SUBMODULE_MAX_CONFIDENCE = {"SPF": "CONFIRMED","MTA-STS": "CONFIRMED","WILDCARD": "CONFIRMED",+ "DELEGATION": "CONFIRMED",}@@ -56,11 +59,11 @@ class baddns(BaseModule):min_confidence: ConfidenceLiteral = Field("MEDIUM", description="Minimum confidence to emit")enabled_submodules: list[str] = Field(default_factory=list,- description="A list of submodules to enable. Empty list (default) enables CNAME, TXT and MX Only",+ description="A list of submodules to enable. Empty list (default) enables CNAME, MX, TXT and DELEGATION Only",)module_threads = 8- deps_pip = ["baddns~=2.4.0"]+ deps_pip = ["baddns~=2.5.0"]def select_modules(self):selected_submodules = []@@ -72,7 +75,7 @@ class baddns(BaseModule):def set_modules(self):self.enabled_submodules = self.config.get("enabled_submodules", [])if self.enabled_submodules == []:- self.enabled_submodules = ["CNAME", "MX", "TXT"]+ self.enabled_submodules = ["CNAME", "MX", "TXT", "DELEGATION"]def _filter_submodules(self):filtered = []@@ -112,6 +115,8 @@ class baddns(BaseModule):self._min_sev_idx = SEVERITY_LEVELS.index(min_severity)self._min_conf_idx = CONFIDENCE_LEVELS.index(min_confidence)self.signatures = load_signatures()+ # one batched YARA pass per response instead of each signature's words in turn+ self.word_matcher = WordMatcher(self.signatures)self.set_modules()self.enabled_submodules = self._filter_submodules()if not self.enabled_submodules:@@ -144,6 +149,7 @@ class baddns(BaseModule):"dns_client": self.scan.helpers.dns.blastdns,"custom_nameservers": self.custom_nameservers,"signatures": self.signatures,+ "word_matcher": self.word_matcher,}if ModuleClass.name == "NS":diff --git a/bbot/modules/baddns_direct.py b/bbot/modules/baddns_direct.pyindex 584d3f776..73d36f032 100644--- a/bbot/modules/baddns_direct.py+++ b/bbot/modules/baddns_direct.py@@ -22,7 +22,7 @@ class baddns_direct(baddns_module):)module_threads = 8- deps_pip = ["baddns~=2.4.0"]+ deps_pip = ["baddns~=2.5.0"]scope_distance_modifier = 1diff --git a/bbot/modules/baddns_zone.py b/bbot/modules/baddns_zone.pyindex 9277be5e1..081dc10fb 100644--- a/bbot/modules/baddns_zone.py+++ b/bbot/modules/baddns_zone.py@@ -22,7 +22,7 @@ class baddns_zone(baddns_module):)module_threads = 8- deps_pip = ["baddns~=2.4.0"]+ deps_pip = ["baddns~=2.5.0"]def set_modules(self):self.enabled_submodules = ["NSEC", "zonetransfer"]diff --git a/bbot/presets/baddns-heavy.yml b/bbot/presets/baddns-heavy.ymlindex bb683a9d0..5e23fb39d 100644--- a/bbot/presets/baddns-heavy.yml+++ b/bbot/presets/baddns-heavy.yml@@ -10,7 +10,7 @@ modules:config:modules:baddns:- enabled_submodules: [CNAME, NS, MX, TXT, references, DMARC, SPF, MTA-STS, WILDCARD]+ enabled_submodules: [CNAME, NS, MX, TXT, references, DMARC, SPF, MTA-STS, WILDCARD, DELEGATION]min_severity: INFOmin_confidence: UNKNOWNbaddns_zone:diff --git a/bbot/presets/baddns.yml b/bbot/presets/baddns.ymlindex d6e0cf76a..723c7582e 100644--- a/bbot/presets/baddns.yml+++ b/bbot/presets/baddns.yml@@ -6,6 +6,6 @@ modules:config:modules:baddns:- enabled_submodules: [CNAME, MX, TXT]+ enabled_submodules: [CNAME, MX, TXT, DELEGATION]min_severity: LOWmin_confidence: MEDIUMdiff --git a/bbot/test/test_step_2/module_tests/test_module_baddns.py b/bbot/test/test_step_2/module_tests/test_module_baddns.pyindex 2ef77da8d..958245d72 100644--- a/bbot/test/test_step_2/module_tests/test_module_baddns.py+++ b/bbot/test/test_step_2/module_tests/test_module_baddns.py@@ -66,7 +66,7 @@ def _max_level(values, levels):# Modules that wrap CNAME findings and may use variables for severity/confidence.# When a field uses a variable instead of a literal, its max is bounded by# CNAME's max for that field.-CNAME_DERIVED_MODULES = {"references", "txt", "wildcard", "mtasts"}+CNAME_DERIVED_MODULES = {"references", "txt", "wildcard", "mtasts", "delegation"}def test_baddns_max_severity_confidence():@@ -196,7 +196,7 @@ class TestBaddns_cname_signature(BaseTestBaddns):return HTTPSERVER_HOSTPORTexpect_args = {"method": "GET", "uri": "/"}- respond_args = {"response_data": "<h1>Oops! We couldn’t find that page.</h1>", "status": 200}+ respond_args = {"response_data": "error code: 1001", "status": 409}module_test.set_expect_requests(expect_args=expect_args, respond_args=respond_args)await module_test.mock_dns(@@ -212,3 +212,94 @@ class TestBaddns_cname_signature(BaseTestBaddns):"Failed to emit FINDING")assert any("baddns-cname" in e.tags for e in events), "Failed to add baddns tag"+++class BaseTestBaddnsDelegation(ModuleTestBase):+ module_name = "baddns"+ modules_overrides = ["baddns"]+ targets = ["bad.dns"]+ config_overrides = {+ "dns": {"minimal": False},+ "modules": {"baddns": {"enabled_submodules": ["DELEGATION"]}},+ }++ async def dispatchWHOIS(x):+ return None++ async def setup_after_prep(self, module_test):+ from baddns.lib.whoismanager import WhoisManager++ await module_test.mock_dns(self.mock_data)+ module_test.monkeypatch.setattr(WhoisManager, "dispatchWHOIS", self.dispatchWHOIS)+++class TestBaddns_delegation(BaseTestBaddnsDelegation):+ mock_data = {+ "bad.dns": {"A": ["127.0.0.1"]},+ "_acme-challenge.bad.dns": {"CNAME": ["baddns.azurewebsites.net."]},+ "_dmarc.bad.dns": {"CNAME": ["baddns.trydiscourse.com."]},+ "selector1._domainkey.bad.dns": {"CNAME": ["baddns.us-east-1.elasticbeanstalk.com."]},+ "_NXDOMAIN": [+ "baddns.azurewebsites.net",+ "baddns.trydiscourse.com",+ "baddns.us-east-1.elasticbeanstalk.com",+ ],+ }++ def check(self, module_test, events):+ findings = [e for e in events if e.type == "FINDING"]+ descriptions = [e.data["description"] for e in findings]+ assert any("Dangling ACME delegation [_acme-challenge.bad.dns]" in d for d in descriptions), (+ "Failed to emit ACME delegation FINDING"+ )+ assert any("Dangling DMARC delegation [_dmarc.bad.dns]" in d for d in descriptions), (+ "Failed to emit DMARC delegation FINDING"+ )+ assert any("Dangling DKIM delegation [selector1._domainkey.bad.dns]" in d for d in descriptions), (+ "Failed to emit DKIM delegation FINDING"+ )+ assert all(e.data["severity"] == "HIGH" for e in findings), "Delegation findings must be HIGH severity"+ assert all("baddns-delegation" in e.tags for e in findings), "Failed to add baddns tag"+++class TestBaddns_delegation_wildcard(BaseTestBaddnsDelegation):+ """A wildcard answers for every probed label, so only a label pointing somewhere else is a real delegation."""++ mock_data = {+ "bad.dns": {"A": ["127.0.0.1"]},+ "_acme-challenge.bad.dns": {"CNAME": ["baddns.trydiscourse.com."]},+ r"regex:.*\.bad\.dns$": {"CNAME": ["wildcard.azurewebsites.net."]},+ "_NXDOMAIN": ["baddns.trydiscourse.com", "wildcard.azurewebsites.net"],+ }++ def check(self, module_test, events):+ findings = [e for e in events if e.type == "FINDING"]+ descriptions = [e.data["description"] for e in findings]+ assert any("Dangling ACME delegation [_acme-challenge.bad.dns]" in d for d in descriptions), (+ "Label pointing off the wildcard must still be reported"+ )+ assert not any("Dangling DMARC delegation" in d for d in descriptions), (+ "Wildcard-covered labels must not be reported"+ )+ assert not any("Dangling DKIM delegation" in d for d in descriptions), (+ "Wildcard-covered labels must not be reported"+ )+++class TestBaddns_delegation_generic(BaseTestBaddnsDelegation):+ """A CNAME to a name that simply doesn't exist is routine here, so only claimable outcomes count."""++ mock_data = {+ "bad.dns": {"A": ["127.0.0.1"]},+ "_acme-challenge.bad.dns": {"CNAME": ["baddns.azurewebsites.net."]},+ "_dmarc.bad.dns": {"CNAME": ["gone.unknown-vendor.net."]},+ "_NXDOMAIN": ["baddns.azurewebsites.net", "gone.unknown-vendor.net"],+ }++ def check(self, module_test, events):+ findings = [e for e in events if e.type == "FINDING"]+ descriptions = [e.data["description"] for e in findings]+ assert any("Dangling ACME delegation [_acme-challenge.bad.dns]" in d for d in descriptions), (+ "Label matching a service signature must be reported"+ )+ assert not any("DMARC" in d for d in descriptions), "GENERIC delegation findings must be suppressed"diff --git a/bbot/test/test_step_2/module_tests/test_module_baddns_direct.py b/bbot/test/test_step_2/module_tests/test_module_baddns_direct.pyindex d99f39c00..84926445a 100644--- a/bbot/test/test_step_2/module_tests/test_module_baddns_direct.py+++ b/bbot/test/test_step_2/module_tests/test_module_baddns_direct.py@@ -27,7 +27,7 @@ class TestBaddns_direct_cloudflare(BaseTestBaddns):self.events_seen.append(event.data)url = f"http://bad.dns:{HTTPSERVER_PORT}/"url_event = self.scan.make_event(- url, "URL", parent=self.scan.root_event, tags=["cloudflare", "in-scope", "status-401"]+ url, "URL", parent=self.scan.root_event, tags=["cloudflare", "in-scope", "status-404"])if url_event is not None:await self.emit_event(url_event)@@ -46,8 +46,8 @@ class TestBaddns_direct_cloudflare(BaseTestBaddns):expect_args = {"method": "GET", "uri": "/"}respond_args = {- "response_data": "<Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist</Message><BucketName>bad.dns</BucketName></Error>",- "status": 401,+ "response_data": "<h1>Error 404 - AnnounceKit</h1>",+ "status": 404,}module_test.set_expect_requests(expect_args=expect_args, respond_args=respond_args)@@ -59,7 +59,7 @@ class TestBaddns_direct_cloudflare(BaseTestBaddns):def check(self, module_test, events):assert any(e.type == "FINDING"- and "Possible [AWS Bucket Takeover Detection] via direct BadDNS analysis. Indicator: [[Words: The specified bucket does not exist, BucketName | Condition: and | Part: body] Matchers-Condition: and] Trigger: [self] baddns Module: [CNAME]"+ and "Possible [Announcekit Takeover Detection] via direct BadDNS analysis. Indicator: [[Words: Error 404 - AnnounceKit | Condition: and | Part: body] Matchers-Condition: and] Trigger: [self] baddns Module: [CNAME]"in e.data["description"]for e in events), "Failed to emit FINDING"diff --git a/docs/scanning/configuration.md b/docs/scanning/configuration.mdindex 26dd34f8f..aa3f18f76 100644--- a/docs/scanning/configuration.md+++ b/docs/scanning/configuration.md@@ -122,10 +122,12 @@ dns:# Attempts per brute-force name before giving up (each retry lands on a different resolver)# Only timeouts retry, not NXDOMAIN, so this costs traffic proportional to the failure ratebrute_retries: 20- # Per-query timeout in seconds when brute-forcing. Deliberately much shorter than- # dns.timeout: a public resolver that hasn't answered by now won't, and retrying- # elsewhere is cheaper than waiting.- brute_timeout: 1+ # Per-query timeout in seconds when brute-forcing, deliberately much shorter than dns.timeout+ # Retrying elsewhere is cheaper than waiting; going below this starts shrinking the resolver pool+ brute_timeout: 0.5+ # Reuse one socket per resolver instead of binding one per query, which keeps NAT/conntrack+ # state bounded by the resolver count rather than growing with query volume+ brute_persistent_socket: true# nameservers to use for DNS brute-forcing# default is updated weekly and contains ~10K high-quality public serversbrute_nameservers: https://raw.githubusercontent.com/blacklanternsecurity/public-dns-servers/master/nameservers.txt@@ -463,7 +465,7 @@ In addition to the stated options for each module, the following universal optio| Config Option | Type | Description | Default ||--------------------------------------------------------|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|| modules.baddns.custom_nameservers | list[str] | Force BadDNS to use a list of custom nameservers | [] |-| modules.baddns.enabled_submodules | list[str] | A list of submodules to enable. Empty list (default) enables CNAME, TXT and MX Only | [] |+| modules.baddns.enabled_submodules | list[str] | A list of submodules to enable. Empty list (default) enables CNAME, MX, TXT and DELEGATION Only | [] || modules.baddns.min_confidence | ConfidenceLiteral | Minimum confidence to emit | MEDIUM || modules.baddns.min_severity | SeverityLiteral | Minimum severity to emit | LOW || modules.baddns_direct.custom_nameservers | list | Force BadDNS to use a list of custom nameservers | [] |diff --git a/docs/scanning/presets_list.md b/docs/scanning/presets_list.mdindex d2190f5d2..fbacea28d 100644--- a/docs/scanning/presets_list.md+++ b/docs/scanning/presets_list.md@@ -15,7 +15,7 @@ Check for subdomain takeovers and other DNS issues.config:modules:baddns:- enabled_submodules: [CNAME, MX, TXT]+ enabled_submodules: [CNAME, MX, TXT, DELEGATION]min_severity: LOWmin_confidence: MEDIUM```@@ -42,7 +42,7 @@ Run all baddns modules and submodules.config:modules:baddns:- enabled_submodules: [CNAME, NS, MX, TXT, references, DMARC, SPF, MTA-STS, WILDCARD]+ enabled_submodules: [CNAME, NS, MX, TXT, references, DMARC, SPF, MTA-STS, WILDCARD, DELEGATION]min_severity: INFOmin_confidence: UNKNOWNbaddns_zone:diff --git a/pyproject.toml b/pyproject.tomlindex aa1196af1..5bc3e0288 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -49,7 +49,7 @@ dependencies = ["tldextract>=5.3.0,<6","cloudcheck>=11.1.0,<12","blasthttp>=0.10.0,<0.11",- "blastdns>=2.0.0,<3",+ "blastdns>=2.0.0,<2.1","zstandard>=0.22,<1","packaging>=23.0",]@@ -81,7 +81,7 @@ dev = ["pytest-httpx>=0.35","pytest-benchmark>=4,<6","pytest-xdist>=3.6,<4",- "baddns~=2.4.1",+ "baddns~=2.5.0","ruff==0.16.9","maturin>=1.4,<2",]@@ -98,10 +98,6 @@ docs = ["pymdown-extensions>=10.20.1,<13",]-[tool.uv]-# baddns still declares blastdns<1.10; override until it ships a 2.x-compatible release-override-dependencies = ["blastdns>=2.0.0,<3"]-[build-system]requires = ["hatchling"]build-backend = "hatchling.build"diff --git a/uv.lock b/uv.lockindex 4440d96e2..86cd184e7 100644--- a/uv.lock+++ b/uv.lock@@ -7,9 +7,6 @@ resolution-markers = ["python_full_version < '3.11'",]-[manifest]-overrides = [{ name = "blastdns", specifier = ">=2.0.0,<3" }]-[[package]]name = "annotated-doc"version = "0.0.4"@@ -163,7 +160,7 @@ wheels = [[[package]]name = "baddns"-version = "2.4.1"+version = "2.5.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "blastdns" },@@ -175,10 +172,11 @@ dependencies = [{ name = "python-whois" },{ name = "pyyaml" },{ name = "tldextract" },+ { name = "yara-python" },]-sdist = { url = "https://files.pythonhosted.org/packages/1d/91/62cef471fba0201e38d1d3cca0170ca0dd25c5417c7f2f2b495dc3903b3e/baddns-2.4.1.tar.gz", hash = "sha256:022e66a7d04ccbf239ba0a012c505dcc8d4246d240817c16802d1c833f1765fa", size = 62730, upload-time = "2026-06-17T23:12:10.841Z" }+sdist = { url = "https://files.pythonhosted.org/packages/07/38/2adf163056db50f943a838fb3602463762fc523d3f6a9147fd0a2bea631f/baddns-2.5.0.tar.gz", hash = "sha256:8f2f87dc2be54a5a74aea350cf4b079fcafbe31b811951ac940952ad29c2e96a", size = 80403, upload-time = "2026-10-09T15:27:29.881Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/8c/d1/f7cc99fbf5146becdefc01b68917f4de8b5d32b355fe8be42e4ae12e5538/baddns-2.4.1-py3-none-any.whl", hash = "sha256:bda752ecdb31fe27c753516ab476f0371d128fe5c7f1c8a677ba49ad9348d8e3", size = 121104, upload-time = "2026-06-17T23:12:09.661Z" },+ { url = "https://files.pythonhosted.org/packages/16/5a/1e0479d06fcb17e8310383b58be8c4aad5e17f8d781b9ed785b70b6eed3f/baddns-2.5.0-py3-none-any.whl", hash = "sha256:b8d6d04f75cb47cf261c21708ea41ec89111b447844e458337604a702b717b5a", size = 134089, upload-time = "2026-10-09T15:27:28.823Z" },][[package]]@@ -267,7 +265,7 @@ requires-dist = [{ name = "ansible-runner", specifier = ">=2.3.2,<3" },{ name = "asndb", specifier = ">=1.1.0" },{ name = "beautifulsoup4", specifier = ">=4.12.2,<5" },- { name = "blastdns", specifier = ">=2.0.0,<3" },+ { name = "blastdns", specifier = ">=2.0.0,<2.1" },{ name = "blasthttp", specifier = ">=0.10.0,<0.11" },{ name = "cachetools", specifier = ">=5.3.2,<8.0.0" },{ name = "cloudcheck", specifier = ">=11.1.0,<12" },@@ -304,7 +302,7 @@ requires-dist = [[package.metadata.requires-dev]dev = [- { name = "baddns", specifier = "~=2.4.1" },+ { name = "baddns", specifier = "~=2.5.0" },{ name = "fastapi", specifier = ">=0.115.5,<0.143.0" },{ name = "maturin", specifier = ">=1.4,<2" },{ name = "pre-commit", specifier = ">=3.4,<5.0" },