Skip to main content

Beginner-Friendly Topic

Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!

Lesson 6 of 10

Package Management & Patch Management

Unpatched software is the primary entry point for attackers exploiting known vulnerabilities. CVEs (Common Vulnerabilities and Exposures) are publicly published vulnerability reports - every day without applying a patch is a day an attacker can exploit a known weakness.

40 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Patch Management Fundamentals

Patch Management Fundamentals
# Debian/Ubuntu

# Update package index (refresh what's available)
apt update

# See which packages have security updates
apt list --upgradable 2>/dev/null | grep -i security

# Apply all updates
apt upgrade -y

# Apply only security updates
apt-get install unattended-upgrades
unattended-upgrade --debug          # Preview what would be updated

# Check for package integrity (verify downloads not tampered with)
apt-key list                        # List trusted repository keys
debsums -c                          # Check installed file checksums

# RHEL/CentOS/Fedora
yum update -y                      # Apply all updates
yum --security update -y           # Apply only security updates
yum check-update --security        # List available security updates

CVE Management Workflow

  • Monitor CVE sources: Subscribe to vendor security advisories (Ubuntu USN, Red Hat RHSA), CISA KEV (Known Exploited Vulnerabilities) catalog, and NIST NVD
  • CVSS prioritization: Critical (9.0-10.0) → patch within 24 hours; High (7.0-8.9) → 7 days; Medium (4.0-6.9) → 30 days; Low → next regular cycle
  • Check if your version is vulnerable: Use 'apt show package-name' or 'rpm -q package' to see installed versions, then compare against CVE NVD entry's affected versions
  • Exploit availability escalates priority: A CVSS 7.0 vulnerability with a public Metasploit module is far more urgent than a CVSS 9.0 vulnerability with no known exploit
  • Test before deploying to production: Apply patches to staging first; validate functionality; then deploy to production during a maintenance window

Verifying No Unauthorized Packages

Verifying No Unauthorized Packages
# Audit installed packages for unauthorized software

# List all installed packages with installation dates
dpkg-query -W --showformat='${Package}\t${Version}\n' | sort
apt list --installed 2>/dev/null

# Check recently installed packages (suspicious if you didn't install them)
zcat /var/log/dpkg.log.1.gz | grep install | tail -30
cat /var/log/dpkg.log | grep install | tail -30

# Verify file integrity of installed packages
debsums packagename    # Verify checksums of all files in a package
debsums -c             # Check all packages, report only failures

# Find files not belonging to any package (potential planted malware)
# (time-consuming - run during maintenance)
find / -not -path '/proc/*' -not -path '/sys/*' \
    -not -path '/dev/*' \
    | while read f; do dpkg -S "$f" > /dev/null 2>&1 || echo "Unknown: $f"; done

Common Mistakes

  • Treating patches as optional - 60% of breaches exploit vulnerabilities for which a patch was available but not applied (Ponemon Institute research)
  • Patching manually without automation - manual processes are error-prone and don't scale; use automated patch management (Ansible, Puppet, AWS Systems Manager)
  • Not rebooting after kernel updates - kernel patches only take effect after reboot; running an unpatched kernel defeats the purpose of the update
  • Forgetting third-party software - OS packages are only part of the picture; web server plugins, language runtimes (Node.js, Python packages), and application dependencies need separate patch processes

Tip

Tip

Practice Package Management Patch Management in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.

Diagram
Loading diagram…

The foundational security model: Confidentiality (privacy), Integrity (trust), and Availability (uptime).

Practice Task

Note

Practice Task - (1) Write a working example of Package Management Patch Management from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.

Quick Quiz

Common Mistake

Warning

A common mistake with Package Management Patch Management is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready cybersecurity code.

Key Takeaways

  • Unpatched software is the primary entry point for attackers exploiting known vulnerabilities.
  • Monitor CVE sources: Subscribe to vendor security advisories (Ubuntu USN, Red Hat RHSA), CISA KEV (Known Exploited Vulnerabilities) catalog, and NIST NVD
  • CVSS prioritization: Critical (9.0-10.0) → patch within 24 hours; High (7.0-8.9) → 7 days; Medium (4.0-6.9) → 30 days; Low → next regular cycle
  • Check if your version is vulnerable: Use 'apt show package-name' or 'rpm -q package' to see installed versions, then compare against CVE NVD entry's affected versions

Hands-on Practice Tools for this Course

Test what you learn using these free in-browser developer utilities (no signup required).

All 40+ Tools

Topics in This Module

0/10 done