Skip to content

Add MpCmdRun.exe -DeviceControl -TestPolicyXml file read (Credentials) - #538

Open
s4dbrd wants to merge 1 commit into
LOLBAS-Project:masterfrom
s4dbrd:mpcmdrun-devicecontrol-file-read
Open

s4dbrd wants to merge 1 commit into
LOLBAS-Project:masterfrom
s4dbrd:mpcmdrun-devicecontrol-file-read

Conversation

@s4dbrd

@s4dbrd s4dbrd commented Nov 7, 2026

Copy link
Copy Markdown

Summary

Adds a new technique for MpCmdRun.exe using the -DeviceControl -TestPolicyXml flag to read arbitrary user-accessible files.

Command: MpCmdRun.exe -DeviceControl -TestPolicyXml {PATH_TO_FILE} -Rules

The file contents are dumped to %TEMP%\MpCmdRun.log (UTF-16LE). The internal XML parser fails on non-XML input, but the raw file content is written to the log before the parse error. No admin privileges required.

Verified targets

Tested on Windows 11 Enterprise, MDE 4.18.26100.4, Tamper Protection level 5. Zero security alerts generated across all tests.

Target file Result
SSH private keys (~/.ssh/id_rsa) Full PEM key dumped to log
Chrome/Edge Local State (JSON) encrypted_key (DPAPI) extracted — enables offline browser credential decryption
SSH config (~/.ssh/config) All Host entries extracted — network target mapping
Wi-Fi profile XMLs (ProgramData\Wlansvc\Profiles\*.xml) SSID + keyMaterial extracted
PowerShell history (ConsoleHost_history.txt) Full command history with potential typed credentials
Azure CLI token files Token JSON readable

Text files are fully dumped. Binary files (SQLite databases) are truncated to ~1KB.

Why this qualifies

  • Microsoft-signed binary native to every Windows installation
  • Unexpected functionality: -DeviceControl -TestPolicyXml is intended for testing Device Control policies, not reading arbitrary files
  • Useful for credential theft: enables harvesting SSH keys, browser DPAPI keys, cloud tokens, and other credential material
  • WDAC/AppLocker bypass: in locked-down environments where attacker tools are blocked, MpCmdRun.exe is always allowed
  • Attribution evasion: file access is attributed to MpCmdRun.exe (a Defender process) in EDR/Sysmon telemetry

Category

Credentials (T1552.001 — Unsecured Credentials: Credentials in Files)

Detection IOCs added

  • MpCmdRun.exe spawned with -DeviceControl -TestPolicyXml arguments where the target is not an XML policy file
  • %TEMP%\MpCmdRun.log containing non-XML content (PEM keys, JSON, plaintext credentials)

Note on existing -DownloadFile entries

The -DownloadFile flag was removed by Microsoft in MpCmdRun v4.18.26100.4. The existing Download entries may need a version note, but that is out of scope for this PR.

MpCmdRun.exe -DeviceControl -TestPolicyXml <file> -Rules reads any
user-accessible file and dumps its full contents to %TEMP%\MpCmdRun.log.
No admin required. The file is passed to an internal XML parser which
fails for non-XML input, but the raw content is written to the log.

Tested on Windows 11 Enterprise with MDE 4.18.26100.4 and Tamper
Protection level 5. Zero alerts generated.

High-value targets confirmed: SSH private keys (full PEM dump),
Chrome/Edge Local State (DPAPI encrypted_key for browser credential
decryption), SSH config (network target mapping), Wi-Fi profile XMLs
(keyMaterial), and PowerShell command history.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@s4dbrd
s4dbrd requested a review from a team as a code owner November 7, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant