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

Fix inconsistency with 404 URLs #808

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bbot/modules/deadly/nuclei.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def correlate_event(self, events, host):
for event in events:
if host in event:
return event
self.warning("Failed to correlate nuclei result with event")
self.verbose(f"Failed to correlate nuclei result for {host}. Possible source events:")
for event in events:
self.verbose(f" - {event.data}")

async def execute_nuclei(self, nuclei_input):
command = [
Expand Down
3 changes: 2 additions & 1 deletion bbot/modules/httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ async def handle_batch(self, *events):
continue

# discard 404s from unverified URLs
if source_event.type == "URL_UNVERIFIED" and status_code in (404,):
path = j.get("path", "/")
if source_event.type == "URL_UNVERIFIED" and status_code in (404,) and path != "/":
self.debug(f'Discarding 404 from "{url}"')
continue

Expand Down
18 changes: 18 additions & 0 deletions bbot/test/test_step_2/module_tests/test_module_httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,21 @@ def check(self, module_test, events):
url = True
assert url, "Failed to visit target URL"
assert open_port, "Failed to visit target OPEN_TCP_PORT"


class TestHTTPX_404(ModuleTestBase):
targets = ["https://127.0.0.1:9999"]
modules_overrides = ["httpx", "speculate", "excavate"]
config_overrides = {"internal_modules": {"speculate": {"ports": "8888,9999"}}}

async def setup_after_prep(self, module_test):
module_test.httpserver.expect_request("/").respond_with_data(
"Redirecting...", status=301, headers={"Location": "https://127.0.0.1:9999"}
)
module_test.httpserver_ssl.expect_request("/").respond_with_data("404 not found", status=404)

def check(self, module_test, events):
assert 1 == len(
[e for e in events if e.type == "URL" and e.data == "http://127.0.0.1:8888/" and "status-301" in e.tags]
)
assert 1 == len([e for e in events if e.type == "URL" and e.data == "https://127.0.0.1:9999/"])