Ma Mod5
Ma Mod5
DYNAMIC ANALYSIS
Dynamic Analysis
๏ Dynamic malware analysis is the process of executing malware in a controlled
environment to observe and understand its behavior, functionality, and potential impact.
๏ Dynamic analysis allows analysts to see the malware "in action" and uncover its
true intentions and capabilities.
๏ Goals of Dynamic Analysis:
✓ Understand the malware's behavior, including what actions it performs on the infected
system
✓ Identify indicators of compromise (IOCs) such as suspicious network connections,
registry changes, or file modifications
✓ Determine the malware's purpose, targets, and potential impact
✓ Develop strategies to detect, contain, and remediate the malware infection
Key Types of Analysis
๏ Static Analysis
✓ Static analysis involves examining the document without actually executing it.
✴ Checking file metadata and properties
✴ Analyzing embedded objects, macros, and scripts
✴ Searching for suspicious strings or indicators
✴ Examining file structure and format
๏ Dynamic Analysis
✓ Dynamic analysis involves running the document in a controlled environment to
observe its behavior:
✴ Executing macros or scripts in a sandbox
✴ Monitoring system changes and network activity
✴ Analyzing memory for hidden malware components
PDF Document Structure
๏ PDF files are designed to be portable and versatile, capable of containing text, images,
multimedia,
and interactive elements.
๏ The basic structure of a PDF document consists of three main components:
✓ Header: This is the first line in a PDF file, indicating the version of the PDF
specification used. It can be viewed using a hex editor or command-line tools like
xxd.
✓ Body: The body contains the actual content of the document, organized into
objects like text streams, images, and multimedia elements. These objects are
typically stored as dictionaries.
✓ Cross-Reference Table (xref): This table provides offsets to each object in the
file, allowing for quick access without scanning the entire document. It is located
near the end of the file.
✓ Trailer: The trailer contains metadata about the document, such as its size and
location on disk, and points to the cross-reference table. It also includes an end-of-
file marker (%%EOF).
๏ PDFs support incremental updates, meaning changes can be appended without
rewriting the entire file, which can complicate analysis by introducing multiple versions of
objects.
๏ Common Exploits in PDFs:
✓ JavaScript Embedding: Attackers often embed JavaScript within PDFs to execute
malicious actions when the document is opened.
✓ Launch Actions: These can be used to open applications or execute commands,
potentially running malware on the victim's system.
✓ Obfuscation Techniques: Malicious content may be hidden using obfuscation
methods
like hex encoding.
๏ Analyzing Malicious Documents:
✓ pdfid.py and pdf-parser.py: Tools for identifying and analyzing suspicious
elements within PDF files, such as embedded JavaScript or unusual actions.
✓ peepdf: A tool that parses PDF files to highlight suspicious objects like JavaScript
or embedded files.
Risky PDF Elements
๏ /OpenAction and /AA - Specify scripts/actions to run automatically
๏ /JavaScript and /JS - Can contain malicious JavaScript code
๏ /URI - May link to malicious URLs
๏ /ObjStm - Can hide objects in streams
๏ /RichMedia - Used to embed Flash content
Mitigation Strategies
๏ Regular Vulnerability Scans:
✓ Conduct scans of internal and external networks to identify and mitigate
vulnerabilities.
๏ Block Known Bad Domains:
✓ Use web content filtering to block malicious sites by category.
๏ Educate Users:
✓ Train users to be cautious of downloads from third-party sites and to
recognize signs of malicious websites