The recursive internet scanner for hackers. 🧡
Python asmattack-surface-managementautomationbugbountyclieasmhackingneo4josintosint-frameworkpentestingpythonreconrecursionscannersubdomain-enumerationsubdomain-scannersubdomainsthreat-intelligencethreatintel
Count lightfuzz baseline URLs against spider distance (#3523)
Paul Muellerb26b57e0858d
diff --git a/bbot/modules/internal/speculate.py b/bbot/modules/internal/speculate.pyindex 4c2574c08..f530d7d4f 100644--- a/bbot/modules/internal/speculate.py+++ b/bbot/modules/internal/speculate.py@@ -172,6 +172,10 @@ class speculate(BaseInternalModule):event_is_url = event.type == "URL"event_has_url = not event.type.startswith("URL") and isinstance(event.data, dict) and "url" in event.dataevent_tags = ["blasthttp-safe"] if event.type in ("CODE_REPOSITORY", "SOCIAL") else []+ # a response whose URL isn't already in its history (e.g. a lightfuzz baseline) was reached via+ # a link on another page, so it costs a spider hop like any extracted link+ if event.type == "HTTP_RESPONSE":+ event_tags.append("spider-danger")if event_is_url or event_has_url:url = event.url# only emit the url if it's not already in the event's historydiff --git a/bbot/test/test_step_2/module_tests/test_module_lightfuzz.py b/bbot/test/test_step_2/module_tests/test_module_lightfuzz.pyindex a45071445..21e5b25ed 100644--- a/bbot/test/test_step_2/module_tests/test_module_lightfuzz.py+++ b/bbot/test/test_step_2/module_tests/test_module_lightfuzz.py@@ -5943,3 +5943,45 @@ class TestLightfuzzWildcardSkip(ModuleTestBase):assert len(web_params_fuzzed) == 0, (f"lightfuzz should not fuzz wildcard hosts, but processed params: {web_params_fuzzed}")+++class Test_Lightfuzz_baseline_respects_spider_limits(ModuleTestBase):+ """A baseline response's URL is a link from another page; it costs a spider hop like any extracted link."""++ targets = [HTTPSERVER_URL]+ modules_overrides = ["http", "lightfuzz", "excavate", "speculate"]+ config_overrides = {+ "interactsh_disable": True,+ "modules": {"lightfuzz": {"enabled_submodules": ["path"]}},+ }++ async def setup_after_prep(self, module_test):+ module_test.set_expect_requests(+ expect_args={"method": "GET", "uri": "/"},+ respond_args={"response_data": '<html><a href="/target?x=1">t</a></html>'},+ )+ module_test.set_expect_requests(+ expect_args={"method": "GET", "uri": "/target"},+ respond_args={"response_data": '<html><a href="/deeper?y=1">d</a></html>'},+ )+ module_test.set_expect_requests(+ expect_args={"method": "GET", "uri": "/deeper"},+ respond_args={"response_data": "<html>deeper</html>"},+ )++ def check(self, module_test, events):+ assert any(e.type == "WEB_PARAMETER" and e.data["name"] == "x" for e in events)+ visited = {e.parsed_url.path for e in events if e.type == "URL"}+ assert "/target" not in visited and "/deeper" not in visited, f"Visited past spider_distance 0: {visited}"+++class Test_Lightfuzz_baseline_within_spider_limits(Test_Lightfuzz_baseline_respects_spider_limits):+ config_overrides = {+ "interactsh_disable": True,+ "web": {"spider_distance": 1, "spider_depth": 3},+ "modules": {"lightfuzz": {"enabled_submodules": ["path"]}},+ }++ def check(self, module_test, events):+ visited = {e.parsed_url.path for e in events if e.type == "URL"}+ assert "/target" in visited, f"Baseline URL within spider_distance was not visited: {visited}"