Skip to content
Tutorials Center
My learning

Topics

Lesson 61 of 80 ยท Security Operations and Incident Response

Vulnerability Management and Patching

Learn how CVE and CVSS work, compute a CVSS 3.1 base score in Python, prioritize vulnerabilities by real risk and set patching deadlines (SLAs).

Software has bugs, and some bugs are security holes. Every week brings new ones in the operating systems, libraries, containers and devices you run. Attackers read the same announcements you do, and for a serious flaw the time between "published" and "exploited in the wild" can be days. Vulnerability management is the continuous process of finding these weaknesses in your own estate, deciding which matter most, and fixing them before somebody uses them.

This lesson explains CVE identifiers and CVSS scores, shows how a base score is calculated (with a working calculator), and then argues, with code, that the score alone is not enough to decide what to patch first. For the vocabulary of threats, vulnerabilities and risk, see Threats, Vulnerabilities and Risk.

All CVE-style identifiers in the demos are invented placeholders for teaching. They do not refer to real vulnerabilities.

The vulnerability management cycle

flowchart LR
    A["Discover assets"] --> B["Scan and collect<br/>findings"]
    B --> C["Prioritize by<br/>real risk"]
    C --> D["Remediate:<br/>patch, mitigate, accept"]
    D --> E["Verify the fix"]
    E --> F["Report and improve"]
    F -.-> A

It is a loop, not a project. New vulnerabilities and new assets arrive every day.

You cannot protect what you do not know about, so it starts with an asset inventory: servers, laptops, cloud resources, containers, network gear and the software on each. Scanners then compare what is installed against databases of known flaws. Good programs scan both from the outside (what an attacker sees) and from the inside with credentials (what is really installed), and they scan often, since new flaws are published daily.

CVE: a name for each flaw

A CVE (Common Vulnerabilities and Exposures) identifier gives one publicly known vulnerability a unique name such as CVE-2026-12345: the year it was assigned, then a number. The identifier lets scanners, vendors, advisories and your tickets all talk about the same flaw. A CVE entry is short; richer details (affected versions, fixed versions, severity) come from vendors and databases such as the US National Vulnerability Database (NVD). A related list, CWE (Common Weakness Enumeration), names types of weakness (for example "SQL injection" or "out-of-bounds write") rather than individual flaws.

CVSS: scoring severity

The Common Vulnerability Scoring System (CVSS) rates how severe a vulnerability is on a scale from 0.0 to 10.0. Version 3.1 is still widely seen in feeds; version 4.0 exists and refines the model, but the core idea is the same. The base score depends only on the flaw itself, using eight metrics:

Metric Question it answers Values
Attack Vector (AV) From where can it be attacked? Network, Adjacent, Local, Physical
Attack Complexity (AC) Does success need special conditions? Low, High
Privileges Required (PR) What access must the attacker have first? None, Low, High
User Interaction (UI) Must a user do something? None, Required
Scope (S) Can it affect components beyond the vulnerable one? Unchanged, Changed
Confidentiality (C) How much data can be disclosed? None, Low, High
Integrity (I) How much can be altered? None, Low, High
Availability (A) How much service can be disrupted? None, Low, High

These are written as a vector string, for example AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H: exploitable over the network, easy, no login, no user action, high impact on all three goals of the CIA triad. That one scores 9.8.

Scores map to severity bands: 0.1-3.9 Low, 4.0-6.9 Medium, 7.0-8.9 High, 9.0-10.0 Critical (and 0.0 is None).

A CVSS 3.1 base score calculator

The formula uses fixed weights for each metric value. The "round up" step rounds to one decimal, always upward. Below is a faithful implementation of the 3.1 base score.

Python CVSS 3.1 base score calculator

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.

You can experiment by changing one metric at a time. Moving the first vector's PR:N to PR:L (a login is now needed) lowers the score noticeably, which fits intuition: bugs that anyone on the internet can trigger are worse than bugs that need an account.

What CVSS does not tell you

The base score is the same for everybody. It does not know whether anyone is attacking the flaw, whether the vulnerable component is reachable on your network, or whether the affected system holds payroll data or a lunch menu. CVSS also has optional temporal and environmental metrics to adjust for exploit maturity and your own context, but many feeds publish only the base score. Treating "Critical" as "fix first" and "Medium" as "ignore" produces long, unhelpful queues.

Prioritizing by real risk

