fleet/server/vulnerabilities/nvd
RachelElysia 79a3549e67
Quick spelling/grammar fixes (#23859)
I noticed a spelling issue and a grammar issue and fixed similar ones
elsewhere in our docs

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->
2024-11-18 13:36:59 -06:00
..
sync Add gosimple linter (#23250) 2024-10-29 14:17:51 -05:00
tools Quick spelling/grammar fixes (#23859) 2024-11-18 13:36:59 -06:00
cpe.go Updating golangci-lint to 1.61.0 (#22973) 2024-10-18 12:38:26 -05:00
cpe_matching_rule.go Add gosimple linter (#23250) 2024-10-29 14:17:51 -05:00
cpe_matching_rule_test.go Migrate logic from nvdtools into Fleet (#18244) 2024-04-24 15:25:59 -07:00
cpe_matching_rules.go Python Vulnerability False Positive (#21493) 2024-08-23 11:59:25 -06:00
cpe_test.go Add cpe translation for macos vbox (#22082) 2024-09-13 10:57:50 -06:00
cpe_translations.go Custom Ubuntu Kernel Vuln Scanning (#19588) 2024-06-17 15:44:01 -06:00
cpe_translations.json Add cpe translation for macos vbox (#22082) 2024-09-13 10:57:50 -06:00
cve.go Updating golangci-lint to 1.61.0 (#22973) 2024-10-18 12:38:26 -05:00
cve_test.go fix: update test with new vulns (#23775) 2024-11-13 14:15:31 -05:00
db.go Migrate logic from nvdtools into Fleet (#18244) 2024-04-24 15:25:59 -07:00
indexed_cpe_item.go Custom Ubuntu Kernel Vuln Scanning (#19588) 2024-06-17 15:44:01 -06:00
README.md Custom Ubuntu Kernel Vuln Scanning (#19588) 2024-06-17 15:44:01 -06:00
sanitize.go Updating golangci-lint to 1.61.0 (#22973) 2024-10-18 12:38:26 -05:00
sanitize_test.go Add visual studio extensions to software inventory (#17501) 2024-03-14 16:33:12 -03:00
sync.go Don't panic on zero-length NVD description_data array fields (#21250) 2024-08-14 10:53:47 -05:00
sync_test.go Enable staticcheck Go linter. (#23487) 2024-11-05 11:16:24 -06:00
testing_utils.go Fixes various bugs with NVD vulnerability detection (#7963) 2022-10-04 07:04:48 -04:00

CPE Translations

CPE Translations are rules to address bugs when translating Fleet software to Common Platform Enumerations (CPEs) which are used to identify software in the National Vulnerability Database (NVD)

To improve accuracy when mapping software to CVEs, we can add data to cpe_translations.json

How CPE translations work

CPE Translations are defined in cpe_translations.json and currently released in GitHub once a day. The rules are specified in JSON format and and each rule consists of a software and a filter object.

software defines matching logic on what Fleet Software this rule should apply to. You can use one or more of the below attributes to match on. Each attribute is an array of string or regex matches (a regex string is identified by a leading and trailing /).
A match on the attribute is found if at least 1 item in the array matches. If multiple attributes are defined, then a match is needed for each attribute. (ie. name == Zoom.app && source == apps)

software attributes:

  • name: A software name attribute
  • bundle_identifier: A software bundle_identifier attribute (macOS only)
  • source: A software source attribute (ie. apps, chrome_extensions, etc...)

example: Search Fleet software for items that match: (bundle_identifier == us.zoom.xos) AND (source = apps)

"software": {
      "bundle_identifier": ["us.zoom.xos"],
      "source": ["apps"]
    }

If the software rule matches, then Fleet will search known NVD CPEs (stored in a local sqlite database) using the specified filters or skip the software item based on the filter specified.

filter attributes:

  • product: array of strings to search by product field
  • vendor: array of strings to search by vendor field
  • target_sw: array of strings to search by target_sw field
  • part: string to override the default "a" Part value
  • skip: boolean; software is skipped if true. This overrides any other filters set.

Like the software matching logic, filter items are matched by OR within the array, and AND between filter items

example: Query the CPE database for a CPE that matches: (product == zoom OR product == meetings) AND (vendor == zoom) AND (target == macos OR target == mac_os)

"filter": {
      "product": ["zoom", "meetings"],
      "vendor": ["zoom"],
      "target_sw": ["macos", "mac_os"]
    }

Testing CPE Translations (end-to-end)

  1. make the appropriate changes to cpe_translations

  2. host this file on a local web server

    go run ./tools/file-server/main.go 8082 ./server/vulnerabilities/nvd/
    
  3. (re)launch your local fleet server with one of the following

    Config method

    vulnerabilities:
    cpe_translations_url: "http://localhost:8082/cpe_translations.json"
    

    Environment method

    FLEET_VULNERABILITIES_CPE_TRANSLATIONS_URL="http://localhost:8082/cpe_translations.json" ./build/fleet serve --dev --dev_license --logging_debug
    
  4. trigger a vulnerabilities scan

    fleetctl trigger --name vulnerabilities