r/linuxadmin • u/notsocleanA_hole • 2d ago
Incremental vuln scanning on Linux VMs: how do you avoid stale findings for files that were deleted?
We scan about 600 Linux VMs (mostly Ubuntu 22.04, some Amazon Linux 2023) with a snapshot-based scanner, full disk every 24h. Leadership wants every 6h, and cost roughly quadruples if we just shorten the interval, so I'm looking at incremental: only re-read what changed since the last run.
Speed is fine. What I can't figure out is how to keep the findings right. Two cases:
- Deleted files. Someone removes an old vendored binary (we had a static jq with known CVEs sitting in/opt). Nothing new gets written, so a scanner that only looks at modified files never revisits that path and the finding stays open. People already distrust our queue because of stale stuff like this.
- New CVEs on old packages. A library that hasn't changed in a year gets a CVE published today. If the scan only diffs files, does it get matched at all?
My current plan: keep a full package inventory per host, re-read the dpkg/rpm database every run, re-check every path that currently has a finding, diff the rest, and match the whole inventory against fresh vuln data each time. Upwind wrote up roughly this design this week, which made me think I'm not crazy, but I'd rather hear from people who actually run something like it.
Anyone doing incremental scanning in production? Did it ever disagree with a full scan of the same disk, and how often do you still force a full one?
16
u/PlannedObsolescence_ 2d ago
This is an LLM generated post from an engagement bait bot, not a human.
1
u/Unlucky-Sherbert795 2d ago
Your second point is the easy one if the matcher is separate from the collector. We keep an SBOM per host (syft, dumped to $3) and run grype against all of them nightly with no disk read at all, so a new CVE on an untouched lib shows up the next morning. Collection is where incremental gets risky. We still force a full scan weekly and the diff against incremental has been empty for months except once, when someone installed a deb with --force- depends and the status file didn't match what was on disk. Re-checking every path that already has a findings is the right call for deletes, that's exactly the gap we hit before we added it