Contents

Vulhub - Mr.Robot

Description

Link lab tại đây

Step

Reconnaissance

Đầu tiên ta sử dụng arp-scan để quét các địa chỉ IP có trong dải mạng. Nhận thấy có một IP lạ là 192.168.134.136.

https://github.com/g03m0n/pics/assets/130943529/ffd702f2-97d9-4758-a134-5bef0040c72f

Sử dụng nmap để kiểm tra các dịch vụ đang mở trên IP đó

https://github.com/g03m0n/pics/assets/130943529/7f89ae17-2044-43dc-83db-e2d6c959f48e

Có thể thấy port 80 đang sử dụng Apache httpd và port 22 là SSH.

Enumeration

Đầu tiên, truy cập vào endpoint /robots.txt ta có thể thấy key 1/3 và một file fsocity.dic. Đây có thể là file từ điển để dùng cho một cuộc tấn công brute force nào đó.

https://github.com/g03m0n/pics/assets/130943529/a80b63a5-db0d-414d-9fc1-f6e312614145

Tiếp theo, sử dụng nikto tool để scan tất cả dirrectories của trang web.

https://github.com/g03m0n/pics/assets/130943529/b852dd31-7d18-4680-9a80-385045c5faac

Tìm thấy endpoint /wordpress => Trang web sử dụng Wordpress. Sử dụng wpscan để brute force username/password.

Exploitation

Ta truy cập endpoint /fsocity.dic để tải file từ điển về máy. Xử lý file để rút ngắn từ điển bằng query:

cat fsocity.dic | sort -u > dic.txt

https://github.com/g03m0n/pics/assets/130943529/26b54c0d-51ca-46af-b00b-f113f6d6561b

Tiếp theo. ta đi tìm username bằng query:

wpscan --url http://192.168.134.136 --enumerate u --users-list dic.txt

https://github.com/g03m0n/pics/assets/130943529/b6fa5011-41c6-49f0-ba16-0e253f218a15

Tìm password với username vừa tìm được là elliot:

wpscan --url http://192.168.134.136/ --usernames elliot --passwords dic.txt

Ta thu được username/password: elliot/ER28-0652

https://github.com/g03m0n/pics/assets/130943529/195a95ce-7132-4a77-969b-a15266d066f9

Vì Elliot là quản trị viên của trang WordPress nên có thể chỉnh sửa bất cứ điều gì. Tiến hành edit file 404.php bằng php-reverse-shell:

https://github.com/g03m0n/pics/assets/130943529/fe7bd828-f51f-410d-b8a6-57ad51498b19

Lắng nghe tại port 9001 ở máy attacker bằng query:

nc -nvlp 9001

https://github.com/g03m0n/pics/assets/130943529/8a4604ea-a8c7-434f-a784-4bd0507a0a51

Refresh lại trang web như hình:

https://github.com/g03m0n/pics/assets/130943529/1f6e3376-dcc3-487a-9ef4-85a9cadbfe29

Reverse thành công. Tìm được password của user robot nhưng nó bị hash bằng md5

https://github.com/g03m0n/pics/assets/130943529/b1ddca95-21db-49bb-90f7-a28aa010e2f7

Ta crack md5 tại CrackStation

https://github.com/g03m0n/pics/assets/130943529/4585469d-560d-4b3a-b7f9-24d1a9e38b73

Đăng nhập user robot.

https://github.com/g03m0n/pics/assets/130943529/d2574144-fd12-4d97-9491-faaebcda7e89

Tìm được key 2/3.

https://github.com/g03m0n/pics/assets/130943529/cb5079ec-96b7-47d0-b28b-4601c42e9fdb

Privilege Escalation

Ta tìm tất cả các file thực thi có quyền suid bằng query:

find / -perm -u=s -type f 2>/dev/null

https://github.com/g03m0n/pics/assets/130943529/f48f6135-760d-46ba-b226-1453a7dff595

Ta tìm được /usr/local/bin/nmap. Truy cập GTFOBins

https://github.com/g03m0n/pics/assets/130943529/f9d19d22-0410-493e-b8f4-3673340a5e16

nmap --interactive có thể được sử dụng để thoát ra khỏi các môi trường bị hạn chế bằng cách tạo ra một interactive system shell:

https://github.com/g03m0n/pics/assets/130943529/c8f6a934-efa3-49ba-a8c4-ab1a759175d6

Tìm được key 3/3.