146 lines
8.2 KiB
Markdown
146 lines
8.2 KiB
Markdown
# Tools & Scanners
|
|
|
|
Prüfwerk uses a combination of open-source scanners and AI-powered analysis to provide comprehensive security coverage. This page describes each tool and how it contributes to the scan pipeline.
|
|
|
|
## Semgrep -- Static Analysis (SAST)
|
|
|
|
[Semgrep](https://semgrep.dev/) is an open-source static analysis tool that finds vulnerabilities by matching patterns in source code. It supports many languages and has an extensive rule library.
|
|
|
|
Prüfwerk runs Semgrep with its public `auto` ruleset plus its own CRA rules
|
|
for controls no off-the-shelf rule covers (secure defaults, weak password
|
|
hashing, insecure session cookies, weak ciphers for data at rest).
|
|
|
|
Semgrep produces **Codeanalyse (SAST)** findings with file paths, line numbers, and rule descriptions.
|
|
|
|
## cppcheck -- C and C++ Analysis
|
|
|
|
[cppcheck](https://cppcheck.sourceforge.io/) runs on trees with C or C++ code.
|
|
Where Semgrep matches patterns, cppcheck follows values through the code, which
|
|
finds the defects that matter in firmware: out-of-bounds writes, uninitialised
|
|
reads, null dereferences and leaks. It parses the code and never runs it. Its
|
|
findings are **Codeanalyse (SAST)** findings with the tool name `cppcheck`.
|
|
|
|
## Vendor Code Exclusion
|
|
|
|
Firmware projects carry their silicon vendor's SDK (HAL, CMSIS, board support)
|
|
and third-party middleware next to their own code. Findings in that code are not
|
|
yours to fix, so it is left out of the code findings (SAST, patterns, secrets,
|
|
lint). What counts as vendor code:
|
|
|
|
- directories named `CMSIS`, `Third_Party`, `vendor` (and similar), or ending in
|
|
`_HAL_Driver` / `_StdPeriph_Driver`;
|
|
- ST's generated layouts (`Drivers/` next to `Core/`, `Middlewares/`);
|
|
- a vendored library wherever it sits, recognised by the files it always ships
|
|
(Mbed TLS, lwIP, the FreeRTOS kernel, wolfSSL, FatFs).
|
|
|
|
Your own `src/drivers/` is not excluded. The scan run lists the excluded
|
|
directories under **Nicht ausgeführt** as **Herstellercode (HAL, CMSIS,
|
|
Drittanbieter)**. The excluded code stays in the SBOM and is checked for known
|
|
vulnerabilities.
|
|
|
|
## Syft -- SBOM Generation
|
|
|
|
[Syft](https://github.com/anchore/syft) is an open-source tool for generating Software Bills of Materials. It scans your repository and identifies every dependency, including:
|
|
|
|
- Package name and version
|
|
- Package manager (npm, cargo, pip, go, maven, nuget, composer, gem)
|
|
- License information
|
|
|
|
Syft output feeds into both the SBOM feature and the vulnerability scanning pipeline.
|
|
|
|
## Embedded Library Versions
|
|
|
|
Libraries copied into a firmware tree have no manifest Syft could read.
|
|
Prüfwerk recognises **FreeRTOS**, **FreeRTOS+TCP**, **lwIP**, **Mbed TLS**,
|
|
**wolfSSL** and **FatFs** and reads each version from the library's own header
|
|
(for example `task.h`, `FreeRTOS_IP.h`, lwIP's `init.h`, `ff.h`). They are added
|
|
to the SBOM with the package source `embedded` and matched against NVD by CPE.
|
|
|
|
## OSV.dev + NVD -- Vulnerability Matching
|
|
|
|
Prüfwerk matches every SBOM component directly against two public vulnerability sources (no separate scanner binary):
|
|
|
|
- [OSV.dev](https://osv.dev/) -- batch queried by package URL (purl) for ecosystem advisories (npm, PyPI, crates.io, Go, Maven, ...)
|
|
- [NVD](https://nvd.nist.gov/) -- queried per CVE for the CVSS v3.1 base score, and by CPE for components outside a package ecosystem: the CODESYS runtime found in PLC projects and the embedded libraries above. All CVEs of the product are fetched and their affected version ranges compared with the version in use.
|
|
|
|
Matches are stored as CVE alerts with CVSS scores and re-checked hourly, so newly published CVEs against an unchanged dependency still raise a notification.
|
|
|
|
## Custom OAuth Scanner
|
|
|
|
A purpose-built scanner that detects OAuth and OIDC misconfigurations in your code, including:
|
|
|
|
- Missing state parameter validation
|
|
- Insecure token storage
|
|
- Incorrect redirect URI handling
|
|
- Missing PKCE implementation
|
|
- Token exposure in logs or URLs
|
|
|
|
## Custom GDPR Scanner
|
|
|
|
A scanner focused on data protection compliance, detecting:
|
|
|
|
- Personal data handling without consent checks
|
|
- Missing data retention policies
|
|
- Unencrypted PII storage
|
|
- Cross-border data transfer issues
|
|
|
|
## gitleaks -- Secrets
|
|
|
|
[gitleaks](https://github.com/gitleaks/gitleaks) finds hardcoded secrets and
|
|
credentials: API keys, tokens, private keys, passwords. On a git checkout it
|
|
runs `gitleaks detect`, which also looks through the repository's history; on an
|
|
uploaded archive, which has no history, it scans the files with `gitleaks dir`.
|
|
Its findings have the type **Zugangsdaten im Code** (Secrets); the dashboard
|
|
shows the secret shortened.
|
|
|
|
## PLC Control-Logic Analyser
|
|
|
|
Prüfwerk's own analyser for IEC 61131-3 programs. It parses Structured Text
|
|
(`.st`, `.scl`, `.exp`) and PLCopen XML projects, including graphical FBD/LD,
|
|
and runs CWE-mapped security rules over them, for example hardcoded credentials,
|
|
safety interlock or watchdog bypass, unchecked array indexing and insecure
|
|
protocol ports. Its findings have the type **SPS-Steuerungslogik**. See
|
|
[SPS / PLC (CODESYS)](/guide/plc).
|
|
|
|
## LLM-Powered Code Review
|
|
|
|
For pull-request reviews, Prüfwerk uses an LLM to review the changed code in several passes. A regular scan does not run it, and PR reviews need webhooks, which are not available in this release (see [Webhooks & PR Reviews](/guide/webhooks)). The review looks for issues too nuanced for static rules, such as:
|
|
|
|
- Business logic flaws
|
|
- Race conditions
|
|
- Improper error handling that leaks information
|
|
- Insecure design patterns
|
|
|
|
Code review findings are marked with the **Code Review** type.
|
|
|
|
## LLM-Powered Triage
|
|
|
|
Every new finding a scan stores -- regardless of which scanner produced it -- goes through AI triage. Here is how it works:
|
|
|
|
1. **Context gathering** -- the triage engine collects the finding details, about 50 lines of surrounding code, and information from the code knowledge graph (what calls this code, what it calls, how it connects to entry points)
|
|
|
|
2. **Severity assessment** -- the LLM evaluates the finding considering:
|
|
- The vulnerability type and its typical impact
|
|
- The specific code context (is this in a test file? behind authentication? in dead code?)
|
|
- The blast radius -- how many entry points and call chains are affected, based on the code graph
|
|
|
|
3. **Confidence scoring** -- the LLM assigns a confidence from 0 to 10. It is lowered for findings in test, example, generated or vendored files. A finding the LLM dismisses, or does not confirm with a confidence of at least 3, is set to **Zu prüfen** (needs review); it is never deleted
|
|
|
|
4. **Rationale generation** -- the LLM writes a human-readable explanation of why it assigned the severity and confidence it did
|
|
|
|
5. **Remediation guidance** -- where it can, the LLM writes a short remediation
|
|
|
|
::: tip
|
|
The AI triage is a starting point, not a final verdict. Always review the rationale and code evidence before acting on a finding. See [Understanding Findings](/guide/findings#human-in-the-loop) for more on the human-in-the-loop workflow.
|
|
:::
|
|
|
|
## Planned integrations (decided 2026-08-31, not yet in the code)
|
|
|
|
The product spec keeps an **OSS-only** tooling policy and a control-mapping rule of *tools detect, the LLM judges*. Two deterministic detectors are therefore being added **underneath** the agentic DAST/pentest layer — the agents stay on top for context-seeded exploitation, chaining and explanation:
|
|
|
|
| Tool | Role | Status |
|
|
|------|------|--------|
|
|
| [Nuclei](https://github.com/projectdiscovery/nuclei) | Template-driven checks (CVE probes, default credentials, exposed panels, misconfigurations) including ICS/OT templates for WebVisu / OpenPLC / HMI endpoints. Runs as a DAST phase and as a Werkbank job with vendored templates so it works on-prem. | Planned — tracked as an issue |
|
|
| [OWASP ZAP](https://www.zaproxy.org/) | Baseline (passive) and, behind the destructive-tests flag, active scan for reproducible spider + rule coverage; results seed the pentest agent. | Planned — follows Nuclei |
|
|
|
|
Both feed the same `control-map` lookup table as Semgrep, so their findings receive compliance `control_refs` through the grounded judge. An **offline vulnerability database** (Trivy preferred, Grype as alternative) is planned for the on-prem Werkbank runner, which cannot reach the OSV.dev / NVD APIs. Until these land, DAST findings come exclusively from the in-house agents described above. |