Description
The kernel grants full privileges to UID 0, whatever the account name. Group ID 0 grants
access to every file owned by the root group. This control checks that:
rootis the only account with UID 0 and the only one with primary GID 0;rootis the only group with GID 0;- the
rootaccount either has a password or is locked (passwd -S rootshowsPorL).
Debian cloud images lock root (L); an installation with a root password shows P. Both are fine.
Rationale
Attackers who gain root often add a second UID 0 account under an innocent name to keep access. A root account without any password, or with an empty one, can be used by anyone who reaches a login prompt.
Impact
None for a standard system.
Audit
awk -F: '$3 == 0' /etc/passwdlists onlyroot.awk -F: '$4 == 0' /etc/passwdlists onlyroot(andsync,shutdown,haltif present).awk -F: '$3 == 0' /etc/grouplists onlyroot.passwd -S rootshowsPorLin the second field.
Automated: every check must pass. Scanners report each check by its id.
uid0
script: |
u=$(awk -F: '$3 == 0 {print $1}' /etc/passwd | tr '\n' ' ')
echo "UID 0: $u"
[ "$u" = "root " ]
gid0
script: |
u=$(awk -F: '$4 == 0 && $1 !~ /^(root|sync|shutdown|halt|operator)$/ {print $1}' /etc/passwd | tr '\n' ' ')
g=$(awk -F: '$3 == 0 {print $1}' /etc/group | tr '\n' ' ')
echo "other users with GID 0: ${u:-none}; groups with GID 0: $g"
[ -z "$u" ] && [ "$g" = "root " ]
root-password
script: |
s=$(passwd -S root | cut -d' ' -f2)
echo "root status: $s"
[ "$s" = P ] || [ "$s" = L ]
Remediation
- Investigate any other UID 0 or GID 0 account: it may be a backdoor. Remove it with
userdel, or give it its own IDs withusermod -uandusermod -g. - Set a strong root password with
passwd root, or lock it withpasswd -l rootif administrators use sudo.
References
- passwd(5), Debian manual pages Debian, vendor-doc, accessed 2026-10-18
- passwd(1), Debian manual pages Debian, vendor-doc, accessed 2026-10-18
Mappings
| Framework | ID | Relation |
|---|---|---|
| NIST SP 800-53 Rev. 55.1.1 | AC-6(5) | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
People and lifecycle
| Authors |
|
| Verified | 2026-10-18 by Sn0wAlice on 12, Proxmox VM, Debian 12 genericcloud image, kernel 6.1.0-54-cloud-amd64. Generated check, fix and check again for profiles core and server-hardened; state kept after reboot. |
| Verified | 2026-10-18 by Sn0wAlice on 13, Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64. Generated check, fix and check again for profiles core and server-hardened; state kept after reboot. |
| Introduced in | v0.1.0 |
| Created, updated | 2026-10-18, 2026-10-18 |
| Translations | fr |