T1003.008

/etc/passwd and /etc/shadow

Adversaries read /etc/passwd and /etc/shadow on Linux and Unix systems to extract password hashes for offline cracking. /etc/passwd contains usernames and user information (world-readable), while /etc/shadow contains the actual password hashes (root-readable only). Together they can be combined with `unshadow` and cracked with John the Ripper or Hashcat. Tools include LaZagne (shadow.py module), direct cat commands, and Python one-liners. Also includes reading from backup copies (/etc/shadow-, /etc/shadow.bak) and cloud instance metadata for default credentials. Used by multiple threat actors as a standard post-exploitation step on Linux systems.

Microsoft Sentinel / Defender
kusto
let ShadowFileAccess = DeviceFileEvents
| where Timestamp > ago(24h)
| where FolderPath in~ ("/etc/shadow", "/etc/shadow-", "/etc/shadow.bak",
                        "/etc/master.passwd", "/etc/security/passwd")
| where InitiatingProcessFileName !in~ ("passwd", "chpasswd", "useradd", "usermod",
                                         "chage", "pam_unix.so", "shadow", "login")
| project Timestamp, DeviceName, AccountName, FolderPath, ActionType,
          InitiatingProcessFileName, InitiatingProcessCommandLine;
let UnshadowCommand = DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has "unshadow"
    or (ProcessCommandLine has "/etc/shadow" and ProcessCommandLine has "/etc/passwd")
    or ProcessCommandLine has_any ("john", "hashcat") and ProcessCommandLine has "shadow"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine;
let LaZagneShadow = DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has "lazagne"
    and ProcessCommandLine has_any ("shadow", "linux", "all")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine;
union ShadowFileAccess, UnshadowCommand, LaZagneShadow
| sort by Timestamp desc
critical severity high confidence

Data Sources

File: File Access Process: Process Creation Command: Command Execution

Required Tables

DeviceFileEvents DeviceProcessEvents

False Positives

  • System package managers (apt, yum, dnf) modifying /etc/shadow during user account package installations
  • Configuration management tools (Ansible, Puppet, Chef) managing user accounts and updating /etc/shadow
  • Legitimate password change operations by passwd, chpasswd, or chage tools — these access /etc/shadow by design
  • Backup software with root access reading /etc/shadow as part of full system configuration backup
  • Security scanning tools (Lynis, OpenSCAP) performing compliance checks that read /etc/shadow metadata

Unlock Pro Content

Get the full detection package for T1003.008 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections