Persistence Showdown Report Team A vs Team B — Windows VM, PowerShell, Two Cross-Team Rounds

Lab format: Each team built two PowerShell scripts — an Attacker (Red) that plants persistence, and a Defender (Blue) that detects and removes it. Win condition: after reboot, if C:\Users\Public\Documents\pwned.txt exists, Red wins; otherwise Blue wins.

Final Scoreboard

Round Attacker Defender Winner Margin
1 A Red (Team A Attacker) B Blue (Team B Defender) B Blue wins Clean — persistence never fires
2 B Red (Team B Attacker) A Blue (Team A Defender) B Red wins Persistence fires; A Blue's watchdog only suppresses the artifact

Team B wins both directions. Their defender beats Team A's attacker by exhaustive enumeration; their attacker beats Team A's defender by hiding in persistence locations the defender never searches.

Round 1 — A Red vs B Blue B Blue wins

Observed in the lab: No pwned.txt file was created at any point after reboot. Defender wins cleanly.

What happens when we run the test

T+0:00 Operator runs A Red.ps1 as Administrator. Four persistence entries planted: Run key AudioSyncHost, scheduled task \AudioSyncMonitor, service AudioSyncProxy, startup shortcut AudioSyncUpdate.lnk.
T+0:30 Operator runs B Blue.ps1. The defender enumerates every persistence location it knows about, comparing each entry name against an embedded JSON whitelist of legitimate Windows entries.
T+0:35 All four AudioSync* names fail the whitelist check. The defender removes the Run key, deletes the scheduled task, disables and removes the service, deletes the startup shortcut.
T+1:00 VM reboots.
T+1:45 User logs back in. Nothing fires — all triggers were removed before reboot. Test-Path returns False.

Why A Red lost

A Red's payload uses a clever ASCII char-array trick to obfuscate the strings pwned.txt and Pwn3d — designed to evade regex-based detection. But B Blue doesn't grep payloads; it asks a different question: "is this entry name on the list of expected, legitimate Windows entries?" The names AudioSyncHost, AudioSyncMonitor, etc. are invented — they sound like real Windows audio components but don't exist on a clean install. They fail the whitelist regardless of what their payload does.

Lesson: Clever payload obfuscation loses to whitelist enumeration. A defender that asks "is this expected?" inverts the burden of proof from itself to the attacker.

Round 2 — B Red vs A Blue B Red wins

Observed in the lab: After reboot, pwned.txt appears, then disappears, then reappears — but only when the operator chose Defender Watchdog Option 2.

What happens when we run the test

T+0:00 Operator runs B Red.ps1 as Administrator. Persistence is planted in 10+ locations: HKCU/HKLM Run keys with AES-encrypted payloads, IFEO + SilentProcessExit on userinit.exe, WMI permanent event subscription, PowerShell profile injection, Winlogon Userinit append, BootExecute append, scheduled tasks, services, hijacked existing-task entries. Critical registry keys are armored with TrustedInstaller ownership and Deny ACEs.
T+0:45 Operator runs A Blue.ps1, choosing Watchdog Option 2. A Blue scans Run keys, scheduled tasks, services, startup folders. It does not look at IFEO, WMI, PowerShell profiles, BootExecute, or Winlogon appends. A SYSTEM-level scheduled task is installed that runs every 30 seconds.
T+1:30 VM reboots.
T+1:50 Login completes. userinit.exe SilentProcessExit fires. cmd.exe /c echo Pwn3d > pwned.txt writes the file.
T+2:15 A Blue's watchdog scheduled task fires (30s tick). Detects pwned.txt, deletes it.
T+5:50 ~4 minutes after boot — WMI subscription trigger condition SystemUpTime BETWEEN 240 AND 325 matches. WMI consumer fires. pwned.txt is recreated.
T+6:00 Watchdog tick. File deleted.
T+... Cycle repeats every time a persistence trigger fires. Most of the time the file is gone, but at every trigger moment it exists.

Why this is officially a B Red win

By the project's win condition — "after reboot, if pwned.txt exists, the attacker wins" — the file does exist after reboot. Repeatedly. The persistence is intact and would re-create the file forever.

A Blue's watchdog is a creative workaround, but it doesn't actually defeat the persistence. It plays whack-a-mole with the artifact. If the operator ran one more reboot without re-arming the watchdog, the file would stay permanently. This is denial of evidence, not defense.

Why A Blue's primary scan missed everything

A Blue's detection logic only enumerates four persistence categories: Run keys, scheduled tasks, services, startup folders. B Red plants in those four and in:

Even where A Blue does detect a B Red entry, removal often fails: B Red has armored registry keys with TrustedInstaller ownership and Deny ACEs. A Blue's Remove-Item throws ACCESS_DENIED, the exception is caught, the script logs [FAILED] and moves on. The persistence stays in place.

Smart Moves — Team A

A Red — Attacker

A Blue — Defender

Smart Moves — Team B

B Red — Attacker

B Blue — Defender

Lessons from the Showdown

1. Cleverness wins at its own level — but not against a different paradigm

A Red's payload obfuscation is genuinely clever and crushes regex-based defenders. But it does nothing against B Blue's whitelist-by-name approach. The attacker's craft and the defender's detection model were operating at different layers entirely.

2. Breadth of awareness beats depth of obfuscation

A defender that knows about every place persistence can hide beats an attacker who hides cleverly in a place the defender already searches — and beats an attacker who uses fewer hiding places (even if those places are well-armored). B Blue's 16 modules vs A Blue's 4 made all the difference.

3. Artifact deletion is not defense

A Blue's watchdog never actually removes B Red's persistence. It just keeps wiping the output file. The persistence is still planted, would survive any number of reboots, and would re-emerge instantly if the watchdog ever stopped running. Real defense is rooting out the persistence; suppressing the symptom is denial of evidence.

4. ACL armoring is the attacker's strongest move

Once a persistence key is owned by TrustedInstaller and Deny-ACL'd against Everyone, even an elevated administrator's Remove-Item fails. A defender that doesn't explicitly enable SeTakeOwnershipPrivilege, take ownership, and rewrite the ACL cannot remove these entries. Most defenders don't, and they lose.

5. SilentProcessExit is the IFEO trick everyone should know about

Standard IFEO Debugger hijacks are well-detected. SilentProcessExit fires after the target process exits normally, so the system functions correctly and the trigger looks like a routine system event. It's safer (no broken logon) and stealthier — a rare combination.

Methodology

Two cross-team rounds were planned and executed:

  1. Round 1: A Red attacker against B Blue defender.
  2. Round 2: B Red attacker against A Blue defender.

Each round was run on a Windows VM in VMware, started from a clean-baseline snapshot. Scripts were executed in elevated PowerShell. After running attacker then defender, the VM was rebooted and C:\Users\Public\Documents\pwned.txt was checked. Snapshots were used to revert between rounds.

Round 1 result observed in the lab matched the static code analysis prediction exactly. Round 2 result also matched the prediction, with the additional observed nuance that A Blue's optional Watchdog Option 2 produces an oscillating — rather than persistent — pwned.txt existence, because it deletes the file in a 30-second loop without removing the underlying persistence.