Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 5 of 6 · Worked example · 15 min · revision 2

Metrics That Show Exposure Going Down

From a fixed findings history, compute time to remediate per severity (mean and median), SLA compliance that counts open overdue findings, and the exposure trend on internet-facing assets, then present the same data to engineers and to leadership.

Contentsand lesson path

What you will learn

  • Report programme metrics such as time to remediate, SLA compliance and exposure trend to engineering and leadership audiences.

01. The problem

At the end of the third quarter of 2026, the security team reports that the mean time to remediate (MTTR), the average number of days between first detection and closure, fell from 56 to 26 days. It sounds like good news. At the same time, a KEV-listed critical finding on an internet-facing system has been open for almost two weeks past its deadline. Both statements come from the same data.

This lesson computes three metric families from one findings history and shows why each one must be broken down by severity, and stated with its definition:

  • Time to remediate, per severity, as mean and median.
  • SLA compliance, the share of findings fixed by their deadline.
  • Exposure trend, how many high-risk findings are open at each point in time.

NIST SP 800-40 Rev. 4 warns that "overly simplistic metrics", such as a count of vulnerabilities and the percentage patched, are not actionable, and its example table reports, for each combination of asset importance and severity, the share patched by the deadline together with the mean and the median time. The scripts below use only the Python standard library, and the data is fixed, so your output should match exactly.

02. Step 1: The findings history

Each row is one finding: severity, whether the CVE is in KEV, whether the asset faces the internet, the owning team, the date it was first detected, and the date its closure was verified by a rescan (empty if still open). The severity sets the SLA: critical 7 days, high 30, medium 90, low 180. The IDs and dates are fictional.

CSV · metrics/findings_history.csv
id,severity,kev,internet,owner,opened,closed
F-001,critical,y,y,netops,2026-04-02,2026-04-07
F-002,critical,n,y,shop-team,2026-04-20,2026-04-26
F-003,critical,n,n,data-team,2026-05-25,2026-06-02
F-004,high,n,y,shop-team,2026-03-20,2026-04-09
F-005,high,n,n,data-team,2026-04-10,2026-05-05
F-006,high,n,n,it-ops,2026-05-02,2026-05-30
F-007,high,n,n,platform,2026-05-10,2026-06-19
F-008,medium,n,n,it-ops,2026-02-10,2026-04-11
F-009,medium,n,n,platform,2026-03-01,2026-05-20
F-010,medium,n,n,data-team,2026-03-15,2026-06-23
F-011,low,n,n,it-ops,2025-12-01,2026-04-30
F-012,low,n,n,platform,2026-01-05,2026-06-24
F-013,critical,y,y,netops,2026-07-03,2026-07-09
F-014,critical,n,y,shop-team,2026-07-14,2026-07-26
F-015,critical,y,n,data-team,2026-08-04,2026-08-19
F-016,critical,n,y,shop-team,2026-08-20,2026-09-10
F-017,high,n,y,shop-team,2026-06-25,2026-07-13
F-018,high,n,n,data-team,2026-07-08,2026-07-30
F-019,high,n,n,platform,2026-07-20,2026-08-24
F-020,high,n,n,it-ops,2026-03-30,2026-09-06
F-021,medium,n,n,it-ops,2026-05-20,2026-06-29
F-022,medium,n,n,platform,2026-06-01,2026-08-10
F-023,medium,n,n,data-team,2026-06-10,2026-09-13
F-024,low,n,n,it-ops,2026-08-10,2026-08-12
F-025,low,n,n,platform,2026-08-11,2026-08-14
F-026,low,n,n,it-ops,2026-08-12,2026-08-15
F-027,low,n,n,platform,2026-08-13,2026-08-17
F-028,low,n,n,it-ops,2026-08-14,2026-08-19
F-029,low,n,n,platform,2026-08-15,2026-08-20
F-030,low,n,n,it-ops,2026-08-16,2026-08-22
F-031,low,n,n,platform,2026-08-17,2026-08-25
F-032,low,n,n,it-ops,2026-08-18,2026-08-28
F-033,low,n,n,platform,2026-08-19,2026-08-31
F-034,critical,y,y,netops,2026-09-10,
F-035,critical,n,y,shop-team,2026-09-26,
F-036,high,n,n,data-team,2026-09-05,
F-037,high,n,y,shop-team,2026-09-22,
F-038,medium,n,n,platform,2026-08-01,
Python · metrics/history.py
"""Load the findings history and add each finding's SLA due date."""
import csv
from datetime import date, timedelta

