Skip to content

Commit

Permalink
fix codecoverge by adding a test for when the body have two versions …
Browse files Browse the repository at this point in the history
…that match the version pattern
  • Loading branch information
ybadaoui-ostorlab committed Oct 15, 2024
1 parent a121edd commit 1e3084b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/exploits/cve_2024_9487_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,27 @@ def testCVE20249487_whenVersionVeryOld_reportFinding(
"http://localhost:80 is vulnerable to CVE-2024-9487, "
"GITHUB ENTERPRISE SERVER AUTHENTICATION BYPASS"
)


def testCVE20249487_whenMultiVersions_doNotCrash(
requests_mock: req_mock.mocker.Mocker,
) -> None:
"""CVE_2024_9487 unit test: case when target is vulnerable."""
requests_mock.get(
"http://localhost:80/",
text="""
<div class="d-flex flex-justify-center py-2">
<span class="f6 color-fg-muted">GitHub Enterprise Server 3.14.2</span>
<span class="f6 color-fg-muted">GitHub Enterprise Server 3.14.3</span>
</div>
""",
status_code=200,
)
exploit_instance = cve_2024_9487.CVE20249487Exploit()
target = definitions.Target("http", "localhost", 80)

accept = exploit_instance.accept(target)
vulnerabilities = exploit_instance.check(target)

assert accept is True
assert len(vulnerabilities) == 0

0 comments on commit 1e3084b

Please sign in to comment.