Skip to content

Commit

Permalink
make severity mapper more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer committed Feb 8, 2024
1 parent 3610037 commit 3cc1c66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
12 changes: 4 additions & 8 deletions docs/content/en/integrations/parsers/file/wfuzz.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ The return code matching are directly put in Severity as follow(this is hardcode

HTTP Return Code | Severity
-----------------|---------
200 | High
301 | Low
302 | Low
401 | Medium
403 | Medium
404 | Medium
407 | Medium
500 | Low
200 - 299 | High
300 - 399 | Low
400 - 499 | Medium
>= 500 | Low
### Sample Scan Data
Sample Wfuzz JSON importer scans can be found [here](https://github.com/DefectDojo/django-DefectDojo/tree/master/unittests/scans/wfuzz).
23 changes: 11 additions & 12 deletions dojo/tools/wfuzz/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ class WFuzzParser(object):
A class that can be used to parse the WFuzz JSON report files
"""

# table to match HTTP error code and severity
SEVERITY = {
"200": "High",
"301": "Low",
"302": "Low",
"401": "Medium",
"403": "Medium",
"404": "Medium",
"407": "Medium",
"500": "Low"
}
# match HTTP error code and severity
def severity_mapper(self, input):
if 200 <= int(input) <= 299:
return "High"
elif 300 <= int(input) <= 399:
return "Low"
elif 400 <= int(input) <= 499:
return "Medium"
elif 500 <= int(input):
return "Low"

def get_scan_types(self):
return ["WFuzz JSON report"]
Expand All @@ -38,7 +37,7 @@ def get_findings(self, filename, test):
for item in data:
url = hyperlink.parse(item["url"])
return_code = str(item["code"])
severity = self.SEVERITY[return_code]
severity = self.severity_mapper(input=return_code)
description = f"The URL {url.to_text()} must not be exposed\n Please review your configuration\n"

dupe_key = hashlib.sha256(
Expand Down

0 comments on commit 3cc1c66

Please sign in to comment.