Đây là Blue CTF đầu tiên của HTB! Những thách thức theo phong cách Sherlock! ![image](https://hackmd.io/_uploads/S1VUYmrhex.png) Let's go ![image](https://hackmd.io/_uploads/r1jEoYu3gl.png) # The Card Holmes receives a breadcrumb from Dr. Nicole Vale - fragments from a string of cyber incidents across Cogwork-1. Each lead ends the same way: a digital calling card signed JM. ## Overview ### Case Summary Một nhóm ký hiệu JM (hay 4A4D) đã quét và khai thác một honeypot web. Kẻ tấn công dùng một `User-Agent` đặc trưng để fuzz các path, vượt qua WAF, deploy webshell rồi exfiltrate database. Sau phân tích CTI trên các platform cung cấp, ta xác định được file webshell, file dữ liệu bị exfiltrate, signature lặp lại, hash mã độc, IP C2, đường dẫn persistence trên Linux và nhiều thông tin hạ tầng liên quan. >### Comment > SOC và TI challenge ### Question 1. Analyze the provided logs and identify what is the first User-Agent used by the attacker against Nicole Vale's honeypot. 2. It appears the threat actor deployed a web shell after bypassing the WAF. What is the file name? 3. The threat actor also managed to exfiltrate some data. What is the name of the database that was exfiltrated? 4. During the attack, a seemingly meaningless string seems to be recurring. Which one is it? 5. OmniYard-3 (formerly Scotland Yard) has granted you access to its CTI platform. Browse to the first IP:port address and count how many campaigns appear to be linked to the honeypot attack. 6. How many tools and malware in total are linked to the previously identified campaigns? 7. It appears that the threat actor has always used the same malware in their campaigns. What is its SHA-256 hash? 8. Browse to the second IP:port address and use the CogWork Security Platform to look for the hash and locate the IP address to which the malware connects. (Credentials: nvale/CogworkBurning!) 9. What is the full path of the file that the malware created to ensure its persistence on systems? 10. Finally, browse to the third IP:port address and use the CogNet Scanner Platform to discover additional details about the TA's infrastructure. How many open ports does the server have? 11. Which organization does the previously identified IP belong to? 12. One of the exposed services displays a banner containing a cryptic message. What is it? ## 1. Analyze the provided logs and identify what is the first User-Agent used by the attacker against Nicole Vale's honeypot. Đọc file `access.log` ta sẽ thấy hành động fuzzing path được thực hiện bởi attacker với trường `User-Agent` là **Lilnunc/4A4D - SpecterEye** ![image](https://hackmd.io/_uploads/S1l7N9rnel.png) ## 2. It appears the threat actor deployed a web shell after bypassing the WAF. What is the file name? Khi check log của waf tại `wwaf.log` ta sẽ thấy tên của file webshell. Tên của nó là **temp_4A4D.php** ![image](https://hackmd.io/_uploads/BydqEqBnxe.png) ## 3. The threat actor also managed to exfiltrate some data. What is the name of the database that was exfiltrated? Hành động tiếp theo của attacker rất rõ ràng đó chính là lấy cắp dữ liệu và cũng được waf phát hiện dưới rule ` BYPASS - Database file download`. File được dump ra được attacker đặt là **database_dump_4A4D.sql** ![image](https://hackmd.io/_uploads/BkVmSqB3el.png) ## 4. During the attack, a seemingly meaningless string seems to be recurring. Which one is it? Có thể thấy trong suốt cuộc tấn công **4A4D** là string mà attacker luôn để lại như **temp_4A4D.php**, **database_dump_4A4D.sql**, **backup_2025_4A4D.tar.gz**, có thể đây là signature của nhóm mà chúng để lại ## 5. OmniYard-3 (formerly Scotland Yard) has granted you access to its CTI platform. Browse to the first IP:port address and count how many campaigns appear to be linked to the honeypot attack. Từ task này ta sẽ được làm việc với các công cụ CTI Khi truy cập vào CTI platform ta đã nhận định được đúng 4A4D chính là signature của nhóm này (chuyển sang từ hex là **JM**). Dưới đây ![image](https://hackmd.io/_uploads/Sy-rIqr2el.png) Dưới đây là graph các chiến dịch liên quan đến nhóm nàyu ![image](https://hackmd.io/_uploads/HywGoqrhlg.png) Ở giữa chính là honeypot, nó chính là nơi các signature của JM mà các chiến dịch được link lại với nhau và tổng cả có **5** chiến dịch liên quan ![image](https://hackmd.io/_uploads/rJM8p9B3eg.png) ## 6. How many tools and malware in total are linked to the previously identified campaigns? Với số tool và mã độc lên đến **9** được khoanh ở dưới ( 2 tool + mã độc ở dưới do cắt không hết được ảnh) ![image](https://hackmd.io/_uploads/B1maa5B2lx.png) ## 7. It appears that the threat actor has always used the same malware in their campaigns. What is its SHA-256 hash? Bấm vào `Export` và xuất ra ![image](https://hackmd.io/_uploads/r1fZRqS2xx.png) Kiếm tra hash ta thấy **7477c4f5e6d7c8b9a0f1e2d3c4b5a6f7e8d9c0b1a2f3e4d5c6b7a8f9e0d17477** được lặp lại nhưng có nhiều tên khác nhau. CHứng tỏ file mã độc này chưa được phổ biến ![image](https://hackmd.io/_uploads/ByuH0cS2ge.png) ## 8. Browse to the second IP:port address and use the CogWork Security Platform to look for the hash and locate the IP address to which the malware connects. (Credentials: nvale/CogworkBurning!) Platform tiếp theo đó là phân tích threat ![image](https://hackmd.io/_uploads/rJ7uPiBnll.png) Search hash vừa rồi ta sẽ có được IP c2 mà con mã độc kết nối đến ![image](https://hackmd.io/_uploads/SkC5wjHhxl.png) ## 9. What is the full path of the file that the malware created to ensure its persistence on systems? Ở phần chi tiết, nó có tạo persistent tại path **/opt/lilnunc/implant/4a4d_persistence.sh**, chứng tỏ đến hiện tại, ta biết được con mã độc này đang được tấn công trên các máy chủ linux ![image](https://hackmd.io/_uploads/SyLJdjB3gg.png) ## 10. Finally, browse to the third IP:port address and use the CogNet Scanner Platform to discover additional details about the TA's infrastructure. How many open ports does the server have? Platform được đề cập cuối cùng đó chính là device scanner Với IP thu được ở [Q8](#8-Browse-to-the-second-IPport-address-and-use-the-CogWork-Security-Platform-to-look-for-the-hash-and-locate-the-IP-address-to-which-the-malware-connects-Credentials-nvaleCogworkBurning), IP này thực hiện trên tổng cộng **11** port khác nhau ![image](https://hackmd.io/_uploads/SJLCdsBngx.png) ## 11. Which organization does the previously identified IP belong to? Check detail thấy được tổ chức đằng sau đó chính là **SenseShield MSP** ![image](https://hackmd.io/_uploads/S1E-YjBnxe.png) ## 12. One of the exposed services displays a banner containing a cryptic message. What is it? Tại port **7477**, nó xuất hiện banner với nội dung **He's a ghost I carry, not to haunt me, but to hold me together - NULLINC REVENGE** với thông điệp có thể là signature `NULLINC REVENGE`, vừa là một ẩn dụ: hồn ma = backdoor, không ám nhưng giữ tôi lại = persistence ![image](https://hackmd.io/_uploads/HypmtiB2ge.png) # The Enduring Echo LeStrade passes a disk image artifacts to Watson. It's one of the identified breach points, now showing abnormal CPU activity and anomalies in process logs. ## Overview ### Case Summary Kẻ tấn công vào máy Windows và thực thi lệnh đầu tiên (không tính cd) là `systeminfo`, được ghi nhận trong Security Event ID 4688. Chuỗi lệnh của đối tượng được `C:\Windows\System32\wbem\WmiPrvSE.exe` sinh ra, dấu hiệu điển hình của Impacket `wmiexec.py` (thực thi lệnh từ xa qua WMI). Attacker chỉnh file hosts để ánh xạ `NapoleonsBlackPearl.htb` -> `10.129.242.110`, nhiều khả năng là hạ tầng/C2 do kẻ tấn công kiểm soát. Về bám trụ, attacker tạo tác vụ theo lịch “`SysHelper Update`” chạy mỗi 2 phút dưới quyền SYSTEM, gọi PowerShell đến script `C:\Users\Werni\AppData\Local\JM.ps1`. Script này tạo tài khoản nội bộ `svc_netupd` với mật khẩu theo mẫu `Watson_<timestamp>`. Để pivot vào mạng nội bộ, hắn dùng PortProxy (Windows port-forwarding) chuyển tiếp TCP `9999` từ nạn nhân tới `192.168.1.101`; cấu hình lưu tại `HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v4tov4\tcp`, khớp kỹ thuật MITRE ATT&CK `T1090.001` (Proxy). Trước đó, quản trị viên đã bật ghi chi tiết command line bằng lệnh: `reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit" /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f` >### Comment > Windows endpoint forensic challenge ### Question 1. What was the first (non cd) command executed by the attacker on the host? 2. Which parent process (full path) spawned the attacker’s commands? 3. Which remote-execution tool was most likely used for the attack? 4. What was the attacker’s IP address? 5. What is the first element in the attacker's sequence of persistence mechanisms? 6. Identify the script executed by the persistence mechanism. 7. What local account did the attacker create? 8. What domain name did the attacker use for credential exfiltration? 9. What password did the attacker's script generate for the newly created user? 10. What was the IP address of the internal system the attacker pivoted to? 11. Which TCP port on the victim was forwarded to enable the pivot? 12. What is the full registry path that stores persistent IPv4→IPv4 TCP listener-to-target mappings? 13. What is the MITRE ATT&CK ID associated with the previous technique used by the attacker to pivot to the internal system? 14. Before the attack, the administrator configured Windows to capture command line details in the event logs. What command did they run to achieve this? ### Tools use - EventViewer - chainsaw - Registry Explorer - ChatGPT ## 1. What was the first (non cd) command executed by the attacker on the host? Để xác định được command đầu tiên được thực thi trên Windows, ta có thể kiểm tra log Security với Event ID 4688 (Process Creation), vì mỗi khi một lệnh được chạy trong cmd, hệ thống sẽ ghi nhận nó như một process mới Ta dùng `chainsaw` để parse log từ file ``` cat files.txt | grep 'cmd.exe' ``` ![image](https://hackmd.io/_uploads/H1koyNrhgg.png) Sau `cd` thì command đầu tiên mà attacker dùng là **systeminfo** ## 2. Which parent process (full path) spawned the attacker’s commands? Kiểm tra chi tiết bằng EventViewer sẽ thấy đáp án là **C:\Windows\System32\wbem\WmiPrvSE.exe** ![image](https://hackmd.io/_uploads/ryEP-NSnee.png) ## 3, Which remote-execution tool was most likely used for the attack? Từ đáp án trên, khi **WmiPrvSE.exe** được sử dụng, ta có thể nghĩ đến tool mà attacker đã dùng là **wmiexec.py** (Impacket), một tool thực thi lệnh qua WMI trên host từ xa ## 4. What was the attacker’s IP address? Ở [Q1](#1-What-was-the-first-non-cd-command-executed-by-the-attacker-on-the-host), tình cờ thấy một CommandLine sau ``` md.exe /Q /c cmd /C "echo 10.129.242.110 NapoleonsBlackPearl.htb >> C:\Windows\System32\drivers\etc\hosts" 1> \\127.0.0.1\ADMIN$\__1756075857.955773 2>&1 ``` ![image](https://hackmd.io/_uploads/B1FWXEr2el.png) Mục đích của attacker là thêm một ánh xạ tên miền vào file hosts ( `NapoleonsBlackPearl.htb` trỏ về `10.129.242.110`) thủ đoạn hay dùng để đảm bảo hostname luôn trỏ tới IP mong muốn, bỏ qua DNS và ghi mọi thứ vào một file trên `ADMIN$` (local admin share). Hành vi này gợi ý lệnh được thực thi với quyền quản trị và có thể là hoạt động độc hại/được sử dụng để né detection ## 5. What is the first element in the attacker's sequence of persistence mechanisms? Tiếp tục ở [Q1](#1-What-was-the-first-non-cd-command-executed-by-the-attacker-on-the-host) ta thấy một command đang thực hiện để persistent bằng scheduler và đặt tên nó là **SysHelper Update** ![image](https://hackmd.io/_uploads/rkPTEVH3gg.png) Command này đang chạy script PowerShell có tên là **JM.ps1** mỗi 2 phút với quyền SYSTEM ## 6. Identify the script executed by the persistence mechanism Như đã phát hiện ở [Q5](#5-What-is-the-first-element-in-the-attackers-sequence-of-persistence-mechanisms) full path nằm ở **C:\Users\Werni\Appdata\Local\JM.ps1** ``` cmd.exe /Q /c schtasks /create /tn "SysHelper Update" /tr "powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\Users\Werni\Appdata\Local\JM.ps1" /sc minute /mo 2 /ru SYSTEM /f 1> \\127.0.0.1\ADMIN$\__1756076432.886685 2>&1 ``` ## 7. What local account did the attacker create? Tại event 4720 (A user account was created) ta sẽ thấy được tất cả các user được tạo. Để biết được chính xác user nào được tạo, ta sẽ phải đọc file **JM.ps1** ![image](https://hackmd.io/_uploads/SkriDNShxl.png) Với list trên, **svc_netupd** chính là username mà attacker đã tạo ![image](https://hackmd.io/_uploads/HkiuI4Shxx.png) ## 8. What domain name did the attacker use for credential exfiltration? Ở phát hiện ở [Q4](#4-What-was-the-attacker’s-IP-address) ta cũng sẽ thấy được domain mà attacker sử dụng là **NapoleonsBlackPearl.htb** ``` md.exe /Q /c cmd /C "echo 10.129.242.110 NapoleonsBlackPearl.htb >> C:\Windows\System32\drivers\etc\hosts" 1> \\127.0.0.1\ADMIN$\__1756075857.955773 2>&1 ``` ![image](https://hackmd.io/_uploads/B1FWXEr2el.png) ## 9. What password did the attacker's script generate for the newly created user? Đọc file ở [Q7](#7-What-local-account-did-the-attacker-create), password được tạo ra với format là `Watson_$timestamp` ``` $timestamp = (Get-Date).ToString("yyyyMMddHHmmss") $password = "Watson_$timestamp" ``` Dựa vào event 4720, ta sẽ biết được password, tuy nhiên EventViewer mặc định sẽ để thời gian của các log theo giờ của máy do đó ta cần chuyển về giờ của host là UTC - 7. Có thể check tại ``` HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation ``` ![image](https://hackmd.io/_uploads/rkcvcVHnle.png) Cái này có thể hỏi chatGPT để xác định lại chính xác múi giờ. Sau đó có thể yêu cầu nó chuyển từ GMT + 7 sang UTC ``` 2025-08-24 16:05:09 -> Watson_20250824160509 ``` ## 10. What was the IP address of the internal system the attacker pivoted to? Ở ques này mình nhớ đến [một blog](https://www.adamcouch.co.uk/pivoting-with-netsh-in-windows/) về một bài lab khai thác về pivot cũng nhờ chatGPT để tìm ra IP tại `HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v4tov4\tcp` ![image](https://hackmd.io/_uploads/BJbEeSrnxg.png) > PortProxy là cơ chế port-forwarding tích hợp trong Windows ![image](https://hackmd.io/_uploads/BJNxZrS2le.png) Kết luận IP nội bộ mà attacker sử dụng là **192.168.1.101** ## 11. Which TCP port on the victim was forwarded to enable the pivot? [Q10](#10-What-was-the-IP-address-of-the-internal-system-the-attacker-pivoted-to) đã trả lời đó là **9999** ## 12. What is the full registry path that stores persistent IPv4→IPv4 TCP listener-to-target mappings? [Q10](#10-What-was-the-IP-address-of-the-internal-system-the-attacker-pivoted-to) đã trả lời đó là **HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v4tov4\tcp** ## 13. What is the MITRE ATT&CK ID associated with the previous technique used by the attacker to pivot to the internal system? Khi đã hiểu rõ kỹ thuật mà attackerr đã làm gì để pivot, ta dễ dàng search được google đó là **T1090.001** của MITRE ATT&CK :)) ![image](https://hackmd.io/_uploads/SyxlfBrngl.png) ## 14. Before the attack, the administrator configured Windows to capture command line details in the event logs. What command did they run to achieve this? Ta tìm được command này ở lịch sử powershell ``` reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit" /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f ``` ![image](https://hackmd.io/_uploads/By14_rr3xe.png) # The Watchman's Residue With help from D.I. Lestrade, Holmes acquires logs from a compromised MSP connected to the city’s financial core. The MSP’s AI servicedesk bot looks to have been manipulated into leaking remote access keys - an old trick of Moriarty’s. ## Overview ### Case Summary Cuộc điều tra cho thấy attacker sử dụng máy đã không hoạt động với IP **10.0.69.45** (hostname **WATSON-ALPHA-2**) để mở phiên chat với MSP-HELPDESK-AI qua HTTP, thực hiện prompt-injection khiến chatbot rò rỉ thông tin TeamViewer và sau đó truy cập Cogwork Central Workstation bằng tài khoản **James Moriarty**, từ IP nội bộ phía đối tác **192.168.69.213**, attacker tải và dàn công cụ tại` C:\Windows\Temp\safe\` (mimikatz, Everything, webbrowserpassview, JM.exe…), chạy dump password trình duyệt, thực thi **mimikatz** lúc **10:07:08 20/08/2025**, mở tệp kết quả `.txt` lúc **10:08:06**, di chuyển bản sao Heisen-9 vào thư mục staged hoàn tất lúc **10:11:09**, rồi bắt đầu exfil các file nhạy cảm qua TeamViewer, để bám trụ, attacker tạo persistence bằng cách chỉnh **Winlogon** trỏ đến **JM.exe** lúc **10:13:57 20/08/2025**, đây là kỹ thuật MITRE T1547.004. Phiên RMM có thời điểm kết thúc lúc **20-08-2025 10:14:27** >### Comment > Windows endpoint forensic challenge ### Question 1. What was the IP address of the decommissioned machine used by the attacker to start a chat session with MSP-HELPDESK-AI? 2. What was the hostname of the decommissioned machine? 3. What was the first message the attacker sent to the AI chatbot? 4. When did the attacker's prompt injection attack make MSP-HELPDESK-AI leak remote management tool info? 5. What is the Remote management tool Device ID and password? 6. What was the last message the attacker sent to MSP-HELPDESK-AI? 7. When did the attacker remotely access Cogwork Central Workstation? 8. What was the RMM Account name used by the attacker? 9. What was the machine's internal IP address from which the attacker connected? 10. The attacker brought some tools to the compromised workstation to achieve its objectives. Under which path were these tools staged? 11. Among the tools that the attacker staged was a browser credential harvesting tool. Find out how long it ran before it was closed? 12. The attacker executed a OS Credential dumping tool on the system. When was the tool executed? 13. The attacker exfiltrated multiple sensitive files. When did the exfiltration start? 14. Before exfiltration, several files were moved to the staged folder. When was the Heisen-9 facility backup database moved to the staged folder for exfiltration? 15. When did the attacker access and read a txt file, which was probably the output of one of the tools they brought, due to the naming convention of the file? 16. The attacker created a persistence mechanism on the workstation. When was the persistence setup? 17. What is the MITRE ID of the persistence subtechnique? 18. When did the malicious RMM session end? 19. The attacker found a password from exfiltrated files, allowing him to move laterally further into CogWork-1 infrastructure. What are the credentials for Heisen-9-WS-6? ### Tools use - WireShark - john the ripper - keepass2john - Registry Explorer - JLECmd - PECmd - ChatGPT ## 1. What was the IP address of the decommissioned machine used by the attacker to start a chat session with MSP-HELPDESK-AI? Vì ta được cấp cho một file WireShark nên ta sẽ xem các cuộc giao tiếp hiện có trong hệ thống. Mở `Statistics` -> `Conversations` ![image](https://hackmd.io/_uploads/Sy-nL3whgl.png) Quan sát hình trên, ta thấy địa chỉ IP **10.0.69.45** đã thực hiện tới 698 packet với tổng lưu lượng gần 2MB trong suốt gần 15 phút – một khoảng thời gian khá dài. Đáng chú ý hơn, khi kiểm tra sang tab `TCP`, IP này còn kết nối tới một địa chỉ khác đang mở port 1337. Trong bối cảnh CTF, chi tiết này cực kỳ đáng ngờ :)) ![image](https://hackmd.io/_uploads/H15BO3P3lx.png) Tiếp theo để cf lại chính xác có đúng nó đang giao tiếp với con bot không thì ta sẽ filter giao tiếp với `HTTP` request bằng method `POST` ``` http.request.method == "POST"and ip.addr == 10.0.69.45 ``` Nhìn vào API cũng đoán đoán được rồi :)) ![image](https://hackmd.io/_uploads/BkRRYnv3el.png) Đọc nội dung 1 packet ![image](https://hackmd.io/_uploads/BJnN9nPnll.png) ## 2. What was the hostname of the decommissioned machine? Khi một máy trong LAN muốn tìm IP của một hostname (hoặc ngược lại), nó sẽ gửi NBNS query để hỏi, Dựa vào điều này ta sẽ filter như bên dưới để tìm hostname là **WATSON-ALPHA-2** ``` ip.addr == 10.0.69.45 and nbns ``` ![image](https://hackmd.io/_uploads/Bk6bh3Pnxx.png) ## 3. What was the first message the attacker sent to the AI chatbot? Quay trở lại [Q1](#1-What-was-the-IP-address-of-the-decommissioned-machine-used-by-the-attacker-to-start-a-chat-session-with-MSP-HELPDESK-AI), kiểm tra nội dung gói đầu tiên mà attacker gửi đi ta sẽ có messenger **Hello Old Friend** ![image](https://hackmd.io/_uploads/H1V9n2vhll.png) Ở cái gói tin sau, ta có thể nhận thấy rằng các response của chatbot đều lưu dưới dạng json và lưu trữ nội dung câu trả lời của nó từ khi bắt đầu cho đến đoạn chat tiếp theo ## 4. When did the attacker's prompt injection attack make MSP-HELPDESK-AI leak remote management tool info? Ở đoạn chat thứ 3, attacker đã yêu cầu bot gửi credential của RMM tool. Như đã nói ở [Q3](#3-What-was-the-first-message-the-attacker-sent-to-the-AI-chatbot), ta sẽ theo các nội dung nó trả lời tiếp theo là biết được thời gian prompt inject ![image](https://hackmd.io/_uploads/BJU_T2D2lx.png) Thời gian **2025-08-19 12:02:06** được thấy ở trường `timestamp` ![image](https://hackmd.io/_uploads/BJvHJTwhee.png) ## 5. What is the Remote management tool Device ID and password? Trả lời cho câu này là nội dung đi theo của [Q4](#4-When-did-the-attackers-prompt-injection-attack-make-MSP-HELPDESK-AI-leak-remote-management-tool-info) **565963039:CogWork_Central_97&65** ## 6. What was the last message the attacker sent to MSP-HELPDESK-AI? Check gói tin cuối cùng ![image](https://hackmd.io/_uploads/BkIfe6vhgg.png) **JM WILL BE BACK** ## 7. When did the attacker remotely access Cogwork Central Workstation? Sau khi tìm xung quanh, ta thấy được RMM tool được hệ thống sử dụng là TeamView. Vị trí ở: `C:\Users\DELL\Desktop\The_Watchman's_Residue\TRIAGE_IMAGE_COGWORK-CENTRAL\C\Program Files\TeamViewer` ![image](https://hackmd.io/_uploads/HJycFaPhlx.png) Với log ghi lại `Connections_incoming.txt` ta sẽ thấy được thời gian bắt đầu kết nối và kết thúc [Q18](#18-When-did-the-malicious-RMM-session-end) kết nối của attacker ![image](https://hackmd.io/_uploads/S1wCtpv3el.png) ## 8. What was the RMM Account name used by the attacker? Câu trả lời có từ [Q7](#7-When-did-the-attacker-remotely-access-Cogwork-Central-Workstation) là user **James Moriarty** ## 9. What was the machine's internal IP address from which the attacker connected? Để trả lời cho câu hỏi này, ta sẽ xem log còn lại `TeamViewer15_Logfile.log` ``` UDPv4: punch received a=192.168.69.213:55408 ``` **192.168.69.213** là địa chỉ nội bộ (IPv4) của bên đối tác (peer) gửi UDP punch, tức IP nội bộ của máy kết nối đến (attacker). Máy local (bị điều khiển) là 192.168.69.130 (được ghi ở đầu log) ## 10. The attacker brought some tools to the compromised workstation to achieve its objectives. Under which path were these tools staged? Để trả lời cho câu hỏi này, log của TeamView khi có download file về sẽ có nội dung là `download`. Dựa vào điều này để find ![image](https://hackmd.io/_uploads/r1hV3awnel.png) Các file đều được tải về đều là dấu hiệu của các tool liên quan đến khai thác và leak data (`mimikatz`,`Everything`,`webbrowserpassview`, file đặc biệt là `JM.exe`) và được lưu tại folder **C:\Windows\Temp\safe\** > Từ đây có thêm thông tin về việc nên tìm bằng cả write file chứ không chỉ download ## 11. Among the tools that the attacker staged was a browser credential harvesting tool. Find out how long it ran before it was closed? Như đã nói ở [Q10](#10-The-attacker-brought-some-tools-to-the-compromised-workstation-to-achieve-its-objectives-Under-which-path-were-these-tools-staged) attacker tải rất nhiêu file khai thác và một trong số đó là tool tìm credential của browser. Để tìm được thời gian chạy của file, ta sẽ dùng registry `UserAssist` tại `NTUSER.DAT` ![image](https://hackmd.io/_uploads/SyaRyRwnxg.png) Thấy được thời gian chạy của nó là 8s, theo format câu hỏi là **8000** milisecond ## 12. The attacker executed a OS Credential dumping tool on the system. When was the tool executed? Khi file bắt đầu thực thi, nó sẽ tạo ra file `.pf` tại file `$J` nhằm mục đích lần sau khởi động thì chạy nhanh hơn. Dựa vào điều này ta có thể xác định thời gian mà tool bắt đầu chạy Tool được sử dụng là `mimikatz` - chuyên dùng để khai thác OS Credential. Và thời gian bắt đầu chạy là **2025-08-20 10:07:08** ![image](https://hackmd.io/_uploads/r1tx7Av2gl.png) ## 13. The attacker exfiltrated multiple sensitive files. When did the exfiltration start? Quay lại log TeamView và ta có được thời gian bắt đầu gửi file nhạy cảm (`.pdf`, `.txt` và `.kdbx`) ![image](https://hackmd.io/_uploads/BkqtHAvhgx.png) ## 14. Before exfiltration, several files were moved to the staged folder. When was the Heisen-9 facility backup database moved to the staged folder for exfiltration? Quay lại file `$J` ta sẽ thấy nó bắt đầu đổi tên file ![image](https://hackmd.io/_uploads/HkjaHRw2eg.png) Trong timeline hoạt độnG có 2 reason sau: ObjectIdChange = khởi động quá trình copy. FileCreate|Close = hoàn tất việc tạo file trong staged. Gỉa sử khi có câu hỏi về thời gian mà file được chuyển đến staged folder thì `2025-08-20 10:10:04` là (ObjectIdChange) thì đây mới chỉ là lúc metadata thay đổi. **2025-08-20 10:11:09** (FileCreate|Close) là đáp án vì đó là khi file thật sự có mặt trong staged folder. ## 15. When did the attacker access and read a txt file, which was probably the output of one of the tools they brought, due to the naming convention of the file? Để trả lời cho câu hỏi này ta sẽ sử dụng Jumplist được lưu tại `C:\Users\DELL\Desktop\The_Watchman's_Residue\TRIAGE_IMAGE_COGWORK-CENTRAL\C\Users\Cogwork_Admin\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations`. Ta sẽ sử dụng để parse ra ``` JLECmd.exe -f "C:\Users\DELL\Desktop\The_Watchman's_Residue\TRIAGE_IMAGE_COGWORK-CENTRAL\C\Users\Cogwork_Admin\AppData\Roaming\Microsoft\Windows\Recent\AutomaticDestinations" --csv "C:\output" ``` Ta sẽ xác định được thời gian nó được mở à **2025-08-20 10:08:06** ![image](https://hackmd.io/_uploads/r1A-9Rvhee.png) ## 16. The attacker created a persistence mechanism on the workstation. When was the persistence setup? Sau khi phân tích đủ lâu và chợt nhận ra ở [Q10](#10-The-attacker-brought-some-tools-to-the-compromised-workstation-to-achieve-its-objectives-Under-which-path-were-these-tools-staged), file `JM.exe` cũng chính là file signature của nhóm tấn công chưa được đề cập đến Khi nói đến persistent thì có thể nghĩ đến ngay nó sẽ được nằm ở Registry ![image](https://hackmd.io/_uploads/S1Sp6cWzee.png) ![image](https://hackmd.io/_uploads/rJJNb1dnlx.png) Chúng ta có thể thấy dấu thời gian ghi cuối cùng của key này là **2025-08-20 10:13:57**, chính là thời gian file `JM.exe` được tạo persistent ![image](https://hackmd.io/_uploads/SkvHW1dnle.png) ## 17. What is the MITRE ID of the persistence subtechnique? Từ [Q16](#16-The-attacker-created-a-persistence-mechanism-on-the-workstation-When-was-the-persistence-setup) nhận thấy attacker đã tạo persistence thông qua registry tại `Microsoft\Windows NT\CurrentVersion\Winlogon` bằng cách cấu hình Logon Autostart để chạy file `JM.exe` search Google sẽ ra được luôn kỹ thuật **T1547.004** ![image](https://hackmd.io/_uploads/SyllCCwnel.png) ## 18. When did the malicious RMM session end? Trả lời từ [Q7](#7-When-did-the-attacker-remotely-access-Cogwork-Central-Workstation) ## 19. The attacker found a password from exfiltrated files, allowing him to move laterally further into CogWork-1 infrastructure. What are the credentials for Heisen-9-WS-6? Ta sẽ tiến hành crash file `.kdbx` bằng `john` và `keepass2john`. Đầu tiên là lấy hash password của file trước ``` ┌──(kali㉿kali)-[~/Desktop/The_Watchman's_Residue] └─$ keepass2john acquired\ file\ \(critical\).kdbx ┌──(kali㉿kali)-[~/Desktop/The_Watchman's_Residue] └─$ keepass2john acquired\ file\ \(critical\).kdbx > a ``` ![image](https://hackmd.io/_uploads/Hyd6oRPhll.png) Sau đó là dùng `john` để bắt đầu crack ``` ┌──(kali㉿kali)-[~/Desktop/The_Watchman's_Residue] └─$ john --wordlist=/usr/share/wordlists/rockyou.txt a ``` ![image](https://hackmd.io/_uploads/ry0G3Rvhxe.png) Với password có, ta sẽ thấy được credential của host `Heisen-9-WS-6` ![image](https://hackmd.io/_uploads/Hk7220Pnel.png) # The Tunnel Without Walls A memory dump from a connected Linux machine reveals covert network connections, fake services, and unusual redirects. Holmes investigates further to uncover how the attacker is manipulating the entire network! ## Overview ### Case Summary Attacker đã ssh rồi chạy chuỗi command recon (xem phiên bản hệ điều hành, IP, process…) trong shell PID **13608**. Từ đây hắn xác thực sang người dùng khác (`jm`) để leo thang đặc quyền và chiếm root. Tiếp đó, attacker tải mã độc từ Pastebin để cài rootkit **Nullincrevenge**. Để chiếm quyền điều khiển mạng nội bộ, attacker cài **dnsmasq** và chỉnh iptables nhằm phát DHCP/DNS độc, mạo danh cổng nội bộ. Một workstation (**Parallax-5-WS-3**) nhận cấu hình xấu, người dùng từ đây đăng nhập **City of CogWork-1**. Trang giả mạo gợi ý nâng cấp AetherDesk và chuyển hướng tải về endpoint độc. Cơ chế lừa dựa trên việc redirect domain gốc sang IP cuối cấu hình trong **default.conf** của nginx. Toàn bộ chuỗi cho thấy con đường xâm nhập: ssh -> leo thang -> rootkit -> DNS/DHCP ác ý -> đánh cắp/đánh lừa cập nhật phần mềm theo kiểu supply chain. >### Comment > Windows memory forensic challenge ### Question 1. What is the Linux kernel version of the provided image? 2. The attacker connected over SSH and executed initial reconnaissance commands. What is the PID of the shell they used? 3. After the initial information gathering, the attacker authenticated as a different user to escalate privileges. Identify and submit that user's credentials. 4. The attacker downloaded and executed code from Pastebin to install a rootkit. What is the full path of the malicious file? 5. What is the email account of the alleged author of the malicious file? 6. The next step in the attack involved issuing commands to modify the network settings and installing a new package. What is the name and PID of the package? 7. Clearly, the attacker's goal is to impersonate the entire network. One workstation was already tricked and got its new malicious network configuration. What is the workstation's hostname? 8. After receiving the new malicious network configuration, the user accessed the City of CogWork-1 internal portal from this workstation. What is their username? 9. Finally, the user updated a software to the latest version, as suggested on the internal portal, and fell victim to a supply chain attack. From which Web endpoint was the update downloaded? 10. To perform this attack, the attacker redirected the original update domain to a malicious one. Identify the original domain and the final redirect IP address and port. ### Tools use - volatility 3 - bulk_extractor - ChatGPT ## 1. What is the Linux kernel version of the provided image? Để kiểm tra kernel version của Linux ta sẽ dùng plugin `banner` ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem banner ``` ![image](https://hackmd.io/_uploads/HJwS5HO2ee.png) Từ việc xác định được kernel version sẽ giúp ta xác định đúng symbol. Để không xảy ra lỗi trong quá trình phân tích phía sau. Có thể tham khảo [tại đây](https://hackmd.io/VtcUDZZnRHOqYzXrvk87cw?both#S%E1%BB%ADa-l%E1%BB%97i-vol-ch%C6%B0a-nh%E1%BA%ADn-%C4%91%C6%B0%E1%BB%A3c-symbols) để setup ## 2. The attacker connected over SSH and executed initial reconnaissance commands. What is the PID of the shell they used? Ta sẽ sử dụng plugin `bash` để xem các command mà attacker đã sử dụng khi đã xâm nhập thành công vào máy nạn nhân ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.bash ``` ![image](https://hackmd.io/_uploads/B1XAkLO3xe.png) Ta thấy được attacker đang dùng các lệnh cơ bản để recon như xem version hệ điều hành, ip, các process đang chạy,... với pid là **13608** ## 3. After the initial information gathering, the attacker authenticated as a different user to escalate privileges. Identify and submit that user's credentials. Kết quả ở [Q2](#2-The-attacker-connected-over-SSH-and-executed-initial-reconnaissance-commands-What-is-the-PID-of-the-shell-they-used) cho ta thấy được sau khi recon xong attacker đã ssh sang tài khoản khác. Cụ thể là ssh sang user jm ![image](https://hackmd.io/_uploads/ryzT78_2gl.png) Từ đây ta có thể đọc dựa vào trick dùng `strings` để tìm với keyword là `jm:` vì nó đều có cách nhau bằng dấu `:` mô tả như hình dưới ![image](https://hackmd.io/_uploads/BJPunw_3lx.png) ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ strings memdump.mem| grep 'jm:' ``` ![image](https://hackmd.io/_uploads/Hy_FsDO2eg.png) Két quả trả về cho ta thấy được luôn rằng attacker đã leo được lên đến root. Đem crack và ta được password ![image](https://hackmd.io/_uploads/B15wCDdhlg.png) ## 4. The attacker downloaded and executed code from Pastebin to install a rootkit. What is the full path of the malicious file? Tại lịch sử của bash khi nãy ta thấy attacker có tải file từ Pastebin, tuy nhiên link này đã chết ![image](https://hackmd.io/_uploads/SyvplOOhee.png) Theo mô tả của câu hỏi, attacker đã tải và cài cắm một con rootkit tức là nó sẽ ăn sâu vào hdh (kernel), ta sẽ dùng plugin `linux.hidden_modules.Hidden_modules` để check module kernel “ẩn” ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.hidden_modules.Hidden_modules ``` ![image](https://hackmd.io/_uploads/BkhRkdOnxg.png) Tiếp tục dùng plugin `linux.pagecache.Files` để tìm extension và vị trí của file ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.pagecache.Files | grep 'Nullincrevenge' ``` ![image](https://hackmd.io/_uploads/rkMS4__nge.png) ## 5. What is the email account of the alleged author of the malicious file? Để đọc được nội dung của file độc để có thông tin email có 2 cách. Dump trực tiếp file này bằng `linux.pagecache.InodePages` và đọc file ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.pagecache.InodePages --inode 0x9b3386454a80 --dump ``` ![image](https://hackmd.io/_uploads/H16Iru_hge.png) ## 6. The next step in the attack involved issuing commands to modify the network settings and installing a new package. What is the name and PID of the package? Từ lịch sử bash ở [Q2](#2-The-attacker-connected-over-SSH-and-executed-initial-reconnaissance-commands-What-is-the-PID-of-the-shell-they-used) attacker đã tải `dnsmasq` để tạo mạng nội bộ đúng như mô tả của câu hỏi ![image](https://hackmd.io/_uploads/BkkjUd_3ee.png) Trace bằng `linux.pstree` để xem nó là PID nào ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.pstree ``` ![image](https://hackmd.io/_uploads/B14fD_dnlg.png) ## 7. Clearly, the attacker's goal is to impersonate the entire network. One workstation was already tricked and got its new malicious network configuration. What is the workstation's hostname? Ở phía trên trước khi `dnsmasq` được thực thi, attacker đã setup dải mạng bằng iptables. Tức là có thể suy đoán được các ip thuộc dải `192.168.211.0/24` đều bị ảnh hưởng ![image](https://hackmd.io/_uploads/ryP7q__nex.png) Sử dụng `strings` vào file `.mem` để xem thông tin host nào dính ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ strings memdump.mem| grep '192.168.211.' ``` Kết quả trả ra chỉ có duy nhất host **Parallax-5-WS-3** là dính ![image](https://hackmd.io/_uploads/HJRpcuuhex.png) ## 8. After receiving the new malicious network configuration, the user accessed the City of CogWork-1 internal portal from this workstation. What is their username? Theo mô tả câu hỏi thì có user từ host `City of CogWork-1` đã truy cập vào, do đó ta sẽ dùng một công cụ để có thể xem các request đến. Ở đây mình dùng `bulk_extractor`, tool này hỗ trợ ta lấy được các file traffic có trong file `.mem` ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ bulk_extractor -o traffic memdump.mem ``` Filter `http` -> `Follow stream` -> `http` và ta có được username ![image](https://hackmd.io/_uploads/B1GbJY_nel.png) ## 9. Finally, the user updated a software to the latest version, as suggested on the internal portal, and fell victim to a supply chain attack. From which Web endpoint was the update downloaded? Ở gói tin tiếp theo ta thấy được nội dung mà attacker tạo ở trang web nhằm lừa nạn nhân tải file về để cập nhật phần mềm. Đúng như mô tả câu hỏi, ta có nội dung như ảnh bên dưới ![image](https://hackmd.io/_uploads/HyEoJFd3ge.png) File được lừa để tải là `AetherDesk`, dựa vào tên này ta sẽ tìm các api có liên quan để tìm ra link có endpoint tải file. Khi tra từng gói tin, ta đã thấy được nó đã xuất hiện các api liên tục ref với nhau để dẫn đến trang đích ![image](https://hackmd.io/_uploads/r183eFuhgl.png) Tuy nhiên sau khi tìm the gói tin ta lại không tìm thấy chút manh mối nào về endpoint nào cả Giờ quay lại vấn đề, khi có user nào đó bị lừa bởi máy bị nhiễm thì chắc chắn nó sẽ gửi request về IP máy đó. Do đó ta sẽ trace bằng cách strings IP ở file `.mem` để xem các request vì lúc trước ở [Q7](#7-Clearly-the-attackers-goal-is-to-impersonate-the-entire-network-One-workstation-was-already-tricked-and-got-its-new-malicious-network-configuration-What-is-the-workstations-hostname) ta cũng thấy các request gửi đến ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ strings memdump.mem| grep '192.168.211.52' ``` ![image](https://hackmd.io/_uploads/HJrqGtunxl.png) ## 10. To perform this attack, the attacker redirected the original update domain to a malicious one. Identify the original domain and the final redirect IP address and port Để xem chính xác nó trỏ về domain nào ta cần xác định config của tool như thế nào. Đoạn này dùng chatGPT ta biết được file config của `dnsmasq` nằm ở `/etc/dnsmasq.conf`. Tiến hành dump file này ra ``` ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.pagecache.Files | grep '/etc/dns' ┌──(kali㉿kali)-[~/Desktop/volatility3-2.26.0] └─$ python3 vol.py -f memdump.mem linux.pagecache.InodePages --inode 0x9b33ac25aae0 --dump ``` ![image](https://hackmd.io/_uploads/SyLMNF_3xe.png) Strings và ta biết được domain name ![image](https://hackmd.io/_uploads/BkNuVtdnlx.png) Tuy nhiên vấn đề tiếp theo là file này lại không hề có ip và port. Đến đoạn này mình phải đi xin hint : ) Theo hint, attacker còn thực hiện sửa file `default.conf` trước khi tiến hành tấn công. Do đó khả năng file này sẽ có thông tin ta cần ![image](https://hackmd.io/_uploads/H1QUHFdhgg.png) Một lần nữa dump file và strings ta sẽ hoàn thành challenge :)))) ![image](https://hackmd.io/_uploads/rJbABKOnex.png) ![image](https://hackmd.io/_uploads/ry_NIF_ngl.png) # The Payload Bài này nhờ có sự trợ giúp của 2 pro [Đức Nghĩa](https://www.facebook.com/baocool3002) và [Hải Long](https://www.facebook.com/baocool3002) đã gussing được ra đến flag cuối : )) xin cảm ơn 2 bro để làm cho kết quả đẹp thêm ![image](https://hackmd.io/_uploads/B1ApdFunlx.png) # The end Gỉai kết thúc mình vừa được học vừa được chơi. Tuyệt vời với kết quả này XD ![image](https://hackmd.io/_uploads/rknlcXBnxl.png)