# WRITEUP FOR CYBERDEFENDERS NETWORK FORENSICS CHALLENGE Buồn buồn lên CyberDefenders kiếm lab đấm chơi thì thấy mới release lab này, tag easy nhưng không easy như mình tưởng xD, khá là tốn time, ok vào việc thoai :> ***WEB INVESTIGATION BLUE TEAM LAB*** ![image](https://hackmd.io/_uploads/SyZ1sUtCT.png) file:https://download.cyberdefenders.org/BlueYard/c130-WebInvestigation.zip?_gl=1 password: cyberdefenders.org Q1: ***By knowing the attacker's IP, we can analyze all logs and actions related to that IP and determine the extent of the attack, the duration of the attack, and the techniques used. Can you provide the attacker's IP?*** Mở wireshark lên và tiến hành analyze gói tin thoai: `Statistic -> Conversations -> Ipv4:` ![image](https://hackmd.io/_uploads/HJohj8FCp.png) Có thể thấy được Ip đang tương tác mạnh mẽ nhất có địa chỉ là 111.224.250.131, từ đó ta có thể suy luận được đây chính là địa chỉ Ip của hacker. ***Ans: 111.224.250.131*** Q2: ***If the geographical origin of an IP address is known to be from a region that has no business or expected traffic with our network, this can be an indicator of a targeted attack. Can you determine the origin city of the attacker?*** https://www.abuseipdb.com/ ![image](https://hackmd.io/_uploads/B1pYh8tR6.png) ***Ans: Shijiazhuang*** Q3: ***Identifying the exploited script allows security teams to understand exactly which vulnerability was used in the attack. This knowledge is critical for finding the appropriate patch or workaround to close the security gap and prevent future exploitation. Can you provide the vulnerable script name?*** Tiếp tục phân tích các gói tin trong wireshark, mình chọn phân tích các gói tin trong giao thức http: ![image](https://hackmd.io/_uploads/SkbpTIKAa.png) Có thể thấy hacker sử dụng script *search.php* để khai thác data về những cuốn sách trong server ***Ans: search.php*** Q4: ***Establishing the timeline of an attack, starting from the initial exploitation attempt, What's the complete request URI of the first SQLi attempt by the attacker?*** Mò mẫm thêm 1 chút thì ở packet 357 xuất hiện câu lệnh SQL đầu tiên ![image](https://hackmd.io/_uploads/r1zZJwF0p.png) ***Ans: /search.php?search=book%20and%201=1;%20--%20-*** Q5: ***Can you provide the complete request URI that was used to read the web server available databases?*** Câu hỏi này mình hơi mất 1 chút thời gian vì kiến thức về SQL hạn hẹp :< ![image](https://hackmd.io/_uploads/S1Y_-PK0T.png) Ở đây mình phát hiện khá nhiều gói tin với request là các câu lệnh SQL dùng để extract toàn bộ dữ liệu, dò từng gói tin 1 thì thấy dữ liệu trả về toàn là rỗng, follow http stream gói tin 1520 thì thấy request là: ``` /search.php?search=book%27%20UNION%20ALL%20SELECT%20NULL%2CCONCAT%280x7178766271%2CJSON_ARRAYAGG%28CONCAT_WS%280x7a76676a636b%2Cschema_name%29%29%2C0x7176706a71%29%20FROM%20INFORMATION_SCHEMA.SCHEMATA--%20- ``` với response như hình dưới: ![image](https://hackmd.io/_uploads/HyP5GPF0p.png) Search google với từ khóa "information_schema" thì thấy nó dùng để truy cập tới database metadata ![image](https://hackmd.io/_uploads/BJ-GXvKR6.png) Từ đó ta có thể kết luận hacker đã sử dụng câu lệnh SQL trên để đọc dữ liệu từ server ***Ans: /search.php?search=book%27%20UNION%20ALL%20SELECT%20NULL%2CCONCAT%280x7178766271%2CJSON_ARRAYAGG%28CONCAT_WS%280x7a76676a636b%2Cschema_name%29%29%2C0x7176706a71%29%20FROM%20INFORMATION_SCHEMA.SCHEMATA--%20-*** Q6: ***Assessing the impact of the breach and data access is crucial, including the potential harm to the organization's reputation. What's the table name containing the website users data?*** Website users data thì chỉ có thể là data của customers. ![image](https://hackmd.io/_uploads/rkFHSPtA6.png) Dữ liệu trả về ở packet 1553 xuất hiện thẻ customers, và ở packet 1612 hacker đã sử dụng câu lệnh SQL sau: ``` /search.php?search=book%27%20UNION%20ALL%20SELECT%20NULL%2CCONCAT%280x7178766271%2CJSON_ARRAYAGG%28CONCAT_WS%280x7a76676a636b%2Ccolumn_name%2Ccolumn_type%29%29%2C0x7176706a71%29%20FROM%20INFORMATION_SCHEMA.COLUMNS%20WHERE%20table_name%3D0x637573746f6d657273%20AND%20table_schema%3D0x626f6f6b776f726c645f6462--%20- ``` Quăng lên cyberchef để decode: ![image](https://hackmd.io/_uploads/SkXJPvFCT.png) Ta có thể thấy hacker sử dụng câu lệnh SQL trên để truy vấn tới bảng *0x637573746f6d657273*, decode hex 1 lần nữa: ![image](https://hackmd.io/_uploads/Sy5VDDYAp.png) Và response cho câu lệnh trên là: ![image](https://hackmd.io/_uploads/SJFPDwYAT.png) Từ đó ta có thể kết luận bảng "customers" chính là bảng chứa dữ liệu của web users. ***Ans: customers*** Q7: ***The website directories hidden from the public could serve as an unauthorized access point or contain sensitive functionalities not intended for public access. Can you provide name of the directory discovered by the attacker?*** " contain sensitive functionalities not inteded for public access" thì chỉ có thể là thư mục quan trọng ( cụ thể là admin ) ![image](https://hackmd.io/_uploads/SJqVuvKCT.png) Quả thật như vậy, ta có thể thấy ở packet 88790, hacker đã truy cập vào /admin/ để upload 1 file php ( chắc là malicious file), do đó ta có thể kết luận đây chính là thư mục chứa thông tin nhạy cảm. ***Ans: /admin/*** Q8: ***Knowing which credentials were used allows us to determine the extent of account compromise. What's the credentials used by the attacker for logging in?*** Để trả lời cho câu hỏi này, chúng ta lại tìm đến những câu lệnh SQL để xem xem hacker có sử dụng chúng để truy vấn tới thẻ "admin" hay không, vì vừa nãy ở Q6, chúng ta đã thấy sự xuất hiện của thẻ "admin". Ở packet 1589, hacker đã sử dụng câu lệnh SQL sau để truy vấn tới bảng "admin": ``` /search.php?search=book%27%20UNION%20ALL%20SELECT%20NULL%2CCONCAT%280x7178766271%2CJSON_ARRAYAGG%28CONCAT_WS%280x7a76676a636b%2Cid%2Cpassword%2Cusername%29%29%2C0x7176706a71%29%20FROM%20bookworld_db.%60admin%60--%20- ``` Và với response là: ![image](https://hackmd.io/_uploads/HJoJ5vY0T.png) Với tham chiếu là password trước và username sau, sau đây là tài khoản và mật khẩu của admin: admin, admin123! ***Ans: admin:admin123!*** Q9: ***We need to determine if the attacker gained further access or control on our web server. What's the name of the malicious script uploaded by the attacker?*** Ở Q7, chúng ta đã tìm ra được malicious script mà hacker upload lên ***Ans: NVri2vhp.php*** Final thoughts: Lab này khá hay, mình đã học thêm được nhiều kỹ năng về phân tích gói tin cũng như các câu lệnh truy vấn SQL, nothing much to chê, 100 out of 100. ***THANK YOU GUYS FOR READING TO THE END***