DET-137 · human · confidence Medium

Shell History Gone on Mac or Linux

A user who has used a shell has no history file in their home folder.

On macOS and Linux, shells write command history to a file in the home directory, such as .bash_history or .zsh_history. If a user who has been active in a terminal has no file, the history may have been deleted or redirected to /dev/null. Look for HISTFILE changes in profile files, symlinks to /dev/null, and delete events. Note that macOS defaults to zsh, so check .zsh_history too.

Data sources
Endpoint file listingEDR process eventsauditd
Platforms
macOSLinux

Logic

for each home dir: test -s ~/.bash_history -o -s ~/.zsh_history
Flag when empty/missing but auth logs show interactive SSH or terminal sessions. Also grep profiles for 'unset HISTFILE', 'HISTSIZE=0', or 'ln -sf /dev/null'.

False positives

Users who never use a shell, or whose history is set elsewhere. Non-login sessions may not save.

Catches 2 techniques