{
  "id": "CB-UBU-AUTH-028",
  "standard": "ubuntu",
  "version": "0.1.2",
  "url": "https://baselines.cirsec.org/b/ubuntu/v0.1.2/CB-UBU-AUTH-028",
  "json": "https://baselines.cirsec.org/b/ubuntu/v0.1.2/CB-UBU-AUTH-028.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/v0.1.2/CB-UBU-AUTH-028.yml",
  "profiles_effective": [
    "core",
    "server",
    "server-hardened",
    "desktop",
    "desktop-hardened"
  ],
  "license": "Text CC BY 4.0, code Apache-2.0",
  "attribution": "CIRSEC Baselines, https://baselines.cirsec.org",
  "control": {
    "id": "CB-UBU-AUTH-028",
    "title": "Keep the shadow group empty",
    "finding": {
      "title": "Users are members of the shadow group",
      "description": "Members of the shadow group can read every password hash of the system."
    },
    "status": "active",
    "profiles": [
      "core"
    ],
    "risk": {
      "severity": "high"
    },
    "assessment": "automated",
    "tags": [
      "accounts",
      "shadow",
      "password"
    ],
    "description": "`/etc/shadow` is readable by the `shadow` group so that a few setgid programs (such as\n`unix_chkpwd`) can check passwords. No user needs to be a member of this group.\n",
    "rationale": "A user in the `shadow` group can copy every password hash and crack them offline.\n",
    "impact": "None for a standard system.\n",
    "audit": {
      "manual": "1. `getent group shadow` shows no member after the last colon.\n2. `awk -F: -v g=\"$(getent group shadow | cut -d: -f3)\" '$4 == g' /etc/passwd` prints nothing.\n",
      "checks": [
        {
          "id": "members",
          "engine": "shell",
          "spec": {
            "script": "g=$(getent group shadow) || { echo \"no shadow group\"; exit 0; }\ngid=$(printf '%s' \"$g\" | cut -d: -f3)\nm=${g##*:}\np=$(awk -F: -v g=\"$gid\" '$4 == g {print $1}' /etc/passwd | tr '\\n' ' ')\necho \"members: ${m:-none}; primary group of: ${p:-none}\"\n[ -z \"$m$p\" ]\n"
          }
        }
      ]
    },
    "remediation": {
      "manual": "Remove each member with `gpasswd -d <user> shadow`, and give users whose primary group is\n`shadow` another primary group with `usermod -g <group> <user>`.\n",
      "effects": {
        "restart": "none",
        "disruption": "low",
        "lockout_risk": false
      },
      "scripts": [
        {
          "id": "remove-members",
          "engine": "shell",
          "content": "cb_backup /etc/group\ncb_backup /etc/gshadow\nm=$(getent group shadow | cut -d: -f4)\nfor u in $(printf '%s' \"$m\" | tr ',' ' '); do gpasswd -d \"$u\" shadow >/dev/null; done\n"
        }
      ]
    },
    "references": [
      {
        "title": "shadow(5), Ubuntu manual pages",
        "url": "https://manpages.ubuntu.com/manpages/noble/man5/shadow.5.html",
        "publisher": "Canonical",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      }
    ],
    "mappings": [
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "AC-6",
        "relation": "related"
      }
    ],
    "threats": [
      {
        "framework": "mitre-attack",
        "id": "T1003.008"
      }
    ],
    "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": "Passes on a fresh install; profiles core and server-hardened."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "22.04"
        ],
        "environment": "Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic",
        "notes": "Passes on a fresh install; profiles core and server-hardened."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "24.04"
        ],
        "environment": "Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic",
        "notes": "Passes on a fresh install; profiles core and server-hardened."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "26.04"
        ],
        "environment": "Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic",
        "notes": "Passes on a fresh install; profiles core and server-hardened."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}