LDAPS -- relay target (if channel binding not enforced)
TCP
80/443
HTTP(S) -- relay target for AD CS enrollment
TCP
135
RPC -- used for coercion (PetitPotam, PrinterBug)
Coercion Methods
Method
Protocol
Vulnerability
Target
PetitPotam
MS-EFSRPC
CVE-2021-36942
Domain controllers -> AD CS
DFSCoerce
MS-DFSNM
N/A
Domain controllers
PrinterBug (SpoolSample)
MS-RPRN
By design
Any host with Print Spooler
ShadowCoerce
MS-FSRVP
N/A
Hosts with File Server VSS Agent
Splunk SPL - NTLM Relay Detection Queries
# IP-hostname mismatch detection
index=wineventlog EventCode=4624 LogonType=3 AuthenticationPackageName="NTLM"
| where TargetUserName != "ANONYMOUS LOGON"
| lookup dns_inventory hostname AS WorkstationName OUTPUT expected_ip
| where isnotnull(expected_ip) AND IpAddress != expected_ip
| table _time ComputerName TargetUserName WorkstationName IpAddress expected_ip
# NTLMv1 downgrade detection
index=wineventlog EventCode=4624 LmPackageName="NTLM V1"
| where TargetUserName != "ANONYMOUS LOGON"
| stats count by TargetUserName IpAddress ComputerName
# Machine account relay (PetitPotam indicator)
index=wineventlog EventCode=4624 LogonType=3 AuthenticationPackageName="NTLM"
TargetUserName="*$"
| stats dc(IpAddress) as source_count values(IpAddress) as sources by TargetUserName
| where source_count > 1
KQL - Microsoft Sentinel Queries
// NTLM relay IP-hostname mismatch
SecurityEvent
| where EventID == 4624 and LogonType == 3
| where AuthenticationPackageName == "NTLM"
| where TargetUserName !endswith "$" and TargetUserName != "ANONYMOUS LOGON"
| where IpAddress != "-" and IpAddress != "127.0.0.1"
| project TimeGenerated, Computer, TargetUserName, WorkstationName, IpAddress, LmPackageName
// NTLMv1 downgrade detection
SecurityEvent
| where EventID == 4624 and LmPackageName == "NTLM V1"
| where TargetUserName !endswith "$"
| summarize Count=count() by TargetUserName, IpAddress, Computer
python-evtx - Parse Security EVTX
from Evtx.Evtx import FileHeader
from lxml import etree
NS = {"evt": "http://schemas.microsoft.com/win/2004/08/events/event"}
with open("Security.evtx", "rb") as f:
fh = FileHeader(f)
for record in fh.records():
root = etree.fromstring(record.xml().encode("utf-8"))
eid = root.find(".//evt:System/evt:EventID", NS)
if eid is not None and eid.text == "4624":
data = {e.get("Name"): e.text for e in root.findall(".//evt:EventData/evt:Data", NS)}
if data.get("AuthenticationPackageName") == "NTLM" and data.get("LogonType") == "3":
print(data.get("TargetUserName"), data.get("WorkstationName"), data.get("IpAddress"))