# yaml-language-server: $schema=../../../../schema/control.schema.json id: CB-DEB-PKG-010 title: Install only the packages the system needs finding: title: Packages without a use on this system are installed description: Every unneeded package adds code that can be vulnerable, services that can be exposed and updates to follow. status: active profiles: [core] risk: severity: low assessment: manual tags: [packages, minimal-install] description: | A minimal installation contains only what the role of the system requires: no graphical environment on a server, no compiler or debugging tools on a production host, no tool installed "just in case". Debian makes it easier by letting the installer skip every task, and by tracking packages installed only as dependencies so that `apt-get autoremove` can remove them. rationale: | Each package is attack surface: its vulnerabilities, its services and its setuid binaries. Compilers, debuggers and network tools also help an attacker who got a foothold. Fewer packages also mean fewer updates and a simpler review of the system. impact: | Removing a package that an application relies on breaks it. Review before removing, and test on a non-production system first. audit: manual: | 1. List the packages installed on purpose with `apt-mark showmanual`, and check that each one is needed by the role of the system. 2. Run `apt-get -s autoremove`: it lists dependencies that are no longer needed. 3. Look for packages that rarely belong on a server: graphical environment (`dpkg -l 'xserver-xorg*' 'gnome*' 'kde*'`), compilers and build tools (`gcc`, `make`, `build-essential`), debuggers (`gdb`, `strace`), network tools (`nmap`, `netcat*`, `tcpdump`), unused interpreters. 4. Check that `apt-config dump APT::Install-Recommends` matches the policy of the organisation. remediation: manual: | 1. Remove each unneeded package with `apt-get purge `, after checking with `apt-get -s purge ` what else would be removed. 2. Run `apt-get autoremove --purge` to remove the dependencies left behind. 3. For new systems, start from a minimal installation (no task selected in the installer, or a minimal cloud image) and add packages for the role only. 4. Write down the list of packages expected for each role, so drifts can be spotted. references: - title: ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R58) url: https://messervices.cyber.gouv.fr/documents-guides/fr_np_linux_configuration-v2.0.pdf publisher: ANSSI kind: guide accessed: 2026-10-18 - title: apt-mark(8), Debian manual pages url: https://manpages.debian.org/trixie/apt/apt-mark.8.en.html publisher: Debian kind: vendor-doc accessed: 2026-10-18 mappings: - framework: anssi-linux framework_version: "2.0" id: R58 relation: equivalent - framework: nist-800-53r5 framework_version: "5.1.1" id: CM-7 relation: related related_controls: - id: CB-DEB-PKG-011 type: related authors: - name: Alice github: Sn0wAlice introduced_in: 0.1.0 created: 2026-10-18 updated: 2026-10-18