Generate correct CPE from malformed ipswitch whatsup CPE, ensure matches relevant CVEs (#41704)
**Related issue:** Resolves #32662 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/` - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Use CPE alias handling to generate correct CPE from malformed one, ensuring correct CVEs are matched. * **Tests** * Added comprehensive test coverage for the enhanced CPE alias expansion, including malformed CPE mapping scenarios and CVE matching validation for Ipswitch WhatsUp. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -0,0 +1 @@
|
||||
- Generate correct CPE from malformed ipswitch whatsup CPE, ensuring applicable CVEs are matched.
|
||||
@@ -606,6 +606,17 @@ func expandCPEAliases(cpeItem *wfn.Attributes) []*wfn.Attributes {
|
||||
}
|
||||
}
|
||||
|
||||
// The NVD CPE dictionary contains an invalid CPE for Ipswitch WhatsUp with product="whatsup",
|
||||
// but CVE-2006-2354 references product="whatsup_professional".
|
||||
// See https://github.com/fleetdm/fleet/issues/32662.
|
||||
for _, cpeItem := range cpeItems {
|
||||
if cpeItem.Vendor == "ipswitch" && cpeItem.Product == "whatsup" {
|
||||
cpeItem2 := *cpeItem
|
||||
cpeItem2.Product = "whatsup_professional"
|
||||
cpeItems = append(cpeItems, &cpeItem2)
|
||||
}
|
||||
}
|
||||
|
||||
// pgAdmin CVEs in NVD use target_sw=postgresql and product=pgadmin_4, but Fleet generates
|
||||
// CPEs with platform-based target_sw (macos, windows) and may use different product
|
||||
// names (pgadmin, pgadmin4). Add aliases with target_sw=postgresql and product name
|
||||
|
||||
@@ -453,6 +453,19 @@ func TestTranslateCPEToCVE(t *testing.T) {
|
||||
// },
|
||||
// continuesToUpdate: true,
|
||||
// },
|
||||
// Ensure malformed ipswitch whatsup cpe is successfully matched to CVE
|
||||
// See https://github.com/fleetdm/fleet/issues/32662.
|
||||
"cpe:2.3:a:ipswitch:whatsup:2006:-:professional:premium:*:*:*:*": {
|
||||
includedCVEs: []cve{
|
||||
{ID: "CVE-2006-2351"},
|
||||
{ID: "CVE-2006-2352"},
|
||||
{ID: "CVE-2006-2353"},
|
||||
{ID: "CVE-2006-2354"},
|
||||
{ID: "CVE-2006-2355"},
|
||||
{ID: "CVE-2006-2356"},
|
||||
{ID: "CVE-2006-2357"},
|
||||
},
|
||||
},
|
||||
// Tests the expandCPEAliases rule for virtualbox on macOS
|
||||
"cpe:2.3:a:oracle:virtualbox:7.0.6:*:*:*:*:macos:*:*": {
|
||||
includedCVEs: []cve{
|
||||
@@ -1247,6 +1260,14 @@ func TestExpandCPEAliases(t *testing.T) {
|
||||
python3130RC1Alias.Version = "3.13.0rc1"
|
||||
python3130RC1Alias.Update = ""
|
||||
|
||||
ipswitchWhatsup := &wfn.Attributes{
|
||||
Vendor: "ipswitch",
|
||||
Product: "whatsup",
|
||||
Version: "2006",
|
||||
}
|
||||
ipswitchWhatsupAlias := *ipswitchWhatsup
|
||||
ipswitchWhatsupAlias.Product = "whatsup_professional"
|
||||
|
||||
pgadminMacOS := &wfn.Attributes{
|
||||
Vendor: "pgadmin",
|
||||
Product: "pgadmin",
|
||||
@@ -1317,6 +1338,11 @@ func TestExpandCPEAliases(t *testing.T) {
|
||||
cpeItem: python3130RC1,
|
||||
expectedAliases: []*wfn.Attributes{python3130RC1, &python3130RC1Alias},
|
||||
},
|
||||
{
|
||||
name: "ipswitch whatsup alias",
|
||||
cpeItem: ipswitchWhatsup,
|
||||
expectedAliases: []*wfn.Attributes{ipswitchWhatsup, &ipswitchWhatsupAlias},
|
||||
},
|
||||
{
|
||||
name: "pgadmin on macos",
|
||||
cpeItem: pgadminMacOS,
|
||||
|
||||
Reference in New Issue
Block a user