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

Account Enumeration

This note documents detection patterns related to Linux Account Enumeration on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
Shell historycat /etc/passwdFull local account enumerationCriticalVery common first discovery step.
Shell historygetent passwdNSS-aware account enumerationCriticalBetter than passwd-only on domain-integrated systems.
Shell historyidCurrent identity checkHighCommon first foothold command.
Shell historywhoamiCurrent user confirmationHighTypical first manual operator action.
Shell historygroupsGroup membership discoveryCriticalImmediate privilege assessment.
Shell historysudo -lPrivilege enumerationCriticalVery high-value attacker command.
Shell historylastHistorical account usageHighOperator context gathering.
Shell historywLive logged-in usersHighLateral target awareness.
Shell historywhoActive sessionsHighOperator situational awareness.
Shell historyfingerLegacy user discoveryMediumRare but useful when present.
Shell historyls /homeUser inventoryHighSimple account discovery.
auditdrepeated identity commandsProcess attributionCriticalBest attribution if enabled.
journalctlsudo enumeration tracesRuntime clueHighUseful around privilege attempts.
File timestampspasswd/group reads near footholdTimeline anchorMediumContext strengthens value.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Enumeration immediately after loginManual foothold behaviorCriticalCommon attacker progression.
sudo -l followed by GTFOBins abusePrivilege escalation chainCriticalStrong hostile sequence.
getent passwd on server with LDAPDomain-aware reconnaissanceCriticalHigher operator maturity.
last plus SSH movementTarget selectionHighStrong lateral planning clue.
Home listing plus key huntingCredential collectionCriticalCommon chain.
Enumeration under service accountSuspicious contextCriticalOften exploitation-driven shell.
Repeated identity checks after sudoPrivilege verificationHighCommon escalation flow.
w plus SSH to other hostsLive user targetingCriticalLateral intent clue.
Enumeration plus hidden payload stagingActive intrusionCriticalStrong broader compromise context.
Minimal commands but precise privilege checksMature operator behaviorHighSkilled hands-on-keyboard clue.

Common Tools

ToolUsage
cat /etc/passwdLocal user inventory.
getent passwdFull NSS account lookup.
idUID/GID check.
groupsGroup membership.
sudo -lSudo rights discovery.
lastHistorical sessions.
w / whoActive sessions.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Accounts/etc/passwdCriticalPrimary local identity source.
Groups/etc/groupCriticalPrivilege context.
Sudo rights/etc/sudoers, /etc/sudoers.d/CriticalEscalation surface.
Session logs/var/log/auth.log, /var/log/wtmpHighAccount activity context.
Shell history.bash_history, .zsh_historyCriticalEnumeration commands.
Audit logs/var/log/audit/audit.logCriticalProcess attribution.

MITRE ATT&CK References

  • T1087 Account Discovery
  • T1087.001 Local Account
  • T1069 Permission Groups Discovery

Decision Tree

  1. Was account enumeration performed?

    • Search shell history and audit logs.
  2. Was privilege checked?

    • groups, id, sudo -l.
  3. Were active users reviewed?

    • w, who, last.
  4. Did enumeration lead to escalation?

    • Sudo abuse, key hunting, SSH movement.
  5. Is enumeration context suspicious?

    • Service account, web shell, fresh login.
  6. Pivot

    • User list → targets.
    • Groups → escalation opportunities.
    • Timeline → foothold progression.
  7. Confirm hostile enumeration

    • Identity commands + privilege checks + intrusion timing = strong reconnaissance finding.

Example Detection Templates

Grep

grep -R "cat /etc/passwd\|getent passwd\|id\|whoami\|groups\|sudo -l\|last\|w\|who" /home/*/.bash_history /root/.bash_history 2>/dev/null
grep -R "ls /home\|finger" /home/*/.bash_history /root/.bash_history 2>/dev/null

Journalctl

journalctl | grep sudo

File Inspection

stat /etc/passwd
cat /etc/sudoers 2>/dev/null

Sigma

title: Linux Account Enumeration
id: linux-account-enumeration
status: experimental
description: Detects suspicious account and privilege enumeration activity on Linux systems
logsource:
  product: linux
detection:
  selection_keywords:
    message|contains:
      - 'cat /etc/passwd'
      - 'getent passwd'
      - 'sudo -l'
      - 'groups'
  condition: selection_keywords
fields:
  - message
  - hostname
falsepositives:
  - Legitimate administration
level: medium
tags:
  - attack.discovery
  - attack.t1087

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
AuditdTrack discovery commandsHighStrong attribution.
Least privilegeRestrict unnecessary sudo rightsCriticalReduces escalation payoff.
Shell loggingPreserve command history centrallyHighRetains early discovery steps.
Service account controlLimit shell accessHighReduces abuse context.

Fast Triage Checks

QuestionCommand / ArtifactWhy It Matters
Was passwd read?grep historyImmediate discovery clue.
Was sudo checked?grep sudo -lEscalation intent.
Were active users inspected?grep w/who/lastTarget awareness.
Did enumeration lead to privilege abuse?correlate next commandsAttack progression.
Was account context suspicious?user/process contextSignal strength.

High Value Grep Strings

PatternWhy It Matters
cat /etc/passwdLocal account discovery.
getent passwdFull account lookup.
idIdentity check.
groupsPrivilege check.
sudo -lEscalation reconnaissance.
lastSession history review.
wLive user discovery.

Analyst Notes

ScenarioInterpretation
sudo -l immediately after loginStrong escalation intent.
getent passwd on LDAP-integrated hostDomain-aware reconnaissance.
w then SSH movementLive target selection likely.
Enumeration under www-dataHighly suspicious foothold behavior.
Minimal commands but precise checksMature operator behavior.
Enumeration followed by key accessCredential path beginning.