diff --git a/badsecrets/examples/cli.py b/badsecrets/examples/cli.py index 6138cf6..2bc1cc4 100755 --- a/badsecrets/examples/cli.py +++ b/badsecrets/examples/cli.py @@ -68,13 +68,17 @@ def report(self): elif severity == "INFO": severity_color = Fore.BLUE print_status(f"Severity: {self.x['description']['severity']}", color=severity_color) - print(f"Details: {self.x['details']}") + print(f"Details: {self.x['details']}\n") class ReportIdentify(BaseReport): def report(self): self.print_report( - print_status("Cryptographic Product Identified (no vulnerability)\n", color=Fore.YELLOW, passthru=True) + print_status( + "Cryptographic Product Identified (no vulnerability, or not confirmed vulnerable)\n", + color=Fore.YELLOW, + passthru=True, + ) ) if self.x["hashcat"] is not None: print_hashcat_results(self.x["hashcat"]) @@ -117,7 +121,7 @@ def validate_file(file): def print_hashcat_results(hashcat_candidates): print_status("\nPotential matching hashcat commands:\n", color=Fore.YELLOW) for hc in hashcat_candidates: - print(f"Module: [{hc['detecting_module']}] {hc['hashcat_description']} Command: [{hc['hashcat_command']}]") + print(f"Module: [{hc['detecting_module']}] {hc['hashcat_description']} Command: [{hc['hashcat_command']}]\n") def main(): diff --git a/badsecrets/modules/aspnet_vstate.py b/badsecrets/modules/aspnet_vstate.py index 343521d..b74d028 100644 --- a/badsecrets/modules/aspnet_vstate.py +++ b/badsecrets/modules/aspnet_vstate.py @@ -3,7 +3,7 @@ from badsecrets.base import BadsecretsBase from badsecrets.modules.aspnet_viewstate import ASPNET_Viewstate -# Reference: https://www.graa.nl/articles/2010.html +# Reference: https://blog.sorcery.ie/posts/higherlogic_rce/ class ASPNET_vstate(BadsecretsBase): @@ -11,7 +11,13 @@ class ASPNET_vstate(BadsecretsBase): description = {"product": "ASP.NET Compressed Vstate", "secret": "unprotected", "severity": "CRITICAL"} def carve_regex(self): - return re.compile(r" + + + +""" + + with requests_mock.Mocker() as m: + m.get( + f"http://multiplevulns.carve-all.badsecrets.com/", + status_code=200, + text=multiple_vuln_html, + ) + + res = requests.get(f"http://multiplevulns.carve-all.badsecrets.com/") + r_list = carve_all_modules(requests_response=res) + assert len(r_list) == 2 + + +def test_carve_empty_vstate(): + empty_vstate_html = """ +
+ + +""" + + with requests_mock.Mocker() as m: + m.get( + f"http://emptyvstate.carve-all.badsecrets.com/", + status_code=200, + text=empty_vstate_html, + ) + + res = requests.get(f"http://emptyvstate.carve-all.badsecrets.com/") + r_list = carve_all_modules(requests_response=res) + assert r_list + assert r_list[0]["product"] == "EMPTY '__VSTATE' FORM FIELD" diff --git a/tests/examples_cli_test.py b/tests/examples_cli_test.py index 3fe2586..d1b4460 100644 --- a/tests/examples_cli_test.py +++ b/tests/examples_cli_test.py @@ -184,7 +184,7 @@ def test_example_cli_vulnerable_headersidentifyonly(monkeypatch, capsys): "Data Cookie: [session=eyJ1c2VybmFtZSI6IkJib3RJc0xpZmUifQ==] Signature Cookie: [8BrG9wzvqxuPCtKmfgdyXXGGqA7]" in captured.out ) - assert "Cryptographic Product Identified (no vulnerability)" in captured.out + assert "Cryptographic Product Identified (no vulnerability, or not confirmed vulnerable)" in captured.out def test_example_cli_not_vulnerable_url(monkeypatch, capsys): @@ -213,7 +213,7 @@ def test_example_cli_identifyonly_url(monkeypatch, capsys): cli.main() captured = capsys.readouterr() print(captured) - assert "Cryptographic Product Identified (no vulnerability)" in captured.out + assert "Cryptographic Product Identified (no vulnerability, or not confirmed vulnerable)" in captured.out def test_example_cli_identifyonly_hashcat(monkeypatch, capsys):