DET-138 · human · confidence Medium
Shell History Newly Created Despite Prior Use
A history file with a recent creation time for a user who has long used the shell.
If a history file was deleted, the shell creates a new one with a new birth time on the next session. A fresh creation time with earlier logins on record suggests someone wiped it. Check birth time with stat on Linux or macOS and compare with the first interactive login in auth logs or wtmp. The new file usually holds only recent commands.
- Data sources
- Endpoint file metadatawtmp / auth.logEDR
- Platforms
- macOSLinux
Logic
stat -c '%w %n' ~/.bash_history (Linux) or stat -f '%SB %N' ~/.zsh_history (macOS) Compare to the first entry in `last <user>`. Flag when birth time is more than 7 days after first login and no reimage occurred.
False positives
OS reinstalls, restored profiles, and editors that rewrite the file.