Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CVSSv4 support #166

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions docs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ describes the quantitative method used to calculate the associated `score`.
| --------- | ----------- |
| `CVSS_V2` | A CVSS vector string representing the unique characteristics and severity of the vulnerability using a version of the [Common Vulnerability Scoring System notation](https://www.first.org/cvss/v2/) that is == 2.0 (e.g.`"AV:L/AC:M/Au:N/C:N/I:P/A:C"`).|
| `CVSS_V3` | A CVSS vector string representing the unique characteristics and severity of the vulnerability using a version of the [Common Vulnerability Scoring System notation](https://www.first.org/cvss/) that is >= 3.0 and < 4.0 (e.g.`"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N"`).|
| `CVSS_V4` | A CVSS vector string representing the unique characteristics and severity of the vulnerability using a version of the [Common Vulnerability Scoring System notation](https://www.first.org/cvss/) that is >= 4.0 and < 5.0 (e.g.`"CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/S:X/AU:X/R:X/V:X/RE:X/U:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/CR:X/IR:X/AR:X/E:X"`).|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question:

https://www.first.org/cvss/v4.0/specification-document states:

"A vector string must contain metrics in the order shown in Table 23, every other ordering is invalid. All Base metrics must be included in a vector string."

The example vector string here doesn't seem to follow the order in table 23 of the spec. e.g. "Exploit Maturity (E)" is listed in the middle of the table, but is the last metric in the example vector string.

Am I reading the spec correctly here?

This seems different from CVSS 3.x (which states "A vector string should contain metrics in the order shown in Table 15, though other orderings are valid."). We had to remove our regex validation because of that (#168).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the reason you pointed out, we had to change the fixed ordering rule. Indeed, building a CVSS v4.0-compliant regular expression imply testing O(n!) combinations, and with 32 unique metrics... The regex would be Terrabytes long 😅

The documented CVSS v4.0 vector/string representation here is invalid as the group order is BTES, not BSTE. The valid vector must be CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X.

| Your quantitative severity type here. | [Send us a PR](https://github.com/ossf/osv-schema/compare). |

### severity[].score field
Expand Down
19 changes: 18 additions & 1 deletion validation/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@
"type": "string",
"enum": [
"CVSS_V2",
"CVSS_V3"
"CVSS_V3",
"CVSS_V4"
]
},
"score": {
Expand Down Expand Up @@ -328,6 +329,22 @@
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "CVSS_V4"
}
}
},
"then": {
"properties": {
"score": {
"pattern": "CVSS:4\\.[0-9]\\/AV:[NALP]\\/AC:[LH]\\/AT:[NP]\\/PR:[NLH]\\/UI:[NPA](\\/VC:[HLN]\\/VI:[HLN]\\/VA:[HLN]\\/SC:[HLN]\\/SI:[HLN]\\/SA:[HLN])?\\/S:[XNP]\\/AU:[XNY]\\/R:[XAUI]\\/V:[XDC]\\/RE:[XLMH]\\/U:[XCGAR]\\/MAV:[XNALP]\\/MAC:[XLH]\\/MAT:[XNP]\\/MPR:[XNLH]\\/MUI:[XNPA]\\/MVC:[XHLN]\\/MVI:[XHLN]\\/MVA:[XHLN]\\/MSC:[XHLN]\\/MSI:[XSHLN]\\/MSA:[XSHLN]\\/CR:[XHML]\\/IR:[XHML]\\/AR:[XHML]\\/E:[XAPU]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment re ordering here. We also need to make sure the metrics listed as optional in the spec are actually optional here (per table 23 in https://www.first.org/cvss/v4.0/specification-document).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using the official regular expression that is fully compliant with the specification here.

}
}
}
}
],
"required": [
Expand Down