Skip to content
Tutorials Center
My learning

Topics

Lesson 33 of 37 ยท Design and Operations

Vulnerability and Patch Management

Learn the vulnerability management cycle: asset inventory, scanning, CVSS and exploit-aware prioritization, patch windows and exceptions, with a Python tool that ranks findings by risk.

Every piece of software has bugs, and some bugs are security vulnerabilities. New ones are published every day: tens of thousands of CVE identifiers are issued each year. You cannot fix them all instantly, and you do not need to. Vulnerability management is the discipline of knowing what you have, finding what is weak, deciding what matters most, fixing it within a sensible time, and proving that you did. Unpatched, publicly known vulnerabilities remain one of the most common ways attackers get in, so doing this boringly well is high-value security.

This lesson covers the cycle, how severity scores work and where they mislead, how to prioritize with context, and how to handle things you cannot patch. We build a risk-ranking tool in Python on made-up findings.

Only scan systems you own or have written permission to test. Scanners generate traffic that can look like an attack and, occasionally, disrupt fragile devices. Agree the scope, time window and contacts first.

The cycle

flowchart LR
    A["1. Inventory<br/>assets and software"] --> B["2. Scan and detect"]
    B --> C["3. Prioritize by risk"]
    C --> D["4. Remediate<br/>patch, configure, mitigate"]
    D --> E["5. Verify<br/>rescan"]
    E --> F["6. Report and improve"]
    F --> A
  1. Inventory. You cannot patch what you do not know exists. Maintain an asset list (hosts, network devices, cloud resources, containers, software versions) with an owner and a business-criticality rating for each. Unknown and forgotten systems ("shadow IT") are where old vulnerabilities live.
  2. Scan. Use authenticated scans (the scanner logs in) for accurate package and configuration data, plus unauthenticated external scans to see what an outsider sees. Complement with software composition analysis for libraries and image scanning for containers.
  3. Prioritize. The step most programs get wrong; see below.
  4. Remediate. Apply the patch, change the configuration, or add a compensating control.
  5. Verify. Rescan to confirm the finding is gone. A patch that failed to install looks like a closed ticket otherwise.
  6. Report. Track metrics and feed lessons into design.

CVE, CVSS and what scores mean

A CVE (Common Vulnerabilities and Exposures) is a unique ID such as CVE-2024-12345 for a specific flaw. CVSS (Common Vulnerability Scoring System) rates its technical severity from 0.0 to 10.0 using factors such as attack vector (network or local), complexity, privileges required, user interaction and impact on confidentiality, integrity and availability.

Score Rating
0.0 None
0.1 - 3.9 Low
4.0 - 6.9 Medium
7.0 - 8.9 High
9.0 - 10.0 Critical

CVSS measures how bad the bug could be in general. It does not know your environment. A critical flaw on an isolated test box may matter less than a medium flaw on your internet-facing login server. Two extra data sources help:

  • EPSS (Exploit Prediction Scoring System): the estimated probability that the vulnerability will be exploited in the next 30 days.
  • KEV (a catalog of vulnerabilities known to be exploited in the wild, maintained by CISA): anything on it deserves immediate attention.

Prioritizing with context

A practical risk formula combines severity with likelihood and business impact:

  • Severity (CVSS base score).
  • Exploit evidence: known exploited (KEV), public proof-of-concept, or none.
  • Exposure: internet-facing, internal, or isolated.
  • Asset criticality: crown-jewel database versus lab machine.
  • Compensating controls: is a WAF rule or segmentation already blocking the path?

The tool below turns those inputs into a score and a deadline (a service level agreement for remediation).

Python Rank findings by contextual risk

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The isolated lab machine with a CVSS 9.8 ranks near the bottom, while a medium-severity but actively exploited flaw on the database climbs high. That reordering is the whole point: fix what attackers are likely to use against things you care about first. The weights are invented for teaching; calibrate your own against incidents and review them regularly.

Patching in practice

  • Patch cadence. Regular windows (for example monthly) for routine fixes, plus an emergency path for exploited flaws. Operating systems, third-party applications, firmware, network devices and containers all need coverage, not only Windows servers.
  • Test, then roll out in rings. Patch a small pilot group first, watch for breakage, then expand. Keep a rollback plan.
  • Automate. Configuration management and patch tools reduce human delay. Rebuild immutable images instead of patching running containers.
  • Measure. Useful metrics: mean time to remediate by severity, percentage of assets scanned in the last 30 days, number of findings past SLA, and percentage of KEV items closed within the deadline.

When you cannot patch

Legacy systems, vendor-controlled appliances and industrial equipment cannot always be updated. Use compensating controls and record a risk acceptance with an owner and an expiry date:

  • Isolate it in its own segment with strict allow rules (architecture lesson).
  • Block or virtually patch the exploit path with an IPS signature or WAF rule.
  • Disable the vulnerable feature or service.
  • Increase monitoring on the asset.
  • Plan replacement; a risk acceptance without a date is a permanent hole.

Beyond software flaws

Scanners also find misconfigurations: default passwords, open management interfaces, weak TLS settings, exposed storage, unnecessary services. Benchmarks such as the CIS Benchmarks describe secure settings; checking against them is configuration compliance, a close cousin of vulnerability scanning. Track both together.

The next program checks a scanned port list against a policy of allowed services per host role. It uses data, not a live scan, so it is a safe stand-in for the reporting side of "unnecessary service" findings.

Python Compare open ports with an allow-list

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Administrative ports exposed on a data-tier host belong on a management network only, which leads directly into incident response: the moment prevention fails, you need a rehearsed plan.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does a CVSS score measure?

    CVSS rates intrinsic severity; it ignores your environment, exploit activity and asset value.
  2. 2. Which finding should usually be fixed first?

    Known exploitation plus a critical asset outweighs a higher base score on a low-value isolated system.
  3. 3. What is a KEV catalog?

    KEV lists vulnerabilities with confirmed real-world exploitation, a strong signal for urgent patching.
  4. 4. Why rescan after patching?

    Failed or partial installs are common; verification closes the loop.
  5. 5. What should accompany a decision not to patch a legacy system?

    Unpatched systems need isolation, monitoring and a documented, expiring exception with a replacement plan.

Summary

  • Vulnerability management is a cycle: inventory, scan, prioritize, remediate, verify, report.
  • CVSS gives generic severity; add exploit evidence (KEV, EPSS), exposure, asset criticality and mitigations to prioritize.
  • Set deadlines by risk, with an emergency path for exploited flaws; patch in rings with rollback.
  • For unpatchable systems use isolation, virtual patching, monitoring and time-limited risk acceptance.
  • Track configuration weaknesses and unnecessary services alongside software flaws, and measure time to remediate.

Next: Network Incident Response