Skip to content
high severityMicrosoft Defender XDR

Detect LSASS dumping via comsvcs.dll (KQL)

A classic way to dump LSASS memory without dropping a tool is rundll32.exe comsvcs.dll, MiniDump — a signed Windows DLL whose MiniDump export (ordinal #24) writes the process memory of LSASS to disk, where the attacker then extracts credentials offline. This DeviceProcessEvents query matches rundll32 command lines that reference comsvcs.dll together with MiniDump or the #24 ordinal.

It is a high-fidelity signal: legitimate software almost never calls comsvcs MiniDump against LSASS.

The query

DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "rundll32.exe"
| where ProcessCommandLine has "comsvcs.dll"
| where ProcessCommandLine has_any ("MiniDump", "#24")
| project Timestamp, DeviceName, AccountName,
          InitiatingProcessFileName, InitiatingProcessCommandLine,
          ProcessCommandLine, SHA256
| sort by Timestamp desc

Line-by-line explanation

  • | where FileName =~ "rundll32.exe"

    Narrows to rundll32, the signed binary used to invoke the DLL export. The =~ operator makes the match case-insensitive.

  • | where ProcessCommandLine has "comsvcs.dll"

    comsvcs.dll exposes the MiniDump function; its presence on a rundll32 command line is the key indicator.

  • | where ProcessCommandLine has_any ("MiniDump", "#24")

    MiniDump is the export name and #24 its ordinal; attackers use either form, so both are matched.

Required tables and columns

  • FileNameThe image that ran; rundll32.exe here.
  • ProcessCommandLineFull command line, where the comsvcs.dll MiniDump invocation appears.
  • InitiatingProcessCommandLineThe parent command line, showing how the dump was launched.
  • AccountNameThe account that ran the command, typically a privileged one.

MITRE ATT&CK mapping

Tuning and false positives

  • Widen to catch obfuscation: match on "comsvcs" without the extension, and on common renamed-rundll32 copies by also checking ProcessVersionInfoOriginalFileName.
  • Correlate with a new .dmp file in DeviceFileEvents written just after the process to confirm a dump landed on disk.

Limitations

  • Other LSASS dump methods (direct MiniDumpWriteDump, procdump, comsvcs via a renamed binary, or API-only access) will not match this specific command.
  • A renamed rundll32 defeats the FileName filter; add original-file-name checks for fuller coverage.

References

Last reviewed 2026-11-18.