{
  "id": "CB-UBU-AUTH-006",
  "standard": "ubuntu",
  "version": "0.1.2",
  "url": "https://baselines.cirsec.org/b/ubuntu/v0.1.2/CB-UBU-AUTH-006",
  "json": "https://baselines.cirsec.org/b/ubuntu/v0.1.2/CB-UBU-AUTH-006.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/v0.1.2/CB-UBU-AUTH-006.yml",
  "profiles_effective": [
    "server-hardened",
    "desktop-hardened"
  ],
  "license": "Text CC BY 4.0, code Apache-2.0",
  "attribution": "CIRSEC Baselines, https://baselines.cirsec.org",
  "control": {
    "id": "CB-UBU-AUTH-006",
    "title": "Require a password for every sudo rule",
    "finding": {
      "title": "Some sudo rules run commands without asking for a password",
      "description": "Anyone who takes over such an account, or just an unlocked session, gets root without knowing any secret."
    },
    "status": "active",
    "profiles": [
      "server-hardened",
      "desktop-hardened"
    ],
    "risk": {
      "severity": "high"
    },
    "assessment": "automated",
    "tags": [
      "sudo",
      "privilege-escalation"
    ],
    "applicability": {
      "facts": [
        "sudo"
      ]
    },
    "description": "A sudo rule tagged `NOPASSWD:` runs commands without asking the user for their password.\n",
    "rationale": "The password prompt is the last barrier between a stolen session or a compromised process\nrunning as an administrator and full control of the system. Without it, privilege escalation\nneeds no secret at all.\n",
    "impact": "Automation that relies on password-less sudo (configuration management, deployment accounts)\nneeds another approach: a dedicated account restricted to precise commands, run from a\ncontrolled host, or root access through SSH keys for that tool only.\n",
    "notes": "Ubuntu cloud images get a `NOPASSWD:ALL` rule for the default user from cloud-init, in\n`/etc/sudoers.d/90-cloud-init-users`. Set a password for that user before removing the rule.\nThe rule syntax is the same for sudo-rs, the `sudo` of Ubuntu 26.04.\n",
    "audit": {
      "manual": "Run `grep -r NOPASSWD /etc/sudoers /etc/sudoers.d/`. There must be no match.\n",
      "checks": [
        {
          "id": "sudoers",
          "engine": "file-content",
          "description": "No NOPASSWD tag in /etc/sudoers.",
          "spec": {
            "path": "/etc/sudoers",
            "pattern": "^[^#]*NOPASSWD",
            "expect": "no_match"
          }
        },
        {
          "id": "sudoers-d",
          "engine": "file-content",
          "description": "No NOPASSWD tag in /etc/sudoers.d/.",
          "spec": {
            "path": "/etc/sudoers.d/*",
            "pattern": "^[^#]*NOPASSWD",
            "expect": "no_match"
          }
        }
      ]
    },
    "remediation": {
      "manual": "1. Make sure every user concerned has a password (`passwd <user>`) and can still run `sudo -v`.\n2. Edit the files with `visudo` (or `visudo -f /etc/sudoers.d/<file>`) and remove `NOPASSWD:`\n   from each rule.\n",
      "rollback": "Add the `NOPASSWD:` tag back with `visudo`.\n"
    },
    "references": [
      {
        "title": "sudoers(5), Ubuntu manual pages",
        "url": "https://manpages.ubuntu.com/manpages/noble/man5/sudoers.5.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 (R39)",
        "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": "R39",
        "relation": "partial"
      },
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "IA-11",
        "relation": "related"
      }
    ],
    "threats": [
      {
        "framework": "mitre-attack",
        "id": "T1548.003"
      }
    ],
    "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": "Fails on the cloud image (cloud-init NOPASSWD rule) as expected; manual fix."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "22.04"
        ],
        "environment": "Proxmox VM, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic",
        "notes": "Fails on the cloud image (cloud-init NOPASSWD rule) as expected; manual fix."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "24.04"
        ],
        "environment": "Proxmox VM, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic",
        "notes": "Fails on the cloud image (cloud-init NOPASSWD rule) as expected; manual fix."
      },
      {
        "date": "2026-10-19",
        "by": "Sn0wAlice",
        "versions": [
          "26.04"
        ],
        "environment": "Proxmox VM, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic",
        "notes": "Fails on the cloud image (cloud-init NOPASSWD rule) as expected; manual fix."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}