# yaml-language-server: $schema=../../../../schema/control.schema.json id: CB-UBU-SVC-021 title: Disable the autofs automounter finding: title: The autofs automounter can mount file systems on demand description: Removable media or network shares get mounted whenever someone accesses a path. status: active profiles: [server, desktop-hardened] risk: severity: medium assessment: automated tags: [services, autofs, removable-media] description: | `autofs` mounts file systems (local devices, NFS or SMB shares) when a path under its maps is accessed, and unmounts them when idle. The control passes when `autofs.service` is masked or not installed at all. rationale: | Automatic mounting of removable media lets anyone with physical access bring in files or malicious file system images; automatic network mounts reach shares that the administrator may not expect. impact: | File systems listed in the autofs maps are no longer mounted on demand: mount them through `/etc/fstab` instead. Systems that rely on autofs, such as home directories on NFS, must exclude this control in their tailoring file. notes: | The control is in the server profile and in the hardened desktop profile: on standard desktops, on-demand mounts are an expected feature. audit: manual: | Run `systemctl is-enabled autofs.service`. It must print `masked`, or fail because the unit does not exist. checks: - id: autofs engine: systemd-unit description: autofs automounter. spec: { unit: autofs.service, state: masked } remediation: manual: | Run `systemctl mask --now autofs.service`, or `apt purge autofs` if the package is not needed. effects: restart: none disruption: low lockout_risk: false rollback: | Run `systemctl unmask autofs.service` then `systemctl enable --now autofs.service`. scripts: - id: autofs from_check: autofs references: - title: autofs(8), Ubuntu manual pages url: https://manpages.ubuntu.com/manpages/noble/man8/autofs.8.html publisher: Canonical kind: vendor-doc accessed: 2026-10-19 - 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-19 mappings: - framework: anssi-linux framework_version: "2.0" id: R62 relation: partial note: R62 asks to disable every unneeded service; this control covers autofs. - framework: nist-800-53r5 framework_version: "5.1.1" id: CM-7 relation: partial - framework: nist-800-53r5 framework_version: "5.1.1" id: MP-7 relation: related - framework: cis-ubuntu-2004 framework_version: "3.0.0" id: "2.1.1" relation: equivalent - framework: cis-ubuntu-2204 framework_version: "3.0.0" id: "2.1.1" relation: equivalent - framework: cis-ubuntu-2404 framework_version: "2.0.0" id: "2.1.1" relation: equivalent - framework: cis-ubuntu-2604 framework_version: "1.0.0" id: "2.1.1" relation: equivalent threats: - framework: mitre-attack id: T1091 - framework: mitre-attack id: T1200 authors: - name: Alice github: Sn0wAlice verified: - date: 2026-10-19 by: Sn0wAlice versions: ["20.04"] environment: Proxmox VM, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic notes: "Stock image passes (units absent); with autofs installed the check fails, server-hardened remediation masks the units, audit passes, unchanged on a second run and after reboot." - date: 2026-10-19 by: Sn0wAlice versions: ["22.04"] environment: Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic notes: "Stock image passes (units absent); with autofs installed the check fails, server-hardened remediation masks the units, audit passes, unchanged on a second run and after reboot." - date: 2026-10-19 by: Sn0wAlice versions: ["24.04"] environment: Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic notes: "Stock image passes (units absent); with autofs installed the check fails, server-hardened remediation masks the units, audit passes, unchanged on a second run and after reboot." - date: 2026-10-19 by: Sn0wAlice versions: ["26.04"] environment: Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic notes: "Stock image passes (units absent); with autofs installed the check fails, server-hardened remediation masks the units, audit passes, unchanged on a second run and after reboot." introduced_in: 0.1.0 created: 2026-10-19 updated: 2026-10-19