Detect /etc/passwd and /etc/shadow in Sumo Logic CSE
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.
MITRE ATT&CK
- Tactic
- Credential Access
- Technique
- T1003 OS Credential Dumping
- Sub-technique
- T1003.008 /etc/passwd and /etc/shadow
- Canonical reference
- https://attack.mitre.org/techniques/T1003/008/
Sumo Detection Query
(_sourceCategory=linux* OR _sourceCategory=*auditd* OR _sourceCategory=*syslog*)
| where (
(
(%"file.path" in ("/etc/shadow", "/etc/shadow-", "/etc/shadow.bak", "/etc/master.passwd", "/etc/security/passwd")
OR ("name" in ("/etc/shadow", "/etc/shadow-", "/etc/shadow.bak", "/etc/master.passwd", "/etc/security/passwd")))
AND !(%"process.name" in ("passwd", "chpasswd", "useradd", "usermod", "chage", "login", "newusers", "shadow"))
)
OR matches(%"process.command_line", "(?i)unshadow")
OR (
matches(%"process.command_line", "(?i)lazagne")
AND matches(%"process.command_line", "(?i)(shadow|linux|all)")
)
OR (
matches(%"process.command_line", "/etc/shadow")
AND matches(%"process.command_line", "/etc/passwd")
)
OR (
%"process.name" in ("john", "hashcat")
AND matches(%"process.command_line", "(?i)shadow")
)
OR (
%"process.name" in ("cat", "cp", "scp", "python", "python3", "perl", "ruby", "bash", "sh")
AND matches(%"process.command_line", "/etc/shadow")
)
)
| if (matches(%"process.name", "(?i)(john|hashcat|unshadow|lazagne)"), "CRITICAL",
if (matches(%"process.name", "(?i)(python|perl|ruby|bash|sh|cat|cp|scp)"), "HIGH", "MEDIUM")) as risk_level
| fields _messageTime, _sourceHost, %"user.name", %"process.pid", %"process.name", %"process.command_line", %"file.path", risk_level
| sort by _messageTime desc Detects unauthorized access to /etc/shadow and related Linux password files, and identifies execution of credential extraction tools targeting shadow hashes. Uses Sumo Logic CSE normalized fields from Linux auditd and syslog sources. Risk-tiered by tool category.
Data Sources
Required Tables
False Positives & Tuning
- Sumo Logic collector itself or its installed scripts running health checks that traverse /etc/ and trigger file open events against shadow
- Legitimate privileged user (root) directly reading /etc/shadow with cat or python during account management scripting — requires contextual review of surrounding session activity
- Security information and event management (SIEM) forwarder agents that perform log integrity checks on /etc/shadow to detect tampering
- LDAP/NIS migration scripts that read /etc/shadow to migrate local accounts to a directory service during infrastructure consolidation
Other platforms for T1003.008
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Direct /etc/shadow Read with cat
Expected signal: Auditd file watch event (type=SYSCALL, syscall=openat) for /etc/shadow with exe=/bin/cat. DeviceFileEvents (if MDE Linux agent) for /etc/shadow read by cat. Process creation event for cat command with /etc/shadow argument.
- Test 2Unshadow and Password Hash Preparation
Expected signal: Auditd SYSCALL events for openat on both /etc/passwd and /etc/shadow with exe=/usr/bin/unshadow. File creation event for /tmp/atomic_hashes.txt. DeviceProcessEvents for unshadow execution. DeviceFileEvents for shadow and passwd access.
- Test 3LaZagne Linux Shadow Module
Expected signal: DeviceNetworkEvents for GitHub download connection. DeviceProcessEvents for lazagne execution with 'linux -shadow' arguments. Auditd openat events for /etc/shadow with exe=/tmp/lazagne. DeviceFileEvents for /etc/shadow access.
References (6)
- https://attack.mitre.org/techniques/T1003/008/
- https://github.com/AlessandroZ/LaZagne
- https://linux.die.net/man/8/unshadow
- https://www.openwall.com/john/
- https://linux-audit.com/monitoring-of-etc-shadow-using-linux-audit/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1003.008/T1003.008.md
Unlock Pro Content
Get the full detection package for T1003.008 including response playbook, investigation guide, and atomic red team tests.