Debian GNU/Linux · Packages & updates

Restrict access to APT repository credentials

When it fails: APT repository credentials are readable or writable by other users. Local users can read the logins and passwords used to reach private repositories or proxies, or replace them.

CB-DEB-PKG-005mediumactiveautomatedautomated fixprofile core

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

Description

/etc/apt/auth.conf and the .conf files of /etc/apt/auth.conf.d/ hold logins and passwords for private repositories and proxies, in a netrc-like format. APT reads them as root before it drops privileges, so they can be root:root mode 0600. The directory itself should be root:root mode 0755 or stricter.

Rationale

These credentials often give access to commercial or internal repositories, sometimes shared by a whole fleet. A readable file leaks them to every local user; a writable directory lets a user add or change them.

Impact

None known. The directory is empty on a default installation; the file checks apply only when files exist.

Setting

Location/etc/apt/auth.conf, /etc/apt/auth.conf.d
DefaultDirectory root:root 0755, no file
RecommendedDirectory root:root 0755 or stricter, files root:root 0600 or stricter

Audit

  1. stat -c '%U:%G %a' /etc/apt/auth.conf.d shows root:root and 755 or stricter.
  2. stat -c '%U:%G %a %n' /etc/apt/auth.conf /etc/apt/auth.conf.d/* shows root:root and 600 or stricter for every existing file.

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

auth-conf-d

The /etc/apt/auth.conf.d directory.

path: /etc/apt/auth.conf.d
owner: root
group: root
mode: '0755'

auth-conf-d-files

Files in /etc/apt/auth.conf.d (not applicable when empty).

path: /etc/apt/auth.conf.d/*
owner: root
group: root
mode: '0600'

auth-conf

The legacy /etc/apt/auth.conf file (not applicable when absent).

path: /etc/apt/auth.conf
owner: root
group: root
mode: '0600'

Remediation

Run chown root:root /etc/apt/auth.conf.d, chmod 755 /etc/apt/auth.conf.d, then for each credential file chown root:root <file> and chmod 600 <file>. Change the passwords if the files were readable by other users.

Restartnone
Disruptionnone

Rollback

Restore the previous owner and mode with chown and chmod.

auth-conf-d

Generated from check auth-conf-d: the engine writes the fix for every output, it sets the expected value and the check runs again after.

auth-conf-d-files

Generated from check auth-conf-d-files: the engine writes the fix for every output, it sets the expected value and the check runs again after.

auth-conf

Generated from check auth-conf: the engine writes the fix for every output, it sets the expected value and the check runs again after.

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

FrameworkIDRelationNote
NIST SP 800-53 Rev. 55.1.1IA-5related

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

Threats mitigated

  • related CB-DEB-PKG-004 Restrict write access to APT keys and repository lists

People and lifecycle

Authors
Verified2026-10-18 by Sn0wAlice on 12, Proxmox VM, Debian 12 genericcloud image, kernel 6.1.0-54-cloud-amd64. Passes on stock (empty auth.conf.d); 0644 credential file and 0777 directory detected and fixed; apt-get update reads the 0600 root file without warning; kept after reboot.
Verified2026-10-18 by Sn0wAlice on 13, Proxmox VM, Debian 13 genericcloud image, kernel 6.12.113+deb13-cloud-amd64. Passes on stock (empty auth.conf.d); 0644 credential file and 0777 directory detected and fixed; apt-get update reads the 0600 root file without warning; kept after reboot.
Introduced inv0.1.0
Created, updated2026-10-18, 2026-10-18
Translationsfr