Skip to content
Open
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
2 changes: 1 addition & 1 deletion vulnerabilities/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_exploitability_level(exploits, references, severities):
exploit_level = 2
break

elif references:
if exploit_level == 0.5 and references:
# PoC/Exploit script published
for reference in references:
if reference.reference_type == VulnerabilityReference.EXPLOIT:
Expand Down
31 changes: 31 additions & 0 deletions vulnerabilities/tests/test_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,37 @@ def test_exploitability_level(
assert get_exploitability_level(None, None, None) == 0.5


@pytest.mark.django_db
def test_exploitability_level_with_exploit_reference_and_severities(vulnerability_with_exploit_ref):
"""
A published exploit reference marks the vulnerability as exploitable even
when the vulnerability also carries severities that do not indicate a high
EPSS score.
"""
severities = vulnerability_with_exploit_ref.severities.all()
references = vulnerability_with_exploit_ref.references.all()

# Severities are present, but none of them is a high EPSS score.
assert list(severities) == []

severity = VulnerabilitySeverity.objects.create(
url="https://nvd.nist.gov/vuln/detail/CVE-xxxx-xxxx2",
scoring_system=EPSS.identifier,
value="0.10",
scoring_elements="0.75",
)
vulnerability_with_exploit_ref.severities.add(severity)

assert (
get_exploitability_level(
exploits=None,
references=references,
severities=vulnerability_with_exploit_ref.severities.all(),
)
== 1
)


@pytest.mark.django_db
def test_get_weighted_severity(vulnerability):
severities = vulnerability.severities.all()
Expand Down