T1552.003 Sumo Logic CSE · Sumo

Detect Bash History in Sumo Logic CSE

Adversaries may search the command-line history on compromised systems for insecurely stored credentials. On Linux and macOS, shells like Bash and Zsh maintain history files (~/.bash_history, ~/.zsh_history) that capture all commands including those containing passwords passed as arguments. On Windows, PowerShell maintains a persistent history file at %USERPROFILE%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt. Users frequently type credentials as command-line arguments to tools like curl, ssh, mysql, psql, git, and aws CLI, which then persist in shell history. Kinsing malware is a known user of this technique to harvest credentials from containerized environments.

MITRE ATT&CK

Tactic
Credential Access
Technique
T1552 Unsecured Credentials
Sub-technique
T1552.003 Shell History
Canonical reference
https://attack.mitre.org/techniques/T1552/003/

Sumo Detection Query

Sumo Logic CSE (Sumo)
sql
(_sourceCategory="linux/audit" OR _sourceCategory="windows/sysmon")
| where (name matches "*.bash_history" OR name matches "*.zsh_history" OR name matches "*/.history" OR name matches "*.sh_history"
  OR TargetFilename matches "*ConsoleHost_history.txt*" OR TargetFilename matches "*PSReadLine*"
  OR CommandLine matches "*.bash_history*" OR CommandLine matches "*.zsh_history*"
  OR CommandLine matches "*ConsoleHost_history.txt*" OR CommandLine matches "*Get-History*" OR CommandLine matches "*PSReadLine*")
| where !(comm = "bash" OR comm = "zsh" OR comm = "sh" OR comm = "sshd"
  OR Image matches "*\\powershell.exe" OR Image matches "*\\pwsh.exe")
| if (!isNull(name) AND name != "", name, if(!isNull(TargetFilename) AND TargetFilename != "", TargetFilename, "N/A")) as HistoryFile
| if (!isNull(comm) AND comm != "", comm, if(!isNull(Image) AND Image != "", Image, "unknown")) as ProcessName
| fields _messageTime, _sourceHost, auid, ProcessName, HistoryFile, CommandLine, User
| sort by _messageTime desc
high severity high confidence

Detects access to Linux shell history files via auditd OPEN syscall telemetry and Windows PowerShell history access via Sysmon process creation (EventCode 1) and file creation (EventCode 11) events. Normalizes Linux auditd fields and Windows Sysmon fields into unified output columns for cross-platform analyst review of T1552.003 credential harvesting activity.

Data Sources

Sumo Logic SIEMLinux Auditd via Sumo Logic CollectorWindows Sysmon (Event ID 1, 11)Sumo Logic Cloud SIEM Enterprise (CSE)

Required Tables

_sourceCategory=linux/audit_sourceCategory=windows/sysmon

False Positives & Tuning

  • Compliance scanning tools (Lynis, OpenSCAP, CIS-CAT) that audit shell history file existence and permissions as part of CIS benchmark hardening checks
  • Developer shell history search utilities (hstr, mcfly, fzf with shell integration) that access history files during interactive terminal sessions generating process events
  • Container management platforms executing backup or migration operations that include home directory contents from within containerized Linux environments
Download portable Sigma rule (.yml)

Other platforms for T1552.003


Testing Methodology

Validate this detection against 4 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.

  1. Test 1Read bash_history File for Credentials

    Expected signal: Linux auditd EXECVE records for cat and grep with .bash_history path. OPEN syscall for .bash_history. Process chain visible in auditd records.

  2. Test 2Access Another User's bash_history

    Expected signal: Linux auditd: SYSCALL with uid of calling user but auid of root for the cat command. OPEN syscall for /root/.bash_history. sudo usage logged in /var/log/auth.log.

  3. Test 3Read Windows PowerShell History

    Expected signal: Sysmon Event ID 1: cmd.exe with 'type' and 'ConsoleHost_history.txt' in command line. Sysmon Event ID 11: file access for ConsoleHost_history.txt.

  4. Test 4Enumerate All Shell History Files on System

    Expected signal: Linux auditd EXECVE for find with .bash_history pattern. Multiple OPEN syscalls for each discovered history file. Process chain showing find then cat.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections