Back Shattered Vulnerability Management in Python: 12 Steps, 90 Min [2026]
Patching everything is not a plan, and sorting by CVSS alone is barely better. CISA added an actively exploited, unauthenticated flaw in Ivanti Connect Secure (CVE-2026-104935) to its Known Exploited Vulnerabilities catalog on October 13, 2026 , put BeyondTrust Remote Support (CVE-2026-102764) on the list three days later, and added two PHP flaws (CVE-2026-109618 and CVE-2026-109619) on October 26. Four CVEs in two weeks, and each one belongs at the top of the queue no matter what else a scanner flagged that week.
A working vulnerability management program answers three questions every finding. Is anyone exploiting it? How likely is exploitation soon? How much damage follows if it lands on this particular asset? Python’s standard library can answer all three with no paid scanner and no third-party packages. The project below, a tool called vmp , scans a dependency inventory against OSV, enriches each hit with CISA KEV status, EPSS probability and a locally computed CVSS score, then assigns a priority tier and a deadline. Anyone still weighing CVSS against the KEV catalog gets the argument settled in code: both feed the decision, and neither decides alone.
The build takes 90 minutes, runs on a laptop, and ends with 6 passing unit tests, a SQLite database that tracks service-level deadlines, a risk-exception workflow and a CI gate that fails the build when a top-priority finding goes overdue.
Don't miss new tech stories on Google
Add Shattered once in the Google app and our stories show up in your news suggestions.
Why Vulnerability Management Fails When CVSS Is the Only Input
Scanners are good at finding things and bad at ranking them. A mid-sized Python service with a few years of unpatched dependencies can produce hundreds of advisories in one run. The sample inventory used later in this build returned 118 distinct findings from just four packages. Sorting that pile by CVSS base score puts the loudest severities first, but a base score describes how bad a flaw could be under worst-case assumptions. It says nothing whether an attacker has bothered to use it.
CISA itself stopped treating severity as the whole story. Its CISA Vulnerability Review framework, published on August 26, 2026, evaluates exposure status, KEV status, potential for automated exploitation and technical impact together. That is four inputs, and only the last one resembles a CVSS score. The agency’s own KEV catalog page states the intent plainly: “Organizations should use the KEV catalog as an input to their vulnerability management prioritization framework.” The word is input, not verdict.
Another shift makes local scoring more useful than it was a year ago. NIST now prioritizes National Vulnerability Database enrichment for CVEs in the KEV catalog, targeting one business day, along with flaws in software used by the U.S. federal government. Everything else can wait, and NVD records may sit incomplete without the CVSS data many tools expect. A pipeline that depends only on NVD scores will therefore see gaps exactly where a long tail of lower-profile packages live. The design here pulls severity from the OSV record itself, computes the base score from the vector string, and falls back to the advisory database’s own severity label when no usable vector exists.
Asset context is the last missing piece. A remote-code-execution bug in a library that runs on an internet-facing billing API is a different problem from the same bug in a batch job that never accepts outside traffic. Scanner output rarely carries that distinction, so the inventory file in this project records exposure, criticality and owner for every asset, and the policy engine uses them.
Prerequisites and Versions
The project uses only the Python standard library, so there is nothing to install beyond the interpreter. Python 3.15.2 is the latest stable release as of late October 2026, and it shipped in the same security release cycle as updates for 3.14, 3.13, 3.12 and 3.11. Those updates addressed trust of compromised eMudhra intermediate certificate authority keys, which matters for a tool whose whole job is making HTTPS calls to government and research feeds. Python 3.10 reached end of life on October 1, 2026, so do not build a new scanner on it. Python 3.16.0a1, the first alpha of the release, is a preview only and has no place in a security tool.
Budget 90 minutes for a first pass. The code itself runs to roughly 500 lines including tests. Most of the time goes to getting a realistic inventory together, which is the step most teams underestimate. If you only want a feed watcher that alerts on new KEV entries, the shorter CISA KEV tracker build covers that narrower job. The project here goes further by tying the feed to your own software and tracking deadlines.
One scope note up front. OSV answers the question “which advisories affect this package at this version” for language ecosystems such as PyPI, npm, Go, Maven, NuGet, crates.io and RubyGems. It does not know a VPN appliance or a remote-support server you installed from a vendor download. Those need a separate path, which the advanced-tips section covers with a short KEV vendor matcher.
How CISA KEV, EPSS and CVSS Work Together
Each signal answers a different question, and each fails in a different way. Treating them as three votes on one scale is the most common design error in homegrown prioritization scripts.
KEV is the strongest signal because it records fact. FIRST’s EPSS adds a forward-looking estimate, and the project’s policy treats a high EPSS score as nearly as urgent as confirmed exploitation. FIRST announced a model and backend refresh in June 2026 and credited Empirical Security for staffing, support and hosting. Reports describe the refresh as EPSS version 2026.06.15, with improved GitHub exploit-code detection and VulnCheck KEV data among the changes. The practical effect: scores computed before that date are not directly comparable with scores after it, so the database stores whatever EPSS value was current at each scan instead of treating an old number as permanent.
CVSS now comes in two live flavors. CISA’s October 2026 industrial-control advisories list both a CVSS 3.1 vector and a CVSS 4.0 vector for the same flaw. Version 4.0 vectors begin with CVSS:4.0/ and use a different metric set, so a v3.1 formula cannot score them. The code in step 7 therefore computes v3.x scores itself and falls back to the advisory’s severity label when only a v4.0 vector is present. A public score calculator is not needed, and the arithmetic is short enough to read in one sitting.
The decision-making side matters as much as the scoring. The policy in this build follows a simple logic: exploitation evidence and likelihood come first, severity breaks ties, and the asset’s exposure sets the urgency.
Federal policy leans the same way. According to CISA’s October 26, 2026 alert, Binding Operational Directive 26-04 requires Federal Civilian Executive Branch agencies to prioritize KEVs on publicly exposed assets that could provide total control after exploitation. Readers tracking how BOD 26-04 changed KEV remediation deadlines will recognize the logic behind the three-day P0 clock below. Private teams owe no one that deadline, but borrowing the shape of it gives an engineering manager a defensible starting point.
Collect: Build the Inventory and Query OSV (Steps 1 to 4)
Step 1: Create the project skeleton
Make a directory, confirm the interpreter version and create the package folders. No virtual environment is required because nothing gets installed, though one does no harm.
Expected output from the version check on a current install:
Any recent 3.x interpreter works for the code. The pitfall here is naming. Do not call a module http.py or json.py inside the package. Run such a file directly and Python puts its folder first on the import path, so the file shadows the standard library module and urllib breaks with a baffling import error. The HTTP helper below is called net.py for that reason.
Step 2: Write the asset inventory
The inventory is the foundation. Every later score depends on three columns most scanners never ask for: exposure , criticality and owner . Use the value internet for anything reachable from outside your network and internal for everything else. Use high , medium or low for business criticality.
The four sample rows are deliberately old versions so the first scan has something to find. For a real service, generate the rows from your lock file. Running pip freeze and reshaping its output into this CSV takes a dozen lines, and the same idea works for package-lock.json or go.sum . , the loader that validates the file:
The loader fails loudly on a missing column or an unknown ecosystem name. That choice is intentional. A silently skipped row is a package nobody is scanning, and an unscanned package is the failure mode this whole program exists to remove.
Step 3: Add a resilient HTTP helper
Three public services will get called many times, so the helper retries on rate limits and transient server errors with exponential backoff. It sends a descriptive User-Agent, which public APIs appreciate, and it decodes JSON for both GET and POST calls.
The retry list covers HTTP 429 (too many requests) and the 5xx family. A 404 or 400 raises immediately because retrying a malformed request only wastes time. After four attempts the final exception propagates, which means a scan that cannot reach a feed fails visibly instead of producing a report built on half the data.
Step 4: Query OSV for advisories
OSV accepts a batch of package, ecosystem and version triples and returns the advisory IDs that apply to each. A second call per ID returns the full record, including aliases (the CVE IDs), the severity vector, a summary and the fixed versions. The first half of feeds.py wraps both calls and caches record lookups in memory.
Check the wiring with a one-off call against the oldest package in the sample inventory:
Sixty-six advisory IDs for one old Django release looks alarming, and it is partly an illusion. OSV merges several databases, so one underlying CVE often shows up under a GitHub advisory ID and again under a PyPI advisory ID. The scan loop in step 10 collapses those duplicates, which cut the sample run from 204 raw rows to 118 real findings.
Enrich: Add KEV, EPSS and CVSS (Steps 5 to 7)
Step 5: Load the CISA KEV feed
CISA publishes the catalog as a JSON file. Each entry carries the CVE ID, vendor, product, the date added, a required action, a due date and a flag called knownRansomwareCampaignUse . The method below indexes entries by CVE ID for constant-time lookups. For a narrower alerting tool that only watches the feed, a feed-diffing script is the better fit than this scoring pipeline.
Verify the download and the lookup. Use a well-known CVE that affects a package you track as a test case:
The ransomware flag matters more than it looks. Entries marked Known have been tied to ransomware campaigns, and the policy engine promotes those to the top tier even on internal assets, because lateral movement inside a network is how ransomware crews turn one foothold into a business-stopping event.
Step 6: Pull EPSS probabilities
FIRST serves EPSS through a plain REST endpoint that accepts a comma-separated CVE list. Each row returns the probability of exploitation activity over the 30 days and a percentile that ranks the CVE against all others. The method chunks requests at 50 CVEs so URLs stay short.
The output is a dictionary of (probability, percentile) tuples, one entry per CVE you asked . Your numbers will differ from any earlier run because EPSS scores are dynamic and change over time.
A brand-new CVE may have no EPSS row at all for a day or two. The scan loop treats a missing score as unknown, not as zero, and the report prints n/a . Silent zeros are a quiet way to under-rank the newest and often the most dangerous disclosures.
Step 7: Compute CVSS base scores locally
OSV records usually carry a vector string rather than a number. The CVSS 3.x specification defines the arithmetic, and it fits in 40 lines. The one subtle piece is the round-up function: CVSS 3.1 rounds up to one decimal place with a guard against floating-point noise, and a plain round() call produces wrong scores in a fraction of cases.
Test it against vectors with known answers, such as the standard worst-case examples:
The fallback path matters as much as the calculator. When a record only has a CVSS 4.0 vector, best_score returns the GitHub-style severity label mapped to a representative number, one value each for critical, high, moderate or medium, and low. Those mapped values are rough midpoints chosen for tiering, not official scores, and the report shows them with the same one-decimal format. Treat them as a bucket, not a measurement.
Decide and Track: Policy, SQLite and the Scan Loop (Steps 8 to 10)
Step 8: Encode the priority policy
The policy fits in one small function, which is the point. A rule nobody can read is a rule nobody can defend in an audit or argue with in a planning meeting. Four tiers cover most organizations, each with a deadline in days.
High-criticality assets move up one tier when they would otherwise land in P2 or P3. The deadlines and thresholds are defaults I chose for illustration, not an industry standard. Change them to match your risk appetite, but change them in this one file. A three-day P0 clock echoes the short federal windows attached to cases like the ScreenConnect flaw that drew a quick CISA deadline , and it keeps the top of the queue small enough to actually finish.
Note the order of the conditions. KEV is checked before EPSS, and EPSS before CVSS. A flaw with a severity of 9.8, no KEV entry and a low EPSS score lands in P2, not P1, which surprises people the first time. That placement is deliberate: a critical-looking bug that nobody exploits in the 30-day window should not outrank a medium-severity bug that is under active attack.
Step 9: Store findings and deadlines in SQLite
The database holds one row per asset, package, version and CVE. Three behaviors make it more than a log file. First, the first-seen date and the deadline survive rescans. Second, a deadline can tighten but never relax: if a flaw is added to KEV after its first appearance, the new three-day or fourteen-day clock replaces the old one, but a falling EPSS score cannot push the date back out. Third, a finding that disappears from the scan closes automatically, and one that reappears reopens with a fresh clock.
The accept function records a time-boxed risk exception with a note. An accepted finding stays accepted across rescans until its expiry date passes, at which point the scan flips it back to open. Exceptions that never expire are how risk registers rot, so the schema makes an expiry date mandatory at the command line.
Step 10: Wire the scan loop together
The orchestration module runs the whole sequence: query OSV in batches, fetch each unique advisory once, collect CVE aliases, load KEV, request EPSS for every CVE seen, then classify and store every finding. The deduplication logic keys each finding on asset, package, version and CVE, so the same flaw reported under three advisory names counts once.
When an advisory lists several CVE aliases, the code prefers one that appears in KEV, then falls back to the first alias alphabetically. The EPSS value is the highest across all aliases, which errs toward over-ranking instead of missing a signal. The ransomware flag comes straight from the KEV entry, and the fixed-version string is pulled from the OSV affected ranges, filtered to the package in question so one advisory covering several packages does not leak the wrong fix.
Operate: CLI, Exceptions, Tests and a CI Gate (Steps 11 and 12)
Step 11: Build the report and the command line
The report module sorts open findings by tier, then deadline, then asset, and renders Markdown that pastes cleanly into a ticket or wiki page. It also defines overdue , which returns open P0 and P1 findings past their due date.
The command-line module exposes four verbs: scan refreshes the database, report prints or writes the Markdown table, gate exits with status 1 when anything top-priority is overdue, and accept records an exception.
Step 12: Test it, then schedule it
Six unit tests cover the CVSS calculator, the fallback to severity labels, every branch of the policy function, the full scan-close-gate cycle, the never-relax deadline rule, and the exception expiry. They run against a fake feed object, so they work offline and finish in milliseconds.
A daily cron entry is the simplest scheduler. Keep the database on a durable disk, run the scan, then run the gate so a nonzero exit code triggers whatever alerting your host already has.
Teams that prefer pipelines can run the same commands in CI. The sketch below fails the job when a P0 or P1 finding is overdue. Pin each action to its current major version when you copy it, because those move over time.
CI runners start clean, which makes this workflow lose its history unless the state folder persists somewhere. Without persistence every run looks like the first one, deadlines reset and the gate never fires. Store the database on a dedicated branch, in an object store or on a long-lived host. For that reason, a plain cron job on a small server is often the better for the authoritative database, with CI reserved for pull-request checks.
Final Project Layout and Run Order
The finished tree is small enough to keep in a single repository:
Run the commands in this order on day one:
python3 -m unittest discover -s tests to confirm the code is sound.
python3 -m vmp --db state/vmp.db scan --inventory inventory.csv to build the first snapshot.
python3 -m vmp --db state/vmp.db report --out report.md to read the ranked list.
python3 -m vmp --db state/vmp.db gate to see whether anything is already overdue.
python3 -m vmp --db state/vmp.db accept KEY --until YYYY-MM-DD --note REASON for findings you will consciously defer.
On my machine the first live scan of the four-package sample took 40 seconds, almost all of it spent fetching individual advisory records one at a time. Later scans cost the same until you add the on-disk cache from the advanced tips.
Sample Run: What the Output Looks Like
This is real output from a scan on October 28, 2026 against the sample inventory. EPSS values and advisory lists change daily, so expect your rows to differ.
Distribution by tier from that run: 22 findings in P1, 34 in P2 and 62 in P3, with no P0 because the one KEV hit sat on an internal asset. The top of the report looked like this:
Two rows deserve a second look. One CVE carries a high CVSS yet a low EPSS, and it sits in P1 only because the billing API is high criticality and the tier bump applied. Another has a lower severity but a higher EPSS, so it clears the 0.5 threshold on its own. That is the whole argument for blending signals: the lower CVSS score carried the higher likelihood.
The single KEV hit was on the internal report worker. The classifier put it in P1 with a 14-day clock. To see the gate fail, I back-dated its due date in the database and ran the gate:
Recording a time-boxed exception clears the gate until the expiry date:
Five Common Pitfalls That Skew Your Priorities
Reading CVSS as likelihood. A base score of 10.0 describes worst-case impact. It does not predict whether anyone will attack the flaw. The WSO2 API Manager case , where a maximum-severity score and the exploit timeline did not line up, shows how far a severity number can sit from real-world timing. Lead with KEV and EPSS, and let CVSS break ties.
Counting duplicate advisories. OSV merges multiple databases, so one CVE often appears under two or three IDs. Without deduplication the sample inventory showed 204 findings instead of 118, and every dashboard number inflated by roughly 70 percent. Key on the CVE, not the advisory ID.
Letting EPSS history stand in for today. EPSS values move daily, and the June 2026 refresh changed the model underneath. Store the score from each scan and avoid comparing numbers across the refresh date without a note.
Relaxing a deadline when a score falls. If a flaw tightens to P0 on Monday and its EPSS dips on Thursday, the deadline should not slide. Allowing deadlines to loosen invites gaming, deliberate or not. The store logic uses the earlier date every time.
Trusting a stale inventory. A scanner can only grade what it is told . Version drift between the CSV and production quietly voids the whole exercise. Regenerate the file from lock files or an SBOM on every release, and treat an asset with no owner as a finding in itself.
A sixth trap deserves a mention because it hits the scanner, not the targets. Running the tool on an end-of-life interpreter leaves the program that audits your patch levels unpatched itself. Python 3.10 left support on October 1, 2026, and the October 26 releases of 3.15, 3.14, 3.13, 3.12 and 3.11 fixed certificate-authority trust issues. Keep the host current.
Troubleshooting: 9 Problems and Fixes
HTTP 429 or 503 from a feed. The helper already retries four times with growing delays. If it still fails, run the scan less often, or cache advisory records on disk so repeat scans skip the detail calls.
SSL certificate verify failed. The host’s CA bundle is stale or a corporate proxy is intercepting traffic. Update system certificates and upgrade Python to the latest patch release. Never disable verification to make the error go away.
ValueError: unknown ecosystem. The inventory uses a name outside the mapped list. Use pypi , npm , go , maven , nuget , crates or rubygems , or extend the dictionary.
Every finding lands in P3. The exposure column probably holds a value other than the exact string internet . Check spelling and stray spaces. The loader lowercases and trims, but it cannot guess synonyms like public .
EPSS shows n/a for new CVEs. Very recent disclosures may not have a row yet. Rerun the day. Do not substitute zero.
sqlite3.OperationalError: database is locked. Two scans overlapped, usually a cron job plus a manual run. Serialize runs with flock in the crontab entry, or give each scheduler its own database copy.
The gate always exits 0. The deadlines may be in the future because the database is brand new. Confirm the host clock and time zone, and check that CI is persisting state/vmp.db between runs.
accept prints “no such finding key”. Keys contain pipe characters, so the shell needs them quoted. Copy the key from the database, wrap it in double quotes, and match asset, package, version and CVE exactly.
BrokenPipeError when piping output to head. Harmless. The reader closed the pipe early. Redirect to a file with --out if the message bothers you.
One more limitation to keep in mind: OSV’s batch endpoint can paginate results for packages with very large advisory lists, and this build reads only the first page. For the common case that is fine. If you scan an ancient package with a huge history, add handling for the continuation token.
Advanced Tips for a Production Program
Cover appliances and vendor software. OSV does not index a VPN gateway or a remote-support server, yet those are exactly where recent KEV additions landed, and the SonicWall SMA1000 zero-day flaws that carried a short federal deadline are another example. Keep a second CSV of appliances with vendor and product names, then match it against the KEV feed’s vendorProject and product fields:
The matcher returns a CVE and a due date, not a version verdict, because KEV entries carry no version data. A human then checks the vendor advisory. CISA’s BeyondTrust alert, for example, says supported versions 24.3.1 and later contain patches, so an appliance on an older release stays on the P0 list until it upgrades.
Cache advisory records on disk. A JSON file keyed by advisory ID, refreshed when OSV’s modified timestamp changes, cuts repeat scans from roughly 40 seconds to a few. Wrap the detail call in a thread pool of four to eight workers for a further cut, and respect the services’ rate limits.
Swap the CSV for an SBOM. CycloneDX and SPDX files already list package names and versions, so a short adapter can turn a build artifact into inventory rows. The exposure and criticality columns then come from a service catalog keyed by asset name.
Track mean time to remediate by tier. The SQLite schema already stores first-seen and close times. A query that groups closed P0 and P1 findings by month gives a number leadership understands, and it shows whether the three-day and fourteen-day clocks are realistic. When the numbers say a clock is routinely missed, fix the process before shortening the deadline.
Send alerts, not just reports. A webhook call on every new P0 finding gets attention that a Markdown file will not. Pair it with ticket creation so each finding has an owner and a link. When a new KEV entry like the Nextcloud Collabora flaw appears, the quickest question to answer is whether anything in the inventory is affected.
Add VEX statements. Vulnerability Exploitability eXchange documents state that a product is not affected by a given CVE even though a vulnerable component is present. Importing them suppresses false positives with a written justification, which is better than a silent ignore list.
Use outside viewers for sanity checks. Public explorers such as the CVE Explorer at cyber-defence.io show CVSS, EPSS and KEV status in a single view, which makes a handy cross-check on your own scores. Directories such as Firecrawl’s Alexandria listing describe the KEV catalog as a data source for software agents, a hint at where automated triage is heading. Browse the security coverage hub for ongoing advisories that you can feed through the pipeline.
Plan for CVSS 4.0. FIRST reportedly released a CVSS v4.0 Consumer Implementation Guide, aimed at applying deployment-specific risk instead of leaning on generic base scores. Reporting from October 2026 also points to the Exploit Maturity metric as a way to lower the enriched score when intelligence shows no known exploitation. A v4.0 calculator is a natural module for cvss.py , and the fallback in step 7 keeps the pipeline working until it exists.
Recent KEV Entries as Test Cases for Your Policy
Real events make good regression tests for a policy. The October 2026 KEV additions sort into three categories that the pipeline treats differently.
Ivanti Connect Secure, CVE-2026-104935 (added October 13). An actively exploited, unauthenticated flaw in a remote-access appliance. OSV cannot see it, so the appliance matcher catches it. Internet-facing by design, so P0.
BeyondTrust Remote Support, CVE-2026-102764 (added October 16). An authentication bypass in a product CISA’s alert describes as formerly Bomgar. Match on both names in the appliance CSV, because inventories and advisories often disagree branding.
PHP, CVE-2026-109618 and CVE-2026-109619 (added October 26). A memory-corruption flaw and a stale internal request-state flaw. Anything exposing PHP to the internet moves to P0, and coverage of the PHP2Shell flaws adds background on how PHP bugs reach appliance management interfaces.
EPICS Base, versions 7.0.10 and earlier (advisory of October 27). CISA’s industrial-control advisory said no known public exploitation had been reported to the agency. This is the counter-example: a real advisory that is not in KEV. It lands in P2 or P3 depending on exposure and EPSS, which is the right call.
Treat these as a smoke test after any policy change. If a flaw like the Ivanti one would not reach P0 under your revised thresholds, the thresholds are wrong. For a wider view of which vendors keep returning to the catalog, the roundup of KEV additions across Palo Alto, Cisco and Ahsay shows the same appliance-heavy pattern.
Frequently Asked Questions
What is vulnerability management in practice?
It is the recurring cycle of inventorying assets, finding weaknesses, ranking them, fixing or consciously accepting them and verifying the result. The ranking step is where most programs struggle, because scanners return far more findings than a team can close.
What is the difference between CISA KEV and EPSS?
KEV is a list of vulnerabilities with confirmed exploitation in the wild. EPSS is a model-based probability that a vulnerability will see exploitation activity in the 30 days. KEV records fact and EPSS estimates risk, so a flaw can have a high EPSS and still be absent from KEV.
Is CVSS still useful?
Yes, as a measure of impact. It breaks ties between findings with similar exploitation signals and helps size the blast radius. It fails as a standalone ranking because it ignores whether anyone is attacking the flaw.
How often should the scan run?
Daily is a sensible default. KEV additions land throughout the month (October 2026 brought entries on the 13th, 16th and 26th), and EPSS refreshes daily, so a weekly scan can leave a newly listed flaw unnoticed for days.
What deadlines should I set?
Start with the table in step 8: 3, 14, 30 and 90 days. Measure how often each tier misses, then adjust. A deadline your team misses every time is a process problem, and shortening it will not help.
Does this replace a commercial vulnerability scanner?
No. It scores and tracks package-level findings and KEV matches. Network scanning, authenticated host scans, container image analysis and compliance reporting need dedicated tools. Think of vmp as the prioritization and tracking layer that can sit on top of whatever finds the issues.
Do I need an NVD API key?
Not for this build. OSV supplies the severity data, and the code never calls NVD. A key becomes useful if you add product-based matching for appliances through CPE data, where NVD is the standard source.
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
