DET-011 · human · confidence Low

Bash Command History

The Bash history file and buffer record shell commands, but are easy to edit.

Bash holds recent commands in memory and writes them to ~/.bash_history when the shell exits. Distros commonly keep 1,000 entries in memory and 2,000 in the file, though defaults vary. Anyone can edit it with a text editor, so absence or gaps matter. Use it to see commands like scp, rsync, tar, and curl. Pair with auditd execve or EDR since history is user-controlled.

Data sources
~/.bash_historyauditd execveEDR process events
Platforms
LinuxmacOS

Logic

grep -E 'scp|rsync|curl .*-T|tar .*(czf|cJf)|nc |base64|history -c|HISTFILE' /home/*/.bash_history
Compare to auditd execve for the same user and time to spot removed lines.

False positives

Normal admin and dev command use.

Catches 5 techniques