Sigma rule: Linux Command History Tampering
A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-6353c6bd0ca4, updated 2024-04-17T00:00:00.000Z.
Rule
- Title
- Linux Command History Tampering
- Status
- test
- Level
- high
- Author
- Patrick Bareiss
- Date
- 2019-03-24
- Modified
- 2024-04-17
- File
- rules/linux/builtin/lnx_shell_clear_cmd_history.yml
- Commit
- ccbb0369507f796db0b0ae6854c8a2be471b9d84
Detects commands that try to clear or tamper with the Linux command history.
This technique is used by threat actors in order to evade defenses and execute commands without them being recorded in files such as "bash_history" or "zsh_history".
Log source
- product
- linux
Detection
keywords:
- 'cat /dev/null >*sh_history'
- 'cat /dev/zero >*sh_history'
- 'chattr +i*sh_history'
- 'echo "" >*sh_history'
- 'empty_bash_history'
- 'export HISTFILESIZE=0'
- 'history -c'
- 'history -w'
- 'ln -sf /dev/null *sh_history'
- 'ln -sf /dev/zero *sh_history'
- 'rm *sh_history'
- 'shopt -ou history'
- 'shopt -uo history'
- 'shred *sh_history'
- 'truncate -s0 *sh_history'
# - 'unset HISTFILE' # prone to false positives
condition: keywordsFalse positives (as the rule lists them)
- Unknown
Tags
- attack.stealth
- attack.t1070.003
MITRE ATT&CK ids this rule names
References
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.003/T1070.003.md
- https://www.hackers-arise.com/post/2016/06/20/covering-your-bash-shell-tracks-antiforensics
- https://www.cadosecurity.com/spinning-yarn-a-new-linux-malware-campaign-targets-docker-apache-hadoop-redis-and-confluence/
Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/linux/builtin/lnx_shell_clear_cmd_history.yml
Sources and licences
SigmaHQ
"Linux Command History Tampering" by Patrick Bareiss (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules/linux/builtin/lnx_shell_clear_cmd_history.yml.
Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License
Cite this page
Dragons Eye Ransomware Tracker, "Sigma rule: Linux Command History Tampering",
entity page, dataset version ref-6353c6bd0ca4, updated 2024-04-17T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/fdc88d25-96fb-4b7c-9633-c0e417fdbd4e (accessed 2026-11-03).
Underlying source: SigmaHQ rule fdc88d25-96fb-4b7c-9633-c0e417fdbd4e, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.
Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.