SLA_DAYS = {"critical": 7, "high": 30, "medium": 90, "low": 180}
QUARTERS = {"2026-Q2": (date(2026, 4, 1), date(2026, 6, 30)),
            "2026-Q3": (date(2026, 7, 1), date(2026, 9, 30))}


def load(path="findings_history.csv"):
    rows = []
    for r in csv.DictReader(open(path)):
        r["opened"] = date.fromisoformat(r["opened"])
        r["closed"] = date.fromisoformat(r["closed"]) if r["closed"] else None
        r["due"] = r["opened"] + timedelta(days=SLA_DAYS[r["severity"]])
        rows.append(r)
    return rows


def is_open(r, day):
    """Open at the end of `day`: opened by then and not yet closed."""
    return r["opened"] <= day and (r["closed"] is None or r["closed"] > day)

03. Step 2: Time to remediate, per severity

For each quarter, take the findings closed in that quarter and compute the days from detection to closure, per severity and for all severities together.

Python · metrics/mttr.py
"""Step 2: time to remediate per severity, for findings closed in each quarter."""
from statistics import mean, median

from history import QUARTERS, SLA_DAYS, load

rows = load()
print(f"{'quarter':<8} {'severity':<9} {'closed':>6} {'mean':>6} {'median':>6}")
for q, (start, end) in QUARTERS.items():
    closed = [r for r in rows if r["closed"] and start <= r["closed"] <= end]
    for sev in [*SLA_DAYS, "all"]:
        days = [(r["closed"] - r["opened"]).days for r in closed
                if sev in ("all", r["severity"])]
        print(f"{q:<8} {sev:<9} {len(days):>6} {mean(days):>6.1f} {median(days):>6.1f}")
Terminal
mkdir metrics && cd metrics
# save findings_history.csv, history.py and the step scripts here
python3 mttr.py
Expected output
quarter  severity  closed   mean median
2026-Q2  critical       3    6.3    6.0
2026-Q2  high           4   28.2   26.5
2026-Q2  medium         4   70.0   70.0
2026-Q2  low            2  160.0  160.0
2026-Q2  all           13   56.3   40.0
2026-Q3  critical       4   13.5   13.5
2026-Q3  high           4   58.8   28.5
2026-Q3  medium         2   82.5   82.5
2026-Q3  low           10    5.8    5.0
2026-Q3  all           20   25.6   11.0

The all row fell from 56.3 to 25.6 days, but no severity improved in the way that number suggests. Critical findings took more than twice as long in Q3 (median 6.0 to 13.5 days). The overall figure dropped because a clean-up sprint closed ten low findings in a few days each, and those ten make up half of the closures. An average across severities is mostly a measure of which findings were closed, not of how fast.

The high row shows why the median, the middle value, belongs next to the mean. One high finding took 160 days, which pulls the Q3 mean to 58.8 while the median stays at 28.5. The mean is sensitive to a few slow cases, which is useful when those cases matter, but it hides what a typical fix takes. Report both, per severity. With small groups, also give the count: a median of four values can move a lot from one quarter to the next.

MTTR only describes findings that were closed. A finding that is still open after 200 days does not appear in it at all, so MTTR can improve while the oldest problems are ignored. The next metric covers part of that gap: it counts an open finding once, in the quarter its deadline falls. The age of open findings, the days since first detection of each finding that is still open, covers the rest; step 5 shows it.

04. Step 3: SLA compliance, counting what is still open

Define the group by due date: every finding whose deadline fell in the quarter. A finding met its SLA if it was closed on or before that date. A finding still open on its due date is a miss, even if nobody has touched it.

Python · metrics/sla.py
"""Step 3: SLA compliance per severity, for findings whose due date fell in the quarter.
A finding still open at its due date counts as a miss."""
from history import QUARTERS, SLA_DAYS, load

rows = load()
print(f"{'quarter':<8} {'severity':<9} {'due':>4} {'met':>4} {'compliance':>10}")
for q, (start, end) in QUARTERS.items():
    for sev in SLA_DAYS:
        due = [r for r in rows if r["severity"] == sev and start <= r["due"] <= end]
        met = [r for r in due if r["closed"] and r["closed"] <= r["due"]]
        share = f"{len(met) / len(due):.0%}" if due else "-"
        print(f"{q:<8} {sev:<9} {len(due):>4} {len(met):>4} {share:>10}")
