← All articles
Blog

Anti-forensics: how attackers cover their tracks, and the evidence that survives

Anti-forensics techniques from the investigator's side: log clearing, timestomping, wiping, deleted shell history, and the records each one leaves.

2 December 2026 8 min read

Anti-forensics covers the steps attackers take after, or during, an intrusion to make it harder to reconstruct: removing records, concealing what they did, or planting misleading traces. Clearing event logs, deleting tools after use, faking file timestamps, wiping files, switching off auditing and erasing shell history are the everyday forms; MITRE ATT&CK groups most of them under the Defense Evasion tactic.

The good news for investigators is that anti-forensics rarely works completely. Every action on a computer is recorded in several places by components that know nothing about each other, and an attacker who removes one record usually creates another in doing so. This article goes through the common techniques from the investigator's side: what each one removes, what it leaves behind, and how to investigate a host that someone has tried to clean.

Why anti-forensics rarely works

Researchers often group anti-forensics into four kinds: hiding data, wiping artifacts, obscuring the trail, and attacking the tools and examiners themselves. All four run into the same problem: redundancy. A program that runs on Windows can be recorded in process creation events, Prefetch, Amcache, BAM, SRUM and the USN Journal at once. A file that is deleted leaves its creation and deletion in the USN Journal and often its record in the $MFT. Clearing a log is itself logged.

So the useful question in a cleaned-up investigation is rarely "what was erased?" alone, but "what did erasing it leave, and which independent sources still hold the original facts?". A gap in the evidence, explained by an anti-forensic act, is itself a finding: it shows intent and often dates the end of the attacker's session.

The techniques and what survives them

TechniqueWhat it removesWhat usually survives
Clearing event logsThe records in the cleared log1102 (Security) or 104 (other logs) naming the account; forwarded copies; older .evtx in shadow copies; carvable records
Changing the audit policyFuture Security events of that type4719 for each subcategory changed; the gap itself
Stopping the event log service or deleting .evtx filesLogging from that point; the filesEvent 1100 or a sudden gap; the deletion in the USN Journal; service control commands in process creation
Disabling Defender or EDRDetections and telemetryDefender operational events for protection or configuration changes; the commands or registry changes that did it
TimestompingThe true creation and modification times shown by Explorer$FILE_NAME times in the $MFT, USN records, execution artifacts
Deleting tools and staged filesThe files themselvesUSN create and delete records; $MFT entries until reused; Prefetch, Amcache and ShimCache for executables
Secure wiping (SDelete, cipher /w)File contentsThe wiping tool's own execution; SDelete's tell-tale renames in the USN Journal
Clearing shell historyPSReadLine or bash historyPowerShell 4104, auditd, the deletion itself
Deleting shadow copiesOlder versions of files and logsvssadmin, wmic shadowcopy or wbadmin in process creation; Volume Shadow Copy service events
Renaming toolsThe obvious file nameAmcache SHA-1, Sysmon OriginalFileName, Prefetch paths
Encoding commandsReadable command linesPowerShell script block logging records the decoded code

Log clearing

Clearing the Security log writes event 1102 into the fresh log, with the account that cleared it; clearing any other log writes event 104 into the System log. Both are written by the event log service regardless of audit policy. A burst of 104s in the same second means every log was cleared in a loop, a common late step in ransomware intrusions.

The cleared records are not always gone. Logs forwarded to a SIEM or Windows Event Forwarding are untouched. Volume Shadow Copies often hold older versions of the .evtx files. Event records can be carved from unallocated space and the page file. And the activity the logs described is usually recorded elsewhere: Prefetch, Amcache, the USN Journal and the registry do not depend on the event logs at all.

Switching off what records

Quieter than clearing a log is stopping it from recording in the first place. auditpol changes produce 4719 events, one per subcategory, which Windows logs whatever the audit policy says. Disabling Microsoft Defender's real-time protection or adding exclusions produces Defender operational events and registry changes under the Defender policy keys. Stopping Sysmon or unloading its driver leaves a gap in the Sysmon log while other logs continue (see the Sysmon guide).

In every case, look for the moment a source goes quiet while others keep recording. That moment is usually close to the start of the activity the attacker most wanted to hide.

Deleting and wiping files

Ordinary deletion removes a file's directory entry and marks its $MFT record and clusters as free; until they are reused, the record and often the contents remain. The USN Journal records the creation, every change and the deletion of each file, with times to the millisecond, so a tool that was copied in, run and deleted typically leaves a complete life story there. If it was an executable, Prefetch, Amcache and ShimCache add proof that it ran and its SHA-1 hash.

Wiping tools overwrite the contents first. Sysinternals SDelete, for example, overwrites the data and renames the file repeatedly before deleting it, which leaves a recognisable pattern of renames to names made of repeated letters in the USN Journal. cipher /w overwrites free space. Both are programs that run, so their own execution evidence remains, and wiping a file does not remove the records of its earlier creation or use.

Clearing shell history

