{
  "id": "CB-UBU-PKG-005",
  "standard": "ubuntu",
  "version": "0.1.1",
  "url": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-PKG-005",
  "json": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-PKG-005.json",
  "yaml": "https://baselines.cirsec.org/b/ubuntu/v0.1.1/CB-UBU-PKG-005.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-PKG-005",
    "title": "Restrict access to APT repository credentials",
    "finding": {
      "title": "APT repository credentials are readable or writable by other users",
      "description": "Local users can read the logins and passwords used to reach private repositories or proxies, or replace them."
    },
    "status": "active",
    "profiles": [
      "core"
    ],
    "risk": {
      "severity": "medium"
    },
    "assessment": "automated",
    "tags": [
      "apt",
      "credentials",
      "permissions"
    ],
    "description": "`/etc/apt/auth.conf` and the `.conf` files of `/etc/apt/auth.conf.d/` hold logins and passwords\nfor private repositories and proxies, in a netrc-like format. APT reads them as root before it\ndrops privileges, so they can be `root:root` mode `0600`. The directory itself should be\n`root:root` mode `0755` or stricter.\n",
    "rationale": "These credentials often give access to commercial or internal repositories, sometimes shared by\na whole fleet. A readable file leaks them to every local user; a writable directory lets a user\nadd or change them.\n",
    "impact": "None known. The directory is empty on a default installation; the file checks apply only when\nfiles exist.\n",
    "setting": {
      "location": "/etc/apt/auth.conf, /etc/apt/auth.conf.d",
      "default_value": "Directory root:root 0755, no file",
      "recommended_value": "Directory root:root 0755 or stricter, files root:root 0600 or stricter"
    },
    "audit": {
      "manual": "1. `stat -c '%U:%G %a' /etc/apt/auth.conf.d` shows `root:root` and `755` or stricter.\n2. `stat -c '%U:%G %a %n' /etc/apt/auth.conf /etc/apt/auth.conf.d/*` shows `root:root` and\n   `600` or stricter for every existing file.\n",
      "checks": [
        {
          "id": "auth-conf-d",
          "engine": "file-perms",
          "description": "The /etc/apt/auth.conf.d directory.",
          "spec": {
            "path": "/etc/apt/auth.conf.d",
            "owner": "root",
            "group": "root",
            "mode": "0755"
          }
        },
        {
          "id": "auth-conf-d-files",
          "engine": "file-perms",
          "description": "Files in /etc/apt/auth.conf.d (not applicable when empty).",
          "spec": {
            "path": "/etc/apt/auth.conf.d/*",
            "owner": "root",
            "group": "root",
            "mode": "0600"
          }
        },
        {
          "id": "auth-conf",
          "engine": "file-perms",
          "description": "The legacy /etc/apt/auth.conf file (not applicable when absent).",
          "spec": {
            "path": "/etc/apt/auth.conf",
            "owner": "root",
            "group": "root",
            "mode": "0600"
          }
        }
      ]
    },
    "remediation": {
      "manual": "Run `chown root:root /etc/apt/auth.conf.d`, `chmod 755 /etc/apt/auth.conf.d`, then for each\ncredential file `chown root:root <file>` and `chmod 600 <file>`. Change the passwords if the\nfiles were readable by other users.\n",
      "effects": {
        "restart": "none",
        "disruption": "none",
        "lockout_risk": false
      },
      "rollback": "Restore the previous owner and mode with `chown` and `chmod`.\n",
      "scripts": [
        {
          "id": "auth-conf-d",
          "from_check": "auth-conf-d"
        },
        {
          "id": "auth-conf-d-files",
          "from_check": "auth-conf-d-files"
        },
        {
          "id": "auth-conf",
          "from_check": "auth-conf"
        }
      ]
    },
    "references": [
      {
        "title": "apt_auth.conf(5), Ubuntu manual pages",
        "url": "https://manpages.ubuntu.com/manpages/noble/man5/apt_auth.conf.5.html",
        "publisher": "Canonical",
        "kind": "vendor-doc",
        "accessed": "2026-10-19"
      }
    ],
    "mappings": [
      {
        "framework": "nist-800-53r5",
        "framework_version": "5.1.1",
        "id": "IA-5",
        "relation": "related"
      }
    ],
    "threats": [
      {
        "framework": "mitre-attack",
        "id": "T1552.001"
      },
      {
        "framework": "cwe",
        "id": "CWE-522"
      }
    ],
    "related_controls": [
      {
        "id": "CB-UBU-PKG-004",
        "type": "related"
      }
    ],
    "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 stock (empty auth.conf.d); 0644 credential file detected and fixed."
      },
      {
        "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 stock (empty auth.conf.d); 0644 credential file detected and fixed."
      },
      {
        "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 stock (empty auth.conf.d); 0644 credential file detected and fixed."
      },
      {
        "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 stock (empty auth.conf.d); 0644 credential file detected and fixed."
      }
    ],
    "introduced_in": "0.1.0",
    "created": "2026-10-19",
    "updated": "2026-10-19"
  }
}