Word and PDF Malware Reverse Engineering Report: Practical Assignment 4
Malware Reverse Engineering Report: Practical Assignment 4
Situation:
This assignment analyzed three malicious documents from spear-phishing campaigns: two PDFs (sample4a.pdf
and sample4b.pdf
) and a Microsoft Word document (sample4c.doc
). The focus was on extracting metadata, identifying malicious behaviors, and creating YARA rules for detection.
Obstacles:
- Document Compression:
- The PDF files employed
/Filter /FlateDecode
, requiring decompression for analysis.
- The PDF files employed
- Obfuscated Code:
- JavaScript and VBA code were heavily obfuscated, complicating static analysis.
- Multiple Exploit Techniques:
- The PDFs used CVE-2008-2992 (util.printf buffer overflow) while the Word document leveraged shell commands and external HTTP requests.
Actions Taken:
-
Sample4a.pdf:
- Used
peepdf
andpdf-parser
to extract metadata and decompress encoded streams. - Detected JavaScript exploiting CVE-2008-2992 to execute shell code.
- Analyzed shell code using
SpiderMonkey
andscdbg
, identifying a download ofa.exe
frombeshragos.com
. - Developed the following YARA rule:
rule beshragos_yara { meta: description = "Detects malicious PDF from beshragos.com" strings: $a = "/ID[<CA16DB0E50F60C66FCDBDA9D468C7D94><CA16DB0E50F60C66FCDBDA9D468C7D94>]" condition: ($a) }
- Used
-
Sample4b.pdf:
- Analyzed with
peepdf
, revealing obfuscated JavaScript invoking the Z0PEA5PLzPyyw() function. - The function contacted
64.22.81.244
to download and executestyle.exe
via the util.printf exploit. - Created the following YARA rule:
rule style_yara { meta: description = "Detects malicious PDF that downloads style.exe" strings: $a = "<</OpenAction <</JS (this.Z0PEA5PLzPyyw\\(\\))" condition: ($a) }
- Analyzed with
-
Sample4c.doc:
- Examined with
oledump.py
to extract VBA macros. - Identified a
bin.exe
download fromfachonet.com
, creatingYEWZMJFAHIB.exe
in the Temp directory. - Used a custom Python script to deobfuscate hex-encoded strings.
- Developed the following YARA rule:
rule fachonet_yara { meta: description = "Detects malicious document from fachonet.com" strings: $a = "\\YEWZMJFAHIB.exe" condition: ($a) }
- Examined with
Results:
- Malware Identified:
- Sample4a and Sample4b exploited CVE-2008-2992.
- Sample4c downloaded and executed files from
fachonet.com
.
- Indicators of Compromise:
- Domains:
beshragos.com
,64.22.81.244
,fachonet.com
. - Files:
a.exe
,style.exe
,YEWZMJFAHIB.exe
.
- Domains:
Tool Purpose Overview:
peepdf:
- Analyzed PDF metadata and extracted JavaScript for static analysis.
pdf-parser:
- Decompressed encoded streams in PDFs.
oledump.py:
- Extracted and analyzed macros from Word documents.
SpiderMonkey:
- Executed and debugged JavaScript shell code.
scdbg:
- Simulated shell code execution to analyze behavior.
RegShot:
- Monitored file system and registry changes post-execution.
Recommendations:
- Patch Vulnerable Software:
- Update Adobe Reader and Microsoft Office to mitigate known exploits.
- Monitor Network Activity:
- Block suspicious domains and IPs identified as IoCs.
- Enhance Email Security:
- Filter spear-phishing emails containing malicious attachments.
- User Training:
- Educate users on recognizing and avoiding phishing attempts.
View PDF Document