Terminal
python3 sla.py
Expected output
quarter  severity   due  met compliance
2026-Q2  critical     3    2        67%
2026-Q2  high         5    3        60%
2026-Q2  medium       3    2        67%
2026-Q2  low          1    1       100%
2026-Q3  critical     5    1        20%
2026-Q3  high         3    2        67%
2026-Q3  medium       3    2        67%
2026-Q3  low          1    1       100%

Critical compliance fell from 67% to 20% while the overall MTTR improved. The five Q3 critical deadlines include F-034, a KEV-listed finding on an internet-facing asset that is still open; only a definition that counts open findings shows it. Note also how small the groups are: one more fix would change 20% to 40%. State the counts with the percentage.

05. Step 4: The exposure trend

Time and compliance describe the team's work. Exposure describes the estate: how many findings are open at a moment in time. Count all open findings at each month end, and separately the ones that matter most here: critical or KEV-listed findings on internet-facing assets.

Python · metrics/trend.py
"""Step 4: open exposure at each month end: all open findings, and the subset that
matters most (critical or KEV, on an internet-facing asset)."""
from datetime import date

from history import is_open, load

rows = load()
MONTH_ENDS = [date(2026, m, d) for m, d in
              [(4, 30), (5, 31), (6, 30), (7, 31), (8, 31), (9, 30)]]
print(f"{'month end':<11} {'open':>4} {'critical/KEV on internet':>25}")
for day in MONTH_ENDS:
    open_now = [r for r in rows if is_open(r, day)]
    exposed = [r for r in open_now if r["internet"] == "y"
               and (r["severity"] == "critical" or r["kev"] == "y")]
    print(f"{day.isoformat():<11} {len(open_now):>4} {len(exposed):>25}")
Terminal
python3 trend.py
Expected output
month end   open  critical/KEV on internet
2026-04-30     5                         0
2026-05-31     6                         0
2026-06-30     4                         0
2026-07-31     4                         0
2026-08-31     4                         1
2026-09-30     5                         2

The total barely moves, but the high-risk count went from zero to two in two months. This is the number that tells you whether the programme is reducing the exposure that attackers are most likely to use. Two limits apply to any exposure count. It only covers assets that were scanned, so a falling count can also mean falling coverage. And new disclosures raise it in ways the team does not control, which is why the trend is read together with time to remediate and compliance.

06. Step 5: One data set, two audiences

Engineers need a work list: what they own, how long each finding has been open, what is due soon, what is overdue, and the flags that explain urgency. Leadership needs a few numbers compared with targets and with the last period, each with the counts behind it, plus the scope they describe, so that they can decide whether risk is within appetite and whether the team needs help.

Python · metrics/views.py
"""Step 5: the same data as an engineering work list and a leadership summary."""
from datetime import date
from statistics import median

from history import QUARTERS, is_open, load

AS_OF = date(2026, 9, 30)
COVERAGE = "5 of 11 live assets scanned with credentials"  # from the inventory lesson
rows = load()


def exposed(day):
    """Open critical or KEV findings on internet-facing assets at the end of `day`."""
    return sum(1 for r in rows if is_open(r, day) and r["internet"] == "y"
               and (r["severity"] == "critical" or r["kev"] == "y"))


def critical_stats(quarter):
    """Critical findings in `quarter`: SLA met, SLA due, median days to fix."""
    start, end = QUARTERS[quarter]
    crit = [r for r in rows if r["severity"] == "critical"]
    due = [r for r in crit if start <= r["due"] <= end]
    met = sum(1 for r in due if r["closed"] and r["closed"] <= r["due"])
    fixed = [(r["closed"] - r["opened"]).days for r in crit
             if r["closed"] and start <= r["closed"] <= end]
    return met, len(due), median(fixed)


print(f"ENGINEERING VIEW: open findings by owner, as of {AS_OF}")
open_now = [r for r in rows if is_open(r, AS_OF)]
for r in sorted(open_now, key=lambda r: (r["owner"], r["due"])):
    age, left = (AS_OF - r["opened"]).days, (r["due"] - AS_OF).days
    when = f"overdue {-left} days" if left < 0 else f"due in {left} days"
    flags = [name for name, on in (("KEV", r["kev"]), ("internet", r["internet"]))
             if on == "y"]
    tags = " ".join(flags)
    print(f"  {r['owner']:<10} {r['id']} {r['severity']:<8} {age:>2} days old  "
          f"{when:<16} {tags}".rstrip())

met2, due2, m2 = critical_stats("2026-Q2")
met3, due3, m3 = critical_stats("2026-Q3")
oldest = min((r for r in open_now if r["severity"] == "critical"),
             key=lambda r: r["opened"])
print()
print("LEADERSHIP VIEW: 2026-Q3")
print(f"  Exposed: {exposed(AS_OF)} critical or KEV findings open on internet-facing"
      " assets")
print(f"    (target 0; {exposed(date(2026, 7, 31))} at the end of July)")
print(f"  Critical SLA (7 days) met: {met3} of {due3} ({met3 / due3:.0%}) in Q3, "
      f"{met2} of {due2} ({met2 / due2:.0%}) in Q2 (target 90%)")
print(f"  Median days to fix a critical: {m3:.1f} in Q3, {m2:.1f} in Q2")
print(f"  Oldest open critical: {oldest['id']}, open "
      f"{(AS_OF - oldest['opened']).days} days (SLA 7 days)")
print(f"  Scope: {COVERAGE}")
Terminal
python3 views.py
Expected output
ENGINEERING VIEW: open findings by owner, as of 2026-09-30
  data-team  F-036 high     25 days old  due in 5 days
  netops     F-034 critical 20 days old  overdue 13 days  KEV internet
  platform   F-038 medium   60 days old  due in 30 days
  shop-team  F-035 critical  4 days old  due in 3 days    internet
  shop-team  F-037 high      8 days old  due in 22 days   internet

LEADERSHIP VIEW: 2026-Q3
  Exposed: 2 critical or KEV findings open on internet-facing assets
    (target 0; 0 at the end of July)
  Critical SLA (7 days) met: 1 of 5 (20%) in Q3, 2 of 3 (67%) in Q2 (target 90%)
  Median days to fix a critical: 13.5 in Q3, 6.0 in Q2
  Oldest open critical: F-034, open 20 days (SLA 7 days)
  Scope: 5 of 11 live assets scanned with credentials

The engineering view puts the overdue KEV finding for netops at the top of that team's list, with the reason visible. The age column also shows what MTTR cannot: F-038 has been open for 60 days, longer than any other open finding, yet it appears in no closed-finding metric and its deadline has not passed. The leadership view leaves out most finding IDs, leads with exposure against a target of zero, and gives the critical numbers as counts and percentages with their previous values: 1 of 5 is a small group, and readers should see that. The oldest open critical names the one finding that leadership may need to unblock. Its last line is the coverage from the inventory lesson: every number above it describes only the assets that were scanned with credentials, and readers need to know how much that leaves out.

07. Common mistakes

08. Check your understanding

Practice check · 3 questions

Reading the metrics

Three questions about the worked example.

Q1. Suppose F-020, the high finding that took 160 days, had taken 40 days and still closed in Q3. How would the `2026-Q3 high` row of `mttr.py` change?
Q2. A colleague computes critical SLA compliance as "closed within 7 days, divided by criticals closed in the quarter" and gets 25% for Q3 instead of 20%. What does this definition miss?
Q3. A manager wants to delete the `Scope` line from the leadership view because "it is not a metric". What is the strongest reason to keep it?
Practice only: not graded, not saved, not evidence.

09. Apply it

For the skill project:

  • Export the findings from your lab scans with detection and verified closure dates, and run the four scripts on them.
  • Add a 90th percentile column to mttr.py with statistics.quantiles(days, n=10)[-1], and explain in one sentence what it adds to the mean and median.
  • Add asset criticality as a second breakdown, as in the NIST table, and see whether the high-criticality row tells a different story.
  • Write the one-paragraph report you would send to leadership, using only the numbers from the leadership view, and a separate message to each owning team with their list.

10. Review prompt

Without looking back:

  1. How can the overall MTTR fall while critical findings are fixed more slowly?
  2. When does the median tell you more than the mean, and why report both?
  3. Why should SLA compliance be counted by due date and include findings that are still open?
  4. What does each audience need from the same data, and why does the leadership view need the coverage line?

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check