From 235a79eeaaae7ea077032733499bfc20427d2dba Mon Sep 17 00:00:00 2001 From: jacobshandling <61553566+jacobshandling@users.noreply.github.com> Date: Mon, 16 Mar 2026 14:17:47 -0700 Subject: [PATCH] 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 ## 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. --- changes/32662-include-correct-cpe | 1 + server/vulnerabilities/nvd/cve.go | 11 +++++++++++ server/vulnerabilities/nvd/cve_test.go | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 changes/32662-include-correct-cpe diff --git a/changes/32662-include-correct-cpe b/changes/32662-include-correct-cpe new file mode 100644 index 0000000000..437f8c9658 --- /dev/null +++ b/changes/32662-include-correct-cpe @@ -0,0 +1 @@ +- Generate correct CPE from malformed ipswitch whatsup CPE, ensuring applicable CVEs are matched. \ No newline at end of file diff --git a/server/vulnerabilities/nvd/cve.go b/server/vulnerabilities/nvd/cve.go index 6c6d0ddfdb..fa3dc95264 100644 --- a/server/vulnerabilities/nvd/cve.go +++ b/server/vulnerabilities/nvd/cve.go @@ -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 diff --git a/server/vulnerabilities/nvd/cve_test.go b/server/vulnerabilities/nvd/cve_test.go index b2fe3b86a4..b8ccf463f8 100644 --- a/server/vulnerabilities/nvd/cve_test.go +++ b/server/vulnerabilities/nvd/cve_test.go @@ -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,