Mature teams combine several signals:

  • Severity (CVSS base score).
  • Exploitation evidence. Is the flaw listed in a catalog of vulnerabilities exploited in the wild, such as CISA's Known Exploited Vulnerabilities list? Is a public exploit or a working proof of concept available? The EPSS score estimates the probability of exploitation in the next 30 days.
  • Exposure. Is the system on the internet, or deep inside a segmented network (Firewalls, Segmentation and Zero Trust)?
  • Asset value. How much would losing this system cost?
  • Compensating controls. Does a WAF rule, an off switch or a configuration change block the attack path until the patch is ready?

The demo ranks a handful of invented findings twice: by CVSS alone, and with a risk-based score that raises known-exploited and internet-facing items and weights the asset's importance.

Python CVSS-only ranking vs risk-based ranking

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 9.8 on an internal wiki drops down the list, while a 6.5 on an exposed VPN gateway that attackers are already using climbs to the top. The multipliers here are arbitrary teaching values; the point is to make your priorities explicit, written down and reviewed, rather than to copy these numbers.

Remediation options

Patching is the usual answer, but not the only one:

  • Patch or upgrade to a fixed version. Test first, roll out in stages, and keep a rollback plan.
  • Mitigate when no patch exists or it cannot be applied yet: disable the vulnerable feature, restrict network access, add a filtering rule, tighten permissions.
  • Accept the risk consciously and temporarily, with a named owner, a reason and an expiry date, when the cost of fixing outweighs the risk.
  • Remove the asset that nobody needs. The safest server is the one that is switched off.

Whatever you choose, verify: rescan to confirm the finding is gone. A ticket marked "done" is not the same as a fixed system.

Patch SLAs

A service-level agreement (SLA) for patching is a deadline by risk level, so that urgent items are not lost in a queue. The numbers are policy choices, and the table below is only an example.

Priority Example target Typical trigger
Emergency 24-72 hours Exploited in the wild on an exposed system
High 7 days Critical or high severity, exposed or important asset
Medium 30 days Medium severity or limited exposure
Low 90 days or next maintenance window Low severity, internal only
Python Check findings against patch deadlines

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.

Report this kind of figure regularly: the percentage of findings fixed within their SLA and the average age of open critical findings tell leadership whether the program works.

Practical advice

  • Automate updates where you can: operating system patches, container base images and dependencies (see Dependency and Supply Chain Security for libraries).
  • Keep maintenance windows predictable, plus an emergency path for urgent fixes.
  • Scan new things before they go live, and scan the cloud accounts, not just servers.
  • Watch your end-of-life systems. Software that no longer receives patches needs isolation or replacement.
  • Track exceptions. Every accepted risk should expire and be reviewed.
  • Coordinate with the incident process. An exploited, unpatched flaw is a likely start of an incident.

Procedural vulnerabilities

Not every weakness is in code. A procedural vulnerability is a gap in how people and processes work. Examples: no rule for who may approve a payment change, no policy that blocks unsecured wireless networks for corporate laptops, nobody responsible for replacing old hardware, or staff allowed to ignore patch notices. Negligence (skipped checks, shared passwords, unlocked server rooms) falls into the same family.

Prevention is organizational: written procedures that are short enough to follow, clear owners, regular audits, keeping hardware and firmware up to date and retiring end-of-life devices, and training. Add procedural findings to the same register as technical ones so they get owners and due dates too.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does a CVE identifier represent?

    A CVE ID names a single known vulnerability so that tools and people can refer to it. CWE names weakness types, and CVSS provides the severity score.
  2. 2. Which of these makes a CVSS base score higher, all else being equal?

    Network reachability, no required privileges and no user interaction all make exploitation easier, which raises the exploitability part of the score.
  3. 3. Why is CVSS base score alone a poor way to order patching work?

    The base score describes the flaw in general. Exploitation evidence, exposure and asset value determine the real risk to you.
  4. 4. A patch for a critical flaw cannot be installed for two weeks. What is a sensible action?

    Mitigations and compensating controls reduce risk until the fix is applied. A documented, expiring exception keeps the decision visible.
  5. 5. What is the point of patch SLAs?

    SLAs turn priorities into deadlines and make overdue work visible, which is how teams show that the program is working.

Summary

  • Vulnerability management is a continuous loop: discover assets, scan, prioritize, remediate, verify and report.
  • CVE names individual flaws, CWE names weakness types, and CVSS rates severity from 0.0 to 10.0 using metrics such as attack vector, complexity, privileges, user interaction, scope and impact.
  • A base score ignores your context. Combine it with exploitation evidence (known-exploited lists, EPSS), exposure and asset criticality.
  • Remediate by patching, mitigating, accepting a time-limited risk or removing the asset, and always verify with a rescan.
  • Patch SLAs by risk level, plus metrics on overdue work, keep the program honest.

Next: Privacy and Data Protection, which looks at protecting the personal data these systems hold.