TAM-H-CVR-016 · Human · Cover: Hiding the tracks
Hiding Shell History
The insider deletes, truncates or redirects command history so the commands they ran cannot be reviewed.
Shells and interpreters keep a running list of what was typed. It is one of the first things an investigator reads on a Linux, macOS or Windows machine. An insider can clear it, stop it being saved or point it to nowhere.
Typical moves are deleting the history file, running a clear command, setting HISTFILE or HISTSIZE to nothing, adding a line to a shell startup file, or using a history-off mode for a session.
The commands are not truly gone. Independent records such as EDR process trees, auditd, sudo logs, command-line auditing, and PowerShell script block logs often hold them. The missing history is itself the clue when other telemetry shows commands that history does not.
Collect history early, ship it off the host, and monitor edits to shell config.
What it looks like
- After copying a database dump with scp, an engineer runs history -c and removes the .bash_history file.
- A user adds export HISTFILE=/dev/null to their profile.
- An admin deletes the PowerShell PSReadLine history file.
Variants (4)
TAM-H-CVR-016.1Clearing Bash History+
The insider wipes the Bash command history so earlier commands are lost.
On Linux and older macOS the file is usually ~/.bash_history. Running history -c clears the live session and stops it being written at exit. Check file timestamps and size, startup file edits, auditd or EDR process records, and sudo logs for the commands.
TAM-H-CVR-016.2Clearing PowerShell History+
The insider removes PowerShell's saved command history.
PSReadLine stores history in a text file under the user profile, and any user can delete their own copy. Clear-History only affects the current session. Look for file deletes, script block logging (event 4104), and transcripts. Script block logging and transcript files, if enabled, keep what the history file lost.
TAM-H-CVR-016.3Clearing Zsh History+
The insider clears, truncates or redirects Zsh history.
Methods include deleting .zsh_history, unsetting HISTFILE, setting SAVEHIST to zero, or editing .zshrc. Examine file presence, size and timestamps, startup file edits, macOS file system events, and process telemetry for commands missing from history. Zsh is the default shell on modern Macs, so this is often the first place a Mac user would tidy up.
TAM-H-CVR-016.4Nulling Python History+
The insider points the Python history file at /dev/null so nothing is saved.
Set for one run or placed in a shell profile, this stops interactive Python commands being written to disk. Look for the setting in startup files and in process environment records, and for interactive Python use that appears in EDR but not in any history file.
Detections (12)
- DET-005Audit Logs as Insider EvidenceSystem and app audit logs record who did what and when.Confidence HighAWSAzureGCP
- DET-038EDR Telemetry for Insider CasesEDR records process, file, and network activity on endpoints and lets responders pull data.Confidence HighWindowsmacOSLinux
- DET-039Employee Activity Monitoring AgentA UAM agent on workstations records user actions for review of insider activity.Confidence MediumWindowsmacOS
- DET-046File Change MonitoringTrack changes to important files and settings with file integrity monitoring to catch tampering, staging and destructive activity.Confidence HighWindowsLinuxmacOS
- DET-047File Metadata ReviewCreated, modified, and accessed times plus type and size help place a file in time.Confidence LowWindowsmacOSLinux
- DET-070Linux File Access WatchAn auditd watch rule that records reads, writes, and attribute changes on chosen paths.Confidence MediumLinux
- DET-100PowerShell History File AbsentA user who has run PowerShell has no PSReadLine history file on disk.Confidence MediumWindows
- DET-101PowerShell History File Recreated RecentlyThe PowerShell command history file has a creation time newer than the user's first known PowerShell use.Confidence MediumWindows
- DET-102PowerShell Script LoggingModule, script block, and transcription logging record what PowerShell ran.Confidence HighWindows
- DET-137Shell History Gone on Mac or LinuxA user who has used a shell has no history file in their home folder.Confidence MediummacOSLinux
- DET-138Shell History Newly Created Despite Prior UseA history file with a recent creation time for a user who has long used the shell.Confidence MediummacOSLinux
- DET-168User Behavior BaselinesUBA compares what a user does now with their own and peers' normal.Confidence MediumWindowsmacOSIdentity
Controls (2)
- CTL-078Planning for Unpreventable AbuseSome insider acts misuse features the business needs, so no block exists; plan detection and response instead.ProcessEffort LowEffect Medium
- CTL-116Written Rules for Using Company SystemsA clear acceptable use policy sets expectations, removes excuses and gives you a basis for discipline.ProcessEffort LowEffect Medium