On Windows, PowerShell's PSReadLine module saves typed commands to ConsoleHost_history.txt in each user's profile (PowerShell history). Attackers delete the file or run Clear-History (which only clears the session's in-memory history). With script block logging on, every command still appears in event 4104, decoded, regardless of the history file.

On Linux, attackers clear bash history in several ways: history -c (clears the current session's list), unset HISTFILE or export HISTFILE=/dev/null (stops the session writing at exit), HISTSIZE=0, deleting or truncating ~/.bash_history, linking it to /dev/null, or starting commands with a space when HISTCONTROL ignores them. What survives:

  • auditd records executed commands (execve) independently of the shell, where it is configured to.
  • The bash history file's own metadata: a history file that is empty, tiny, older than the account's last logon, or a symbolic link to /dev/null is a finding in itself.
  • Login records and auth logs still show who logged in, from where and when, and sudo logs each privileged command.
  • Other shells and tools keep their own histories (zsh, Python, MySQL, less), and command output often lands in files the attacker forgot.

How long bash history is kept depends on HISTSIZE and HISTFILESIZE, which distributions set differently; a long-lived account's file usually holds only the most recent few hundred to few thousand commands.

Faking timestamps

Timestomping changes a file's timestamps to hide it among older files. On NTFS the common tools change the $STANDARD_INFORMATION times but not the $FILE_NAME times, and the USN Journal records a basic-information change at the real moment, so a timestomped file is usually detectable by comparing the two sets of times and checking the journal. The glossary page covers the detection methods in detail.

In a real investigation: clean-up that did not clean up

At the end of the Halden Freight lab intrusion, the attacker tidied up on the first workstation, HF-WS01. At 22:14:06 UTC PowerShell's Remove-Item deleted the staged archive q4-close.zip, and at 22:14:16 the PSReadLine history file ConsoleHost_history.txt was deleted, which removed the record of every command typed in that session.

Neither step removed the story. The USN Journal kept the archive's creation at 22:10:10.945 and its deletion at 22:14:06.922, and the history file's deletion at 22:14:16.169. PowerShell script block logging (event 4104) had already recorded the commands themselves, including the Compress-Archive that built the archive and the clean-up commands. Process creation events held the curl download and upload commands. The investigation could say exactly what the attacker deleted, when, and what it had contained, and treated the clean-up as one more finding (ATT&CK T1070.004, File Deletion) rather than as a hole in the case.

Investigating a host that has been cleaned

  1. List what is missing, explicitly. Which logs start late, which history files are empty, which tools are absent but referenced elsewhere.
  2. Date every gap. The time of a 1102, a 104, a 4719, a history deletion or a log that goes quiet places the attacker in time even when their actions are gone.
  3. Go to the independent sources. File system journals, execution artifacts, the registry, other hosts' logs, the domain controllers, network devices and forwarded copies.
  4. Recover what you can. Shadow copies, unallocated space, the page file and backups often hold earlier versions.
  5. Report the anti-forensics itself. It is evidence of intent, it bounds what can be concluded, and it is a technique to sweep other hosts for.

Finding anti-forensic activity in Arcsentry

Arcsentry parses the $MFT (with both $STANDARD_INFORMATION and $FILE_NAME times), the USN Journal, $LogFile, every event log channel and the execution artifacts from each collected host, so a deletion, a clearing event and the independent records of the same activity sit in one timeline. This AQL query on the System and Security logs lists log clearings and audit policy changes in order:

filter event_code in ("1102", "104", "4719")
derive {by = user_name}
select {timestamp, event_code, by}
sort {timestamp}

The AI investigator treats clean-up as evidence in its own right: in the Halden case it recorded the history file's deletion, noted that the history could not be read for that reason, and relied on the script block logs instead.

Frequently asked questions

What is anti-forensics?

Steps an attacker takes to make an intrusion harder to reconstruct, by removing, concealing or falsifying records, such as clearing logs, deleting or wiping files, faking timestamps, switching off auditing or security tools, and erasing command history.

What are common anti-forensic techniques?

Clearing event logs, changing the audit policy, disabling antivirus or EDR, timestomping, deleting or securely wiping tools and staged data, clearing PowerShell or bash history, deleting shadow copies, renaming tools and encoding commands.

Can deleted bash history be recovered?

Sometimes. The deleted file's contents may remain in unallocated space until overwritten, and the same commands are often recorded elsewhere: auditd, sudo logs, login records, other shells' histories and files the commands created.

How do you detect that event logs were cleared?

Look for event 1102 in the Security log and event 104 in the System log, which record who cleared which log. A log whose first record is unexpectedly recent, or a gap in record numbers, also indicates clearing or deletion.

Does anti-forensics make an investigation impossible?

Rarely. Activity is usually recorded by several independent sources, and removing one record tends to create another. The anti-forensic act itself becomes a dated finding that shows intent.

How we wrote this

Drafted with AI from evidence in our own lab, with Laura Pompeu responsible for the article. The evidence comes from Halden Freight office intrusion (Windows, two hosts), built and investigated in our lab, so every example can be checked against real records.

Sources

  1. MITRE ATT&CK TA0005: Defense Evasion; T1070 Indicator Removal, MITRE
  2. Marcus Rogers: anti-forensic categories (data hiding, artifact wiping, trail obfuscation, attacks against tools), Purdue University
  3. Microsoft Learn: 1102(S) The audit log was cleared; 4719(S) System audit policy was changed, Microsoft
  4. Sysinternals: SDelete, Microsoft
Photo of Laura Pompeu
Laura Pompeu
Marketing Manager & Cybersecurity Content Strategist, Proven Data

Laura Pompeu is a Marketing Manager and Cybersecurity Content Strategist with 10+ years of experience across journalism, SEO, and digital marketing. She produces expert-level content on ransomware, incident response, and data recovery for technical and business audiences, and has led multinational content teams across global markets.

LinkedIn

See it on your own evidence. Free for 7 days.

Tell us what you want to investigate. A person replies within one business day with the download and a trial licence.

Request a trial