# yaml-language-server: $schema=../../../../schema/control.schema.json id: CB-DEB-SVC-008 title: Disable web server services on systems that do not serve web content finding: title: A web server can run on a system that does not serve web content description: A forgotten web server publishes default pages, modules and files that nobody maintains. status: active profiles: [core] risk: severity: medium assessment: automated tags: [services, http, attack-surface] description: | Web servers packaged by Debian: Apache (`apache2.service`), nginx (`nginx.service`) and lighttpd (`lighttpd.service`). They are often pulled in as dependencies of other software. The control passes when each unit is masked or not installed at all. rationale: | A web server that nobody expects is not patched, monitored or hardened, and may publish directories or status pages that reveal information. It is remotely reachable code. impact: | Masking a unit stops it and prevents it from starting again. **Web servers and reverse proxies must exclude this control in their tailoring file**, with the reason, for example: ```yaml exclude: - control: CB-DEB-SVC-008 reason: Web server role (nginx serves the intranet). ``` notes: | A unit that does not exist counts as compliant, so removing the package is an equally valid fix. audit: manual: | For each unit, run `systemctl is-enabled `. It must print `masked`, or fail because the unit does not exist: `apache2.service`, `nginx.service`, `lighttpd.service`. logic: all checks: - id: apache2 engine: systemd-unit description: Apache HTTP server. spec: { unit: apache2.service, state: masked } - id: nginx engine: systemd-unit description: nginx web server. spec: { unit: nginx.service, state: masked } - id: lighttpd engine: systemd-unit description: lighttpd web server. spec: { unit: lighttpd.service, state: masked } remediation: manual: | Stop and mask each unit that is installed: `systemctl mask --now `. If the package is not needed at all, remove it instead: `apt purge apache2 nginx lighttpd`. effects: restart: none disruption: low lockout_risk: false rollback: | Run `systemctl unmask ` then `systemctl enable --now `. scripts: - id: apache2 from_check: apache2 - id: nginx from_check: nginx - id: lighttpd from_check: lighttpd references: - title: apache2(8), Debian manual pages url: https://manpages.debian.org/trixie/apache2-bin/apache2.8.en.html publisher: Debian kind: vendor-doc accessed: 2026-10-18 - title: nginx(8), Debian manual pages url: https://manpages.debian.org/trixie/nginx/nginx.8.en.html publisher: Debian kind: vendor-doc accessed: 2026-10-18 - title: systemctl(1), Debian manual pages url: https://manpages.debian.org/trixie/systemd/systemctl.1.en.html publisher: Debian kind: vendor-doc accessed: 2026-10-18 - title: ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R62) url: https://messervices.cyber.gouv.fr/documents-guides/fr_np_linux_configuration-v2.0.pdf publisher: ANSSI kind: guide accessed: 2026-10-18 mappings: - framework: anssi-linux framework_version: "2.0" id: R62 relation: partial note: R62 asks to disable every unneeded service; this control covers web servers. - framework: nist-800-53r5 framework_version: "5.1.1" id: CM-7 relation: partial - framework: cis-debian-12 framework_version: "2.0.0" id: "2.1.6" relation: equivalent - framework: cis-debian-13 framework_version: "1.1.0" id: "2.1.19" relation: equivalent threats: - framework: mitre-attack id: T1190 related_controls: - id: CB-DEB-SVC-009 type: related authors: - name: Alice github: Sn0wAlice verified: - date: 2026-10-18 by: Sn0wAlice versions: ["12"] environment: Proxmox VM, Debian 12 genericcloud image, kernel 6.1.0-54-cloud-amd64 notes: "Fresh image passes; with apache2 and nginx installed the checks fail, fix masks, audit passes after reboot; packages still purge cleanly." - date: 2026-10-18 by: Sn0wAlice versions: ["13"] environment: Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64 notes: "Fresh image passes; with apache2 and nginx installed the checks fail, fix masks, audit passes after reboot; packages still purge cleanly." introduced_in: 0.1.0 created: 2026-10-18 updated: 2026-10-18