# BlueHammer — Exploit Analysis

5 min read
Table of Contents

BlueHammer — Exploit Analysis

https://github.com/Nightmare-Eclipse/BlueHammer

This is a proof-of-concept for a privilege escalation / credential theft vulnerability targeting Windows Defender (MsMpEng). It chains several Windows internals techniques together to steal the SAM hive and gain SYSTEM-level code execution. Here’s how it works end-to-end:


Stage 1 — Waiting for a Windows Defender Signature Update

The exploit begins by polling the Windows Update API (IUpdateSearcher) waiting for a pending Defender signature update to become available. It downloads the update CAB file manually via WinInet, extracts the signature files (mpasbase.vdm, etc.) into a temp directory, and holds onto them. This is critical because the attack is timed around Defender’s own update process.


Stage 2 — Freezing Defender Using a Volume Shadow Copy + Oplock Race

This is the clever core of the exploit, a race condition using three interlocking primitives:

2a. Trigger a VSS Shadow Copy

  • The PoC writes an EICAR test file to disk, which causes Defender to scan it.
  • Simultaneously, it registers itself as a Cloud Files sync provider (CfRegisterSyncRoot / CfConnectSyncRoot) for the directory containing the EICAR file.
  • When Defender’s process queries the directory (enumeration triggers the CF_CALLBACK_TYPE_FETCH_PLACEHOLDERS callback), the exploit detects this by PID-matching the callback caller against the Defender service PID.
  • At that moment, before completing the callback, it requests a batch oplock (FSCTL_REQUEST_BATCH_OPLOCK) on a file inside the same directory.
  • This oplock forces Defender to pause — it cannot proceed with the file operation until the oplock is released.
  • While Defender is frozen, Windows creates a Volume Shadow Copy (VSS). The exploit detects the new HarddiskVolumeShadowCopy* device appearing in the object manager’s \Device directory.

Why is this important? Normally, C:\Windows\System32\Config\SAM is locked and cannot be read by non-SYSTEM processes. But via a VSS snapshot, a copy of the SAM hive is accessible at \Device\HarddiskVolumeShadowCopyN\Windows\System32\Config\SAM with no lock.


This stage makes Defender itself open the SAM hive on behalf of the attacker:

  1. The exploit calls Proc42_ServerMpUpdateEngineSignature — an undocumented RPC method on Defender’s ALPC port (IMpService77BDAF73...) — telling Defender to install the update from the temp directory the exploit controls.
  2. Defender creates a new subdirectory under C:\ProgramData\Microsoft\Windows Defender\Definition Updates\ and starts reading files from the attacker-controlled directory.
  3. The exploit places a batch oplock on mpasbase.vdm inside its temp directory. When Defender tries to open this file for the update, the oplock fires — Defender is paused again momentarily.
  4. During that pause window, the exploit:
    • Renames the original temp directory (with the real update files) out of the way.
    • Recreates a directory at the same path, but this time as a mount point (junction) pointing to \BaseNamedObjects\Restricted — a namespace inside the Windows Object Manager.
    • Creates an Object Manager symbolic link at \BaseNamedObjects\Restricted\mpasbase.vdm pointing to the VSS path of the SAM hive (\Device\HarddiskVolumeShadowCopyN\Windows\System32\Config\SAM).
  5. The oplock is released. Defender resumes, follows the directory junction → object manager link chain, and opens the SAM file from the shadow copy — effectively opening it as the SYSTEM-privileged Defender process. The exploit then opens the same file handle that Defender has made accessible.

Stage 4 — Parsing the SAM and Dumping Credentials

With the SAM hive bytes in hand, the exploit:

  • Reads the boot key from HKLM\SYSTEM\CurrentControlSet\Control\Lsa (the JD, Skew1, GBG, Data subkeys, which together form the syskey).
  • Uses the boot key + AES-128-CBC to decrypt the Password Encryption Key (PEK) stored in SAM\Domains\Account\F.
  • Iterates all user subkeys under SAM\Domains\Account\Users, extracts the encrypted NT hash blobs, and decrypts them using a two-stage process: AES-128-CBC (new format, type 2) followed by DES-ECB with a key derived from each user’s RID.
  • Prints every user’s plaintext NTLM hash.

Stage 5 — Lateral Movement & SYSTEM Shell

For each local account whose NTLM hash it recovered:

  1. It temporarily changes the user’s password using the internal SamiChangePasswordUser SAM API (passing the old NTLM hash it just dumped, so it can authenticate and then restore the password).
  2. It logs on as that user (LogonUserEx).
  3. If the account is in the Administrators group, it impersonates the token at Medium integrity, then creates and starts a Windows service (CreateService / StartService) running itself. Since SCM runs services as SYSTEM, this gives SYSTEM-level execution with a shell in the calling session.
  4. After launching the shell, it restores the user’s original password via SamiChangePasswordUser again (using the new→old NTLM hash swap).

Summary of the Vulnerability Chain

StepTechniquePurpose
1Windows Update API pollingWait for Defender update to trigger
2Cloud Files + oplock raceFreeze Defender to allow VSS creation
3VSSAccess locked SAM hive without SYSTEM rights
4Directory junction + Object Manager symlinkRedirect Defender’s own file access to SAM
5Defender RPC (ServerMpUpdateEngineSignature)Cause Defender to open attacker-controlled path as SYSTEM
6Offline Registry (offreg.lib) + boot key + AES/DESDecrypt and dump all local NTLM hashes
7SAM API password swap + SCM service creationEscalate to SYSTEM and spawn shells as all local users

The root cause is that Defender’s signature update RPC endpoint does not sufficiently validate the update source path, and the combination of directory junctions and Object Manager symbolic links allows an unprivileged user to redirect that path to arbitrary locations — including VSS copies of files that are otherwise access-controlled.

My avatar

Thanks for reading my blog post! Feel free to check out my other posts or contact me via the social links in the footer.


More Posts

Comments