feat(sbom): CVEs for FreeRTOS, lwIP, Mbed TLS and wolfSSL in firmware trees #351

Merged
sharang merged 1 commits from feat/firmware-cves into main 2026-09-23 15:13:10 +00:00
Owner

Pilot P1, item I (firmware components → CVEs). Stacked on #350.

Why

A microcontroller project vendors its RTOS, TCP/IP stack and TLS library as source. No manifest names them, so the SBOM never listed their versions and no CVE was matched against them. Yet that is where an embedded product's published vulnerabilities are.

What

  • pipeline/embedded_versions.rs reads the version from the header that states it, walking the whole tree including vendor directories:

    Library Header Macro NVD CPE
    FreeRTOS task.h tskKERNEL_VERSION_NUMBER amazon:freertos
    lwIP lwip/init.h LWIP_VERSION_MAJOR/MINOR/REVISION lwip_project:lwip
    Mbed TLS mbedtls/build_info.h (3.x), mbedtls/version.h (2.x) MBEDTLS_VERSION_STRING arm:mbed_tls
    wolfSSL wolfssl/version.h LIBWOLFSSL_VERSION_STRING wolfssl:wolfssl
    • Entries are recorded as package_manager = "embedded" with the library's license, so wolfSSL's GPL shows in license compliance.
    • They carry no purl; OSV has no ecosystem for them.
    • A similar macro name or a template placeholder (V@VERSION@) is not read as a version.
    • An unreadable file is skipped and does not end the walk.
  • pipeline/nvd_cpe.rs: the NVD range matching from the CODESYS match, made generic (NvdProduct { match_string, marker }). scan_codesys and the new scan_embedded share it and record_nvd.

    • The products are queried as cpe:2.3:*:vendor:product: NVD files FreeRTOS kernel CVEs under part o and its TCP/IP stack under a.
  • Scan: entries are added before the CVE stage (unless the same name and version is already listed) and matched in NVD after OSV, with a 120 s budget.

Verification

  • Against NVD (2026-09-23):
    • all four CPE names return CVEs (FreeRTOS 21 with the wildcard part, lwIP 3, Mbed TLS 51, wolfSSL 141);
    • a trimmed real FreeRTOS response is a unit-test fixture: 10.0.1 → 3 CVEs, 10.3.1 → 2, 10.5.1 → 1, 10.6.2 → 0.
  • Unit tests: header parsing for each library, placeholders and similar macros refused, detection in an STM32Cube layout (a second copy counted once, an unrelated init.h ignored), and product separation. 400 agent lib tests pass.
  • Full local nightly (bless, then compare on a second fresh DB):
    • new target fw-embedded-libs (FreeRTOS 10.3.1, lwIP 2.1.2, Mbed TLS 2.16.2; the headers hold only the version defines) → embedded:FreeRTOS@10.3.1, embedded:lwIP@2.1.2, embedded:Mbed TLS@2.16.2 and 49 CVEs, including FreeRTOS CVE-2021-31571/CVE-2024-28115 and lwIP CVE-2020-22283/22284;
    • no other baseline changed, including the CODESYS targets that now use the shared matcher.
  • clippy with the CI flags; fmt.

