Skip to content

Commit

Permalink
Merge pull request #1070 from blacklanternsecurity/bypass403-errors
Browse files Browse the repository at this point in the history
better bypass403 error handling
  • Loading branch information
liquidsec authored Feb 7, 2024
2 parents 7cdab23 + 1da63d2 commit d60f645
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bbot/modules/bypass403.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"X-Host": "127.0.0.1",
}

# This is planned to be replaced in the future: https://github.com/blacklanternsecurity/bbot/issues/1068
waf_strings = ["The requested URL was rejected"]

for qp in query_payloads:
Expand All @@ -83,8 +84,13 @@ class bypass403(BaseModule):

async def do_checks(self, compare_helper, event, collapse_threshold):
results = set()
error_count = 0

for sig in signatures:
if error_count > 3:
self.warning(f"Received too many errors for URL {event.data} aborting bypass403")
return None

sig = self.format_signature(sig, event)
if sig[2] != None:
headers = dict(sig[2])
Expand All @@ -95,6 +101,7 @@ async def do_checks(self, compare_helper, event, collapse_threshold):
sig[1], headers=headers, method=sig[0], allow_redirects=True
)
except HttpCompareError as e:
error_count += 1
self.debug(e)
continue

Expand Down Expand Up @@ -149,6 +156,7 @@ async def handle_event(self, event):
source=event,
)

# When a WAF-check helper is available in the future, we will convert to HTTP_RESPONSE and check for the WAF string here.
async def filter_event(self, event):
if ("status-403" in event.tags) or ("status-401" in event.tags):
return True
Expand Down

0 comments on commit d60f645

Please sign in to comment.