Malware Analysis and Reverse Engineering for Pakistani SOC Analysts: Building a Home Lab
Introduction
Pakistani organisations are seeing a rise in locally‑crafted malware, from ransomware that displays Urdu‑language ransom notes to fake Android APKs that steal easypaisa OTPs. For a SOC analyst, the ability to safely dissect a malicious binary, extract indicators, and share them is a critical skill. This lesson guides you through building an isolated malware‑analysis lab, performing static and dynamic analysis, and turning findings into actionable threat intelligence.
Lab Architecture
- Host OS: Windows 10/11 with FlareVM (a pre‑packed malware‑analysis VM) installed.
- Linux companion: REMnux for Linux‑based tools (YARA, js‑unpack, fake DNS).
- Network isolation: Connect the VMs to a VirtualBox Host‑Only network, ensuring no traffic escapes to the Internet.
- Sandbox: Cuckoo Sandbox to automatically run samples and capture behavioural reports. Set up a Wireshark capture on the host‑only interface to record all network traffic generated during analysis.
Static Analysis Workflow
- Hash generation: Compute SHA‑256, MD5, and SHA‑1 with
certutil -hashfile sample.exe SHA256. - String extraction: Use
strings sample.exe | lessto locate URLs, IP addresses, and suspicious DLL names. - Import/Export table review: Open the binary in IDA Free or Ghidra to identify imported API calls (e.g.,
CreateRemoteThread,VirtualAlloc). - YARA rule creation: Write a rule that matches the sample’s unique strings; test it with
yara -d sample.yar malware_db. Example: a recent Daraz‑themed APK contained the stringhttps://daraz‑payment‑gateway.pk/collect.php. A YARA rule targeting this URL can detect future variants.
Dynamic Analysis
Launch the sample inside Cuckoo or manually in a controlled VM. Observe:
- File system changes: New files created in
AppData\Roaming. - Registry modifications: Keys under
HKCU\Software\Microsoft\Windows\CurrentVersion\Run. - Network traffic: HTTP POSTs to an external IP, often seen in WhatsApp‑forwarded APK campaigns. Cross‑reference observed behaviours with the MITRE ATT&CK matrix (e.g., T1047 – WMI, T1086 – PowerShell).
Reporting and Indicator Sharing
Document each analysis in a standard format:
- Executive Summary: Malware family, affected platforms, potential impact.
- Technical Details: SHA‑256, strings, network IOCs, ATT&CK tactics.
- Mitigation Recommendations: Suggest blocking the malicious domain at the proxy, and update anti‑malware signatures. Export the YARA rule and IOCs to the national MISP instance (misp.pakcert.org) and feed the network IOC into your SIEM (e.g., Elastic SIEM) as a new threat indicator.
Do / Don't
- Do keep your analysis environment fully isolated, document every step for chain‑of‑custody, and promptly report findings to NCCIA 1799 if you discover active exploitation.
- Don't run malware on a production system, forget to sanitise personal data (e.g., CNIC numbers) from captured traffic logs, or store malicious samples in unencrypted locations.
Takeaway
Today, download the FlareVM image, set up a single‑VM isolated lab, and perform static analysis on a sample malware binary provided in the course repository. Save the SHA‑256 hash and the YARA rule you create – they will be used in the next lesson’s SIEM correlation exercise.