Notes

  • Duplicate listing: Firmwerk's analysis lists FreeRTOS without a version (library:FreeRTOS@), so a tree with a versioned header shows both rows. Merging them needs the firmware step and the scan step to share SBOM ownership; left for later.
  • NVD drift: this target's CVE baseline, like the CODESYS ones, changes when NVD publishes new CVEs; re-bless then.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Pilot P1, item I (firmware components → CVEs). **Stacked on #350.** ## Why A microcontroller project vendors its RTOS, TCP/IP stack and TLS library as source. No manifest names them, so the SBOM never listed their versions and no CVE was matched against them. Yet that is where an embedded product's published vulnerabilities are. ## What - **`pipeline/embedded_versions.rs`** reads the version from the header that states it, walking the whole tree including vendor directories: | Library | Header | Macro | NVD CPE | |---|---|---|---| | FreeRTOS | `task.h` | `tskKERNEL_VERSION_NUMBER` | `amazon:freertos` | | lwIP | `lwip/init.h` | `LWIP_VERSION_MAJOR/MINOR/REVISION` | `lwip_project:lwip` | | Mbed TLS | `mbedtls/build_info.h` (3.x), `mbedtls/version.h` (2.x) | `MBEDTLS_VERSION_STRING` | `arm:mbed_tls` | | wolfSSL | `wolfssl/version.h` | `LIBWOLFSSL_VERSION_STRING` | `wolfssl:wolfssl` | - Entries are recorded as `package_manager = "embedded"` with the library's license, so wolfSSL's GPL shows in license compliance. - They carry no purl; OSV has no ecosystem for them. - A similar macro name or a template placeholder (`V@VERSION@`) is not read as a version. - An unreadable file is skipped and does not end the walk. - **`pipeline/nvd_cpe.rs`:** the NVD range matching from the CODESYS match, made generic (`NvdProduct { match_string, marker }`). `scan_codesys` and the new `scan_embedded` share it and `record_nvd`. - The products are queried as `cpe:2.3:*:vendor:product`: NVD files FreeRTOS **kernel** CVEs under part `o` and its TCP/IP stack under `a`. - **Scan:** entries are added before the CVE stage (unless the same name and version is already listed) and matched in NVD after OSV, with a 120 s budget. ## Verification - **Against NVD (2026-09-23):** - all four CPE names return CVEs (FreeRTOS 21 with the wildcard part, lwIP 3, Mbed TLS 51, wolfSSL 141); - a trimmed real FreeRTOS response is a unit-test fixture: 10.0.1 → 3 CVEs, 10.3.1 → 2, 10.5.1 → 1, 10.6.2 → 0. - **Unit tests:** header parsing for each library, placeholders and similar macros refused, detection in an STM32Cube layout (a second copy counted once, an unrelated `init.h` ignored), and product separation. 400 agent lib tests pass. - **Full local nightly** (bless, then compare on a second fresh DB): - new target `fw-embedded-libs` (FreeRTOS 10.3.1, lwIP 2.1.2, Mbed TLS 2.16.2; the headers hold only the version defines) → `embedded:FreeRTOS@10.3.1`, `embedded:lwIP@2.1.2`, `embedded:Mbed TLS@2.16.2` and **49 CVEs**, including FreeRTOS CVE-2021-31571/CVE-2024-28115 and lwIP CVE-2020-22283/22284; - **no other baseline changed**, including the CODESYS targets that now use the shared matcher. - clippy with the CI flags; fmt. ## Notes - **Duplicate listing:** Firmwerk's analysis lists FreeRTOS without a version (`library:FreeRTOS@`), so a tree with a versioned header shows both rows. Merging them needs the firmware step and the scan step to share SBOM ownership; left for later. - **NVD drift:** this target's CVE baseline, like the CODESYS ones, changes when NVD publishes new CVEs; re-bless then. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang changed target branch from feat/finding-triage to main 2026-09-23 15:03:31 +00:00
sharang added 1 commit 2026-09-23 15:03:31 +00:00
feat(sbom): CVEs for FreeRTOS, lwIP, Mbed TLS and wolfSSL in firmware trees
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 9m22s
c08e8fb7f4
A microcontroller project vendors its RTOS, TCP/IP stack and TLS library
as source. No manifest names them, so no SBOM listed their versions and
no CVE was ever matched against them, although that is where the
published vulnerabilities of an embedded product are.

- embedded_versions: reads each library's version from the header that
  states it (tskKERNEL_VERSION_NUMBER, LWIP_VERSION_*,
  MBEDTLS_VERSION_STRING, LIBWOLFSSL_VERSION_STRING), vendor directories
  included, into SBOM entries (`embedded`, with the library's license).
- nvd_cpe: the NVD matching the CODESYS runtime used, made generic. Every
  CVE of a product is fetched by CPE and its affected ranges matched
  here. FreeRTOS kernel CVEs are filed under the `o` part and its TCP/IP
  stack under `a`, so the products are asked for with `cpe:2.3:*:`.
- The scan adds the entries before the CVE stage and matches them in NVD
  after OSV. The CODESYS match now uses the same code.

Verified against NVD: all four CPE names return CVEs; a trimmed real
FreeRTOS response is a unit-test fixture (10.0.1, 10.3.1, 10.5.1, 10.6.2).
Nightly target fw-embedded-libs (FreeRTOS 10.3.1, lwIP 2.1.2, Mbed TLS
2.16.2; version defines only) finds the three libraries and 49 CVEs;
no other baseline changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang force-pushed feat/firmware-cves from e25c26440a to c08e8fb7f4 2026-09-23 15:03:32 +00:00 Compare
sharang merged commit ff62bf4210 into main 2026-09-23 15:13:10 +00:00
Sign in to join this conversation.