CVSS v4.0 scores computed from vector strings, following the FIRST CVSS v4.0 specification (section 8, "CVSS v4.0 Scoring").
The vector is mapped to a macrovector (equivalence sets EQ1 to EQ6), whose
score is looked up and then lowered by the mean proportional distance of
the vector from the highest severity vectors of its macrovector. Threat
(E) and Environmental metrics (CR, IR, AR, MAV, ...) are applied
when present, so CVSS-B, CVSS-BT, CVSS-BE and CVSS-BTE vectors are
all scored; absent or X values take the worst case (E:A, CR:H, ...)
or the base value. Supplemental metrics do not affect the score.
Every metric name and value stays a string, so vectors from feeds never create atoms.
Summary
Functions
The macrovector of a v4.0 vector: the levels of EQ1 to EQ6 as a string of
six digits, or nil when the vector is not valid.
Metric names and the values they accept (base metrics first).
Computes the score of a CVSS v4.0 vector, or nil when the string is not
a valid v4.0 vector (missing or repeated metric, unknown metric or value).
Functions
The macrovector of a v4.0 vector: the levels of EQ1 to EQ6 as a string of
six digits, or nil when the vector is not valid.
iex> VulnCheck.Feeds.CVSS.V4.macrovector("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N")
"000200"
@spec metrics() :: {%{required(String.t()) => [String.t()]}, %{required(String.t()) => [String.t()]}}
Metric names and the values they accept (base metrics first).
Computes the score of a CVSS v4.0 vector, or nil when the string is not
a valid v4.0 vector (missing or repeated metric, unknown metric or value).
iex> VulnCheck.Feeds.CVSS.V4.score("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H")
10.0
iex> VulnCheck.Feeds.CVSS.V4.score("CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N")
0.0
iex> VulnCheck.Feeds.CVSS.V4.score("CVSS:4.0/AV:N")
nil