Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / LINUX / LATERAL MOVEMENT

Sensitive File Collection

This note documents detection patterns related to Sensitive File Access on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
Shell historycat /etc/shadowPassword hash accessCriticalHigh-confidence credential access.
Shell historycat /etc/passwdAccount enumerationHighOften paired with shadow access.
Shell historysudo cat /etc/shadowPrivileged credential theftCriticalStrong escalation evidence.
Shell historygrep root /etc/shadowTargeted credential inspectionCriticalStrong operator intent.
Shell historycat ~/.ssh/id_rsaPrivate key accessCriticalCredential theft or reuse.
Shell historycat ~/.ssh/authorized_keysAccess path reviewHighPersistence reconnaissance.
Shell historycat /root/.bash_historyRoot activity theftCriticalPost-compromise intelligence gathering.
Shell historyls /root/.sshRoot key enumerationCriticalStrong privilege abuse indicator.
Shell historyfind / -name "*.pem"Key huntingCriticalBroad credential search.
Shell historyfind / -name "*.key"Key huntingCriticalBroad credential search.
Shell historycat /etc/hostsInternal environment mappingMediumOften early reconnaissance.
auditdread access to sensitive filesFile truthCriticalBest attribution if enabled.
File access timestampsatime changesRead timing anchorHighUseful if enabled.
journalctlprivileged file read contextRuntime clueMediumLimited but sometimes useful.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Shadow access after sudoCredential theft progressionCriticalCommon post-escalation move.
Key file access after SSH footholdCredential expansionCriticalLateral movement preparation.
Root history accessOperator situational awarenessHighIndicates hands-on intrusion.
Broad file huntingfind across key extensionsCriticalCredential collection pattern.
Sensitive file copied to tempExfil stagingCriticalStrong malicious chain.
Sensitive file plus scp/curlExfiltration pathCriticalStrong compromise signal.
Access under service accountHighly suspiciousCriticalOften exploitation context.
Access followed by hash cracking prepCredential operationCriticalStrong intent evidence.
Multiple key types searchedBroad credential harvestingHighOperator maturity indicator.
Root-only file touched recentlyPrivileged compromiseCriticalSeverity amplifier.

Common Tools

ToolUsage
catDirect file read.
lessInteractive review.
grepTargeted extraction.
findCredential hunting.
cpFile staging.
tarBulk archive for exfiltration.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Password hashes/etc/shadowCriticalCredential theft target.
Accounts/etc/passwdHighUser inventory.
SSH private keys~/.ssh/id_*CriticalCredential material.
Authorized keys~/.ssh/authorized_keysHighAccess persistence context.
Root history/root/.bash_historyCriticalHigh-value attacker target.
Root SSH/root/.ssh/CriticalPrivileged credential target.
Audit logs/var/log/audit/audit.logCriticalFile read attribution.
Temp dirs/tmp, /var/tmp, /dev/shmHighStaged sensitive copies.

MITRE ATT&CK References

  • T1003 OS Credential Dumping
  • T1552 Unsecured Credentials
  • T1552.001 Credentials in Files

Decision Tree

  1. Was sensitive file accessed?

    • Search shell history and audit logs.
  2. Which file?

    • Shadow, keys, root history, configs.
  3. Was privilege needed?

    • Check sudo or root context.
  4. Was file copied or exfiltrated?

    • Temp paths, scp, curl, archives.
  5. Was credential reused?

    • Follow into SSH movement or persistence.
  6. Pivot

    • File → credential type.
    • User → privilege context.
    • Timestamp → intrusion timeline.
  7. Confirm credential access

    • Sensitive file read + suspicious sequence = strong credential collection.

Example Detection Templates

Grep

grep -R "cat /etc/shadow\|cat /etc/passwd\|id_rsa\|authorized_keys\|/root/.bash_history\|find / -name \".*pem\"" /home/*/.bash_history /root/.bash_history 2>/dev/null
grep -R "shadow\|id_rsa\|authorized_keys\|.pem\|.key" /home/*/.bash_history /root/.bash_history 2>/dev/null
grep -R "sudo cat /etc/shadow" /home /root 2>/dev/null

Journalctl

journalctl | grep -E "shadow|authorized_keys|id_rsa"

File Inspection

find /home /root -name "*.pem" -o -name "*.key" 2>/dev/null
stat /etc/shadow

Sigma

title: Linux Sensitive File Access
id: linux-sensitive-file-access
status: experimental
description: Detects suspicious access to sensitive credential-bearing files on Linux
logsource:
  product: linux
detection:
  selection_keywords:
    message|contains:
      - '/etc/shadow'
      - 'id_rsa'
      - 'authorized_keys'
      - '/root/.bash_history'
  condition: selection_keywords
fields:
  - message
  - hostname
falsepositives:
  - Legitimate administration
level: high
tags:
  - attack.credential_access
  - attack.t1552.001

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Least privilegeRestrict access to sensitive filesCriticalCore credential defense.
AuditdMonitor reads of high-value filesCriticalStrong attribution.
Key hygieneProtect private keys and rotate when exposedHighLimits credential reuse.
Root access controlLimit sudo/root shell spreadHighReduces privileged file exposure.
File integrityWatch sensitive path reads/writesHighImportant high-value coverage.

Fast Triage Checks

QuestionCommand / ArtifactWhy It Matters
Was shadow accessed?grep history / auditCredential theft check.
Were keys viewed?inspect ssh pathsLateral movement clue.
Was root history read?grep shell historyOperator awareness clue.
Was file copied?inspect temp dirsExfil staging.
Was file transferred?scp / curl historyExfil proof.
Was privilege escalated first?sudo timelineAttack chain reconstruction.

High Value Grep Strings

PatternWhy It Matters
/etc/shadowPassword hash target.
/etc/passwdUser inventory.
id_rsaPrivate key access.
authorized_keysPersistence/access review.
/root/.bash_historyRoot activity theft.
.pemKey hunting.
.keyKey hunting.

Analyst Notes

ScenarioInterpretation
Shadow access after sudoStrong credential theft chain.
Root key readHigh-severity credential compromise.
Sensitive file copied to tempExfil staging likely.
Key hunting across filesystemBroad credential harvest.
Root history read earlyOperator gathering context fast.
Shadow + SSH movementCredential-to-lateral chain.