Outdated and unwanted software is a leading source of vulnerabilities. A package manager lets you install, remove, and update software in a controlled way. The examples use Debian and Ubuntu (apt), the most common CyberPatriot Linux images. Use your own practice VM and a snapshot.

How apt works

Software is delivered as packages from repositories listed in /etc/apt/sources.list and /etc/apt/sources.list.d/. Packages are cryptographically signed, so only add repositories you trust.

sudo apt update              # refresh the package lists
sudo apt upgrade             # install available updates
sudo apt full-upgrade        # upgrades that may add or remove packages
apt list --upgradable        # see what is waiting
apt list --installed         # everything installed

apt update does not install anything; it only downloads the list of what is available. Run it before upgrade. Also update the kernel and key services like OpenSSH, and reboot if the system asks.

Installing and removing software

sudo apt install ufw         # install a package
sudo apt remove telnetd      # remove the program, keep its config
sudo apt purge telnetd       # remove program and config
sudo apt autoremove          # clean up unused dependencies
dpkg -l | grep -i game       # search installed packages by name
apt show nmap                # read about a package

Competition scenarios usually list required software in the README. Unrequired or risky packages that are commonly flagged include old remote-access daemons (telnet, rsh), games, and network scanners or password crackers that do not belong on a workstation. Removing a package the README says is critical will cost you points, so read before you remove.

Turning on automatic security updates

sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

The settings live in /etc/apt/apt.conf.d/20auto-upgrades. Setting APT::Periodic::Update-Package-Lists "1"; and APT::Periodic::Unattended-Upgrade "1"; makes the system check and apply security updates daily.

Verifying what you have

  • apt policy openssh-server shows installed and candidate versions.
  • debsums -c (from the debsums package) lists files that no longer match their package checksums, which can reveal tampering.
  • snap list and flatpak list show apps installed outside apt, which are easy to forget.

Work in a pattern: update lists, apply updates, review installed software against the README, remove what is unauthorized, then re-check the system still works.

Check your understanding

What does sudo apt update do?

  • Installs all available upgrades
  • Refreshes the list of available packages
  • Removes unused packages
  • Reboots the system

Answer: Refreshes the list of available packages It only downloads package information; apt upgrade installs the new versions.

Which command removes a package along with its configuration files?

  • apt remove
  • apt purge
  • apt update
  • apt show

Answer: apt purge Purge deletes the program and its configuration, while remove keeps the config.

Why should you read the scenario README before removing software?

  • Because removing anything is illegal
  • Because some packages are required and removing them loses points
  • Because apt cannot remove packages
  • Because the README lists passwords

Answer: Because some packages are required and removing them loses points Hardening means removing unauthorized software, not breaking services the task needs.

Which package helps install security updates automatically?

  • unattended-upgrades
  • telnetd
  • debsums
  • nano

Answer: unattended-upgrades It checks for and applies updates on a schedule without manual action.