Debian GNU/Linux · Accounts & authentication

Store every password hash in shadow and leave no account without a password

When it fails: An account has its password hash in /etc/passwd, or an empty password. /etc/passwd is readable by every user; an empty password field opens the account to anyone.

CB-DEB-AUTH-026highactiveautomatedautomated fixprofile core

As released in v0.1.0 beta · pre-release. Current state.

Description

/etc/passwd is world-readable and must only contain x in the password field; the hashes belong in /etc/shadow, readable by root and the shadow group only. In /etc/shadow, each password field holds a hash, or !/* for locked accounts, but is never empty.

Rationale

A hash left in /etc/passwd can be copied and cracked by any local user. An empty password field lets anyone log in to the account where empty passwords are accepted.

Impact

None for a standard system.

Audit

  1. awk -F: '$2 != "x"' /etc/passwd prints nothing.
  2. awk -F: '$2 == ""' /etc/shadow prints nothing.

Automated: every check must pass. Scanners report each check by its id.

shadowed

script: |
  u=$(awk -F: '$2 != "x" {print $1}' /etc/passwd | tr '\n' ' ')
  echo "not shadowed: ${u:-none}"
  [ -z "$u" ]

not-empty

script: |
  u=$(awk -F: '$2 == "" {print $1}' /etc/shadow | tr '\n' ' ')
  echo "empty password: ${u:-none}"
  [ -z "$u" ]

Remediation

  1. Run pwconv to move any hash from /etc/passwd to /etc/shadow.
  2. Lock each account with an empty password (passwd -l <user>) or give it one (passwd <user>).
Restartnone
Disruptionlow

Rollback

Restore /etc/passwd and /etc/shadow from the backup.

fix

cb_backup /etc/passwd
cb_backup /etc/shadow
pwconv
for u in $(awk -F: '$2 == "" {print $1}' /etc/shadow); do passwd -l "$u" >/dev/null; done

Handwritten code reads parameters from CB_<NAME> environment variables. Each release turns these fixes into remediate.sh and an Ansible role per profile: dry run by default, a fix runs only when its check fails.

References

Mappings

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

People and lifecycle

Authors
Verified2026-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.
Verified2026-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 inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr