Correlating Windows Events 5156 and 1644 to Attribute ADWS Queries

· Original article ↗

Summary

A tested method correlates Windows Events 5156 and 1644 to attribute Active Directory Web Services LDAP queries to their source IP, using port matching when logs are retained or a roughly 60–80 ms time window.

Key points

  • ADWS can make LDAP diagnostic logs show localhost as the query client, obscuring the originating host.
  • Event 5156 records permitted network connections, including the source IP for inbound ADWS traffic on port 9389.
  • Port-based correlation can link Event 5156 to Event 1644 when the original connection event is still retained; persistent connections may make it unavailable in live DC logs.
  • In three tests, the external connection event preceded the corresponding LDAP query event by about 60–80 ms, supporting timestamp-based correlation.
  • The article describes a script that tries port matching first and then uses a timing window to attribute queries.
  • To reduce false positives from normal RSAT use, the approach looks for suspicious Event 1644 patterns, including [all_with_list], SDflags:0x7, and (!(FALSE)).
  • The author says SIEM retention makes this correlation practical even when high Event 5156 volume causes older events to roll out of a domain controller's Security log.

Article Details

Defense Focus
Attribute Active Directory Web Services (ADWS) LDAP queries to their originating host by correlating Windows Filtering Platform Event 5156 with Directory Service Event 1644, using Event 1138 to associate the ADWS session with the authenticated user.
Detection Methods
  • Correlate Event 5156 and Event 1644 by timestamp within approximately 60–80 ms; the article reports this interval across three test runs.
  • Where retained, use the original Event 5156 connection and matching port for deterministic correlation; otherwise use timestamp correlation.
  • Prioritize Event 1644 patterns such as [all_with_list], SDflags:0x7, (!(FALSE)), high-volume localhost queries, and nTSecurityDescriptor requests to distinguish suspicious enumeration from routine ADWS activity.
  • Correlate Event 1138 with Events 5156 and 1644 to connect the source IP, ADWS session, authenticated user, and LDAP query.
  • Use Get-ADWSAttribution.ps1 for automated collection and correlation, with port-based correlation attempted before timestamp fallback.
Data Sources
  • Windows Security log: Windows Filtering Platform Event 5156
  • Active Directory Web Services log: Event 1138
  • Directory Service log: Event 1644
  • SIEM-retained Security logs
  • Forensic EVTX backups
Rule Types
  • Event-correlation detection using a tight timestamp window
  • Port-based network-event correlation
  • LDAP query-pattern detection in Event 1644
Platforms
  • Windows
  • Splunk
  • Sentinel
Defensive Actions
  • Forward Security logs to a SIEM and retain Event 5156 long enough for correlation; the article notes that high event volume can cause older events to roll off a domain controller.
  • Correlate suspicious Event 1644 LDAP patterns with Event 5156 rather than alerting on every ADWS connection to port 9389.
  • Include Event 1138 in the correlation chain to associate the ADWS session with the authenticated user.
  • Use timestamp correlation when the original connection event is no longer available locally, and port-based correlation when the relevant original event is retained.
  • Use Get-ADWSAttribution.ps1 to monitor and attribute correlated queries.

MITRE ATT&CK

People

Products

Tools

Related Articles