오늘도 BlueTeamLabs의 침해사고대응/Incident Response 랩을 하나 풀어보겠습니다.
랩마다 질문에 답하기 위해 필요한 tool이 다른데 오늘 wireshark .pcap 파일을 분석해 보겠습니다.
시나리오에 따르면 직원 "Josh Morrison"은 이메일 받았고 내용은 파일을 하나 다운로드하라는 말이었습니다. 아울러 SOC팀에 따르면 링크는 악성파일을 가리키는 링크였답니다.
Wireshark는 HTTP을 비룻한 다양한 packet들을 캡처합니다. DNS, ARP, SMB, HTTP 등!
위에 시나리오에 "다운로드" "링크" 같은 힌트가 많으므로 HTTP 패킷 위주로 분석해야 할 것 같습니다.
http 필터를 사용하기 때문에 HTTP 패킷만 뜨는데 그 중에 수상한 .bat 파일을 불러오는 것이 보입니다.
패킷을 누르고 --> Follow --> HTTP Stream 눌러보면 패킷의 내용을 확인할 수 있습니다:
이 .bat 파일은 powershell 코드를 실행시키는 것을 확인할 수 있으며 파이썬의 "SimpleHTTP" 서버에서 다운로드됐습니다.
저의 모의해킹 블로그를 읽으신 분들은 알고 계시겠지만 저도 모의 침투를 할 때마다 SimpleHTTP를 활용해서 악성파일이나 다른 툴들을 다운로드합니다. 매우 수상합니다.
1번 질문: What is the full filename of the initial payload file?
--> INVOICE_2021937.pdf.bat
2번 질문: What is the name of the module used to serve the malicious payload?
--> SimpleHTTPServer
3번 질문: Analysing the traffic, what is the attacker's IP address?
--> 192.168.1.9
4번 질문: Now that you know the payload name and the module used to deliver the malicious files, what is the URL that was embedded in the malicious email?
--> http://192.168.1.9:443/INVOICE_2021937.pdf.bat
5번 질문: Find the PowerShell launcher string
--> powershell -noP -sta -w 1 -enc
6번 질문: What is the default user agent being used for communications?
--> Mozilla/5.0
7번 질문: You are seeing a lot of HTTP traffic. What is the name of a process where malware communicates with a central server asking for instructions at set time intervals?
--> Beaconing
아울러 HTTP 패킷들을 분석해 보니 매우 수상한 POST가 보입니다. 피해자가 해커가 통제하는 서버에 왜 연결하죠? 게다가 페이지를 불러오는 것도 아니고 POST네요 Length도 되게 크고... 몹시 수상합니다.
8) 질문: What is the URI containing ‘login’ that the victim machine is communicating to?
--> /login/process.php
CyberChef로 base64로 encoding되어 있는 payload를 deobfuscate를 해 보면 다음 output을 받습니다. payload에 null-byte가 있어서 "Remove null bytes"하고 "Generic Code Beautify"도 썼습니다. 다음 질문을 위해 필요한 정보입니다.
9번 질문: What is the name of the popular post-exploitation framework used for command-and-control communication?
--> Empire
구글링해볼 만한 string들 찾아보면 User Agent가 뜨는데, wireshark에서 봤던 url 주소들을 검색해 보는 것도 나쁘지 않습니다.
Empire라는 tool의 User-Agent인가봐요! Empire도 CobaltStrike처럼 RedTeam을 위한 소프트웨어입니다.
또, 수상한 부분은 피해자 머신이 ICMP를 활용하여 해커가 통제하는 서버하고 통신하는 것입니다. 패킷마다 1바이트가 보내지고 tshark로 dump 할 수 있습니다.
" tshark.lnk -r "C:\Users\BTLOTest\Desktop\Investigations\LAB.pcap -T fields -e data > dump.txt "
역시 Cyberchef로 다시 돌려보고 마지막 2질문의 대답을 받습니다
10번 질문:It is believed that data is being exfiltrated. Investigate and provide the decoded password
--> Y0uthinky0ucAnc4tchm3$$
11번 질문: What is the account’s username?
--> $sec-account
수상한 코드 실행! 침해사고대응 LetsDefend.io #2 (2) | 2022.07.29 |
---|---|
수상한 .war 파일 발견! 침해사고대응 LetsDefend.io #1 (0) | 2022.07.23 |
SOC 분석가가 되고 싶다면? Letsdefend.io에서 연습하자! (0) | 2022.07.15 |
침해사고대응 디지털포렌식 연습 방법 (0) | 2022.06.07 |
Splunk로 랜섬웨어 사냥: Conti Ransomware 침해 사고 대응 (0) | 2022.05.20 |