Skip to main content
RunBook Academy

LinuxXXXII · Vulnerability and Patch ManagementEmergency

Emergency patching - reacting to critical CVEs under pressure

Advanced⏱ ~10 minaptdnf

What you'll learn

  • Triage a critical CVE
  • Communicate during the incident
  • Deploy the patch under pressure
  • Verify and post-mortem

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

A critical CVE with active exploitation is an emergency. The response must be fast, coordinated, and documented.

The first 30 minutes

T+0  : CVE published with active exploit
T+5  : Security team confirms the host is affected
T+10 : Security team determines scope
T+15 : On-call team notified
T+30 : Patch staged, change communicated, deploy begins

Scope determination

For each host, check:

# Substitute your own values before running:
PACKAGE=nginx
SERVICE=nginx
PORT=443

# Is the affected package installed?
rpm -q "$PACKAGE"          # RHEL family
dpkg -l "$PACKAGE"         # Debian

# Is the service running?
systemctl status "$SERVICE"

# Is the service internet-facing?
ss -tlnp | grep "$PORT"

Document the affected hosts.

Communication

For emergency changes, notify:

  • On-call team.
  • Service owner.
  • Incident management (if the patch may cause outage).
  • Management (for critical services).
INCIDENT: PATCH-EMERGENCY 2026-08-09
CVE: CVE-2024-XXXXX (Critical, active exploit)
Affected: web01, web02, web03
Action: Patch within 60 minutes
Risk: <5 min downtime per host during patch
Rollback: revert via package manager
On-call: <contact>

Patch under pressure

Patch the affected package, not the whole host, and stop at the first host that fails its health check:

#!/usr/bin/env bash
set -euo pipefail

PKG=nginx
FIXED=1.27.2-1          # the fixed version from the advisory

# Test in staging first
ssh staging "sudo apt-get update && \
    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
    -o Dpkg::Options::=--force-confold --only-upgrade ${PKG}=${FIXED}"
ssh staging "sudo systemctl restart ${PKG}"
curl -fsS -o /dev/null https://staging.example.com/health

# Then production, one host at a time, with a gate between hosts
for h in web01 web02 web03; do
    ssh "$h" "sudo apt-get update && \
        sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
        -o Dpkg::Options::=--force-confold --only-upgrade ${PKG}=${FIXED}"
    ssh "$h" "sudo systemctl restart ${PKG}"
    sleep 30
    if ! curl -fsS -o /dev/null "https://${h}.example.com/health"; then
        echo "ABORT: ${h} unhealthy after patch - roll it back." >&2
        echo "Tier is PARTIALLY patched. Do not continue." >&2
        exit 1
    fi
    echo "${h} patched and healthy"
done

Four details in that loop carry the whole procedure:

  • curl -fsS plus the if ! test. curl alone returns 0 for an HTTP 500 - -f makes it fail on 4xx and 5xx, and the test is what turns the result into a gate.
  • --only-upgrade ${PKG}=${FIXED} patches one package to one known version. Under emergency pressure you want the smallest change that closes the CVE.
  • DEBIAN_FRONTEND=noninteractive and -o Dpkg::Options::=--force-confold. Over ssh there is no tty, so a locally modified conffile would stop the run on a dpkg prompt nobody can answer.
  • apt-get install --only-upgrade rather than apt upgrade. Plain apt upgrade silently skips any upgrade that would remove a package, which is how kernel and some security updates get held back without an error.

Verify

After the patch:

  • Smoke tests pass.
  • New CVE not present in the next scan.
  • No new errors in journald or auditd.
  • Service level objectives met.

Post-mortem

Within 24-48 hours:

  • What was the CVE?
  • How was the host affected?
  • How was it detected (vendor advisory, scanner, exploit attempt)?
  • What was the response time?
  • What worked, what did not?
  • What changes for next time (faster detection, better testing, automated patches)?

The post-mortem is the input to process improvement.

Post-emergency: audit and cleanup

After the immediate fire:

  • Run a full vulnerability scan.
  • Verify no other hosts are affected.
  • Update the patch priority decision rules.
  • Document exceptions for any hosts that could not be patched.
  • Communicate to management.

Knowledge check

Knowledge check · 5 questions

  1. Q1. The first action on a critical CVE with active exploit is:

  2. Q2. Emergency patching should always include a post-mortem within 48 hours.

  3. Q3. Which of the following are valid emergency-patch communication channels? Select all that apply.

  4. Q4. A patch loop runs `ssh $h "apt upgrade -y"`, restarts nginx, sleeps 30 seconds, then runs `curl -I https://$h.example.com` before moving to the next host. The patch breaks nginx. What is the outcome?

  5. Q5. Running `apt upgrade -y` is the right call during an emergency CVE response, because it guarantees the fixed package is installed.

Passing score: 75%. Answers are checked in this browser.