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

New User Creation

This note documents detection patterns related to New User Creation on Linux systems.


Direct Indicators

SourceGrep Pattern / ArtifactMeaningForensic ValueNotes
/etc/passwdNew account entryLocal user account createdCriticalPrimary account creation artifact.
/etc/shadowNew password hash entryPassword-bearing user addedCriticalConfirms credential-backed account presence.
/etc/groupUser added to privileged groupUser granted functional accessCriticalCheck sudo, wheel, adm, docker, lxd.
auth.log / secureuseraddAccount creation utility executedCriticalStrong evidence of explicit user creation.
auth.log / securenew userAccount creation log messageCriticalCommon syslog wording on some distros.
auth.log / securegroupaddGroup creation or manipulationHighOften adjacent to user provisioning.
auth.log / secureusermodExisting account modifiedCriticalUsed to add attacker to privileged groups.
auth.log / secureadduserDebian-style account creation commandCriticalEquivalent to useradd in many cases.
sudo logs in auth.log / secureCOMMAND=/usr/sbin/useraddAccount creation via sudoCriticalHigh-confidence operator action.
sudo logs in auth.log / secureCOMMAND=/usr/sbin/adduserAccount creation via sudoCriticalHigh-confidence operator action.
sudo logs in auth.log / secureCOMMAND=/usr/sbin/usermodPrivilege modification via sudoCriticalOften more important than pure account creation.
journalctluseradd, adduser, usermodJournald record of account operationsCriticalEssential on journal-centric systems.
/home/New home directoryNewly provisioned local user workspaceHighDirectory creation often accompanies local user creation.
/var/spool/cron/New per-user cron fileNewly created user already used for persistenceHighStrong sign of attacker operationalization.
/etc/sudoers or /etc/sudoers.d/New sudo ruleUser granted privilege escalation pathCriticalMay be quieter than group membership changes.
Shell historyuseradd, adduser, usermod, passwdInteractive account creation commandsCriticalVery high value if preserved.
auditd logsexecve of useradd, adduser, usermodProcess-level account management evidenceCriticalBest source when enabled.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Unknown account appears between known baseline usersCompare current /etc/passwd against expected host roleCriticalMost useful when hostname purpose is known.
Service or pseudo-user with interactive shellShell set to /bin/bash, /bin/sh, /bin/zshCriticalFake service users often expose attacker mistakes.
New user with UID >= 1000 on serverHuman-style local account on server that should not have oneHighEspecially suspicious on appliances, web servers, DC-like infra, containers.
New account added shortly after SSH compromiseTimeline correlation between login and local user additionCriticalVery common post-compromise action.
New account immediately added to sudo or wheelPrivilege-ready persistenceCriticalStrong evidence of hostile persistence.
New .ssh/authorized_keys under fresh home directoryKey-based persistence for new local accountCriticalOften used instead of password logins.
Passwordless sudo granted to new accountNOPASSWD rule presentCriticalExtremely strong persistence indicator.
Home directory ownership mismatchFiles owned by unusual UID/GIDMediumCan reveal renamed or partially deleted account.
New account with misleading namebackup, sysadmin, service, support, oracle, nginxadmHighCommon camouflage pattern.
Fresh account with no legitimate provisioning evidenceNo ticket/change record, no CM/Ansible trailHighOperational context strengthens case.

Common Tools

ToolUsage
useraddNative low-level user creation utility.
adduserHigher-level interactive user creation wrapper on Debian-like systems.
usermodModifies existing accounts, often used to add attacker to privileged groups.
passwdSets or changes password for newly created or hijacked account.
chshChanges login shell, sometimes to make pseudo-users interactive.
chageAlters password aging and expiry to stabilize persistence.
vipw / direct file editingManual modification of /etc/passwd and /etc/shadow.
visudoUsed to add sudo privileges directly.
echo >> /etc/passwdCrude direct account insertion seen in low-skill intrusion or malware scripts.
Configuration management toolingAnsible, cloud-init, bash bootstrap, user-data scripts may legitimately create users and must be ruled out.

Relevant Artifacts

ArtifactPath / CommandForensic ValueNotes
Local user database/etc/passwdCriticalPrimary source for local accounts, shell, UID, home path.
Password database/etc/shadowCriticalIndicates password-backed access and hash presence.
Group memberships/etc/groupCriticalReview sudo, wheel, docker, adm, lxd.
Account defaults/etc/default/useraddMediumHelps interpret default home/shell behavior.
Sudo configuration/etc/sudoers, /etc/sudoers.d/CriticalCheck for grants to new accounts.
SSH persistence/home/*/.ssh/authorized_keys, /root/.ssh/authorized_keysCriticalNew account often paired with SSH key persistence.
Home directory creation/home/<user>/HighInspect timestamps, shell history, tool staging.
Shell history/home/<user>/.bash_history, .zsh_history, /root/.bash_historyCriticalAccount creation and immediate follow-on actions.
Authentication logs/var/log/auth.log, /var/log/secureCriticalMain host-based log source for sudo/account changes.
JournaldjournalctlCriticalMay preserve account activity absent flat logs.
Last login datalastlog, last, /var/log/wtmp, /var/log/btmpHighShows whether new account was used.
Audit logs/var/log/audit/audit.logCriticalBest process accountability if present.
Cron files/var/spool/cron/, /etc/cron*HighNew user may have immediate scheduled persistence.
Temporary directories/tmp, /var/tmp, /dev/shmMediumScripts that created the user may still exist.
Package / orchestration logscloud-init logs, Ansible logs, CI/CD logsHighNeeded to eliminate legitimate provisioning.

MITRE ATT&CK References

  • T1136 Create Account
  • T1136.001 Local Account
  • T1098 Account Manipulation
  • T1098.004 SSH Authorized Keys
  • T1548 Abuse Elevation Control Mechanism

Decision Tree

  1. Is a suspicious local account present?

    • Inspect /etc/passwd, /etc/shadow, /etc/group.
    • Determine username, UID, shell, home directory, group membership.
  2. Is the account actually new or merely newly noticed?

    • Compare against host baseline, golden image, deployment scripts, backup copies, config management, or previous snapshots.
    • Check file timestamps on /etc/passwd, /etc/shadow, /etc/group.
  3. How was the account created?

    • Search auth.log / secure / journalctl for useradd, adduser, usermod, passwd, sudo.
    • Search shell history for account management commands.
    • Review auditd for execve if available.
  4. Was privilege granted?

    • Inspect membership in sudo, wheel, docker, lxd, adm.
    • Inspect /etc/sudoers and /etc/sudoers.d/.
    • Determine whether shell is interactive and whether account can escalate.
  5. Was the account used?

    • Review last, lastlog, SSH login logs, authorized_keys, bash history.
    • Check whether the account established persistence, downloaded payloads, or opened network connections.
  6. Pivot

    • Source logon event → identify actor/session that created the account.
    • New home directory → inspect commands, keys, tools, payloads.
    • Group changes → determine escalation objective.
    • Related SSH artifacts → determine remote persistence plan.
  7. Confirm maliciousness

    • Unknown account + no legitimate provisioning trail + privileged group membership + SSH key or sudo access = strong malicious persistence finding.

Example Detection Templates

Grep

grep -Ei "useradd|adduser|usermod|groupadd|passwd|new user" /var/log/auth.log /var/log/secure 2>/dev/null
grep -Ei "COMMAND=/usr/sbin/(useradd|adduser|usermod)|COMMAND=/usr/bin/passwd" /var/log/auth.log /var/log/secure 2>/dev/null
grep -E '^(sudo|wheel|adm|docker|lxd):' /etc/group
awk -F: '($3 >= 1000 || $3 == 0) {print $1,$3,$6,$7}' /etc/passwd
find /home -maxdepth 1 -mindepth 1 -type d -printf '%TY-%Tm-%Td %TT %u %g %p\n' 2>/dev/null | sort

Journalctl

journalctl | grep -Ei "useradd|adduser|usermod|groupadd|passwd|sudo"
journalctl _COMM=sudo | grep -Ei "useradd|adduser|usermod|passwd"

Auditd

ausearch -m EXECVE -i | grep -Ei "useradd|adduser|usermod|passwd"
ausearch -m USER_CHAUTHTOK,ADD_USER,DEL_USER,ADD_GROUP,DEL_GROUP -i

Sigma

title: Linux Local User Creation or Account Privilege Manipulation
id: linux-local-user-creation-or-modification
status: experimental
description: Detects account creation or modification activity on Linux systems that may indicate attacker persistence
logsource:
  product: linux
  service: auth
detection:
  selection_keywords:
    message|contains:
      - 'useradd'
      - 'adduser'
      - 'usermod'
      - 'new user'
      - 'groupadd'
  condition: selection_keywords
fields:
  - message
  - hostname
  - process
  - user
falsepositives:
  - Legitimate administrator provisioning
  - Configuration management
  - Cloud-init or image bootstrap processes
level: high
tags:
  - attack.persistence
  - attack.t1136
  - attack.t1136.001
  - attack.t1098

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Account governanceMaintain strict local account baseline per host roleCriticalUnknown local users should be immediately obvious.
Privileged accessRestrict sudo rights to tightly managed groupsCriticalReduces usefulness of newly created accounts.
SSH hardeningDisable password auth where possible and enforce key hygieneHighLimits attacker value from quick local user creation.
Centralized identityPrefer centralized auth over unmanaged local accountsHighShrinks local persistence surface.
MonitoringAlert on useradd, adduser, usermod, passwd, sudoers changesCriticalHigh-fidelity administrative abuse detection.
File integrity monitoringWatch /etc/passwd, /etc/shadow, /etc/group, /etc/sudoers*CriticalExcellent invariant detection surface.
AuditdEnable process auditing for user and privilege management commandsHighGives process-level truth often missing from flat logs.
Change controlTie account creation to ticketing / automation / CM evidenceHighSpeeds false-positive elimination.
SSH key reviewMonitor authorized_keys creation for new accountsHighAttackers frequently pair account creation with key persistence.
Periodic reviewRegularly enumerate accounts, shells, UIDs, and privileged groupsHighPrevents long-lived unnoticed persistence.