[🔍 STATIC ANALYSIS TECHNIQUES]
// Master the art of analyzing binaries without execution. Learn disassembly, control flow analysis, string extraction, and function identification to understand malware behavior before it runs.
[🎯 LEARNING_OBJECTIVES]
> mastery_goals.list
- [✓]Master disassembler tools (Ghidra, IDA, Binary Ninja)
- [✓]Perform comprehensive string and metadata analysis
- [✓]Analyze control flow graphs and identify code patterns
- [✓]Recognize function signatures and calling conventions
- [✓]Extract IOCs and create detection signatures
> prerequisites.cfg
- - Completed Lesson 3: File Formats
- - Assembly language fundamentals
- - Hexadecimal and binary understanding
- - Command line proficiency
[📚 STATIC_ANALYSIS_FUNDAMENTALS]
🔍 What is Static Analysis?
Static analysis is the examination of software without executing it. Think of it as performing an autopsy on code - dissecting every component to understand structure, behavior, and purpose before the program ever runs.
✅ Advantages
- • Safe - malware can't execute
- • Complete coverage - analyze all code paths
- • Fast - no need for sandboxes
- • Deterministic - same results every time
⚠️ Limitations
- • Can't analyze runtime behavior
- • Defeated by obfuscation/packing
- • May miss dynamic code generation
- • Requires significant expertise
🛠️ Static Analysis Workflow
1. Initial Triage
file, entropy, DIE, PEiDFile type, size, entropy, packing detection
2. Metadata Analysis
exiftool, sigcheck, pescanHeaders, timestamps, digital signatures
3. String Extraction
strings, FLOSS, StringSifterReadable strings, URLs, registry keys
4. Disassembly
Ghidra, IDA, Binary NinjaConvert machine code to assembly
5. Code Analysis
Manual analysis, CFG viewersControl flow, function identification, algorithms
🎯 Key Analysis Areas
Import/Export Analysis
Reveals capabilities and dependencies
Entropy Analysis
Detect packed/encrypted sections
Cross-References
Track data and function usage
[⚙️ DISASSEMBLER_MASTERY]
Ghidra
NSA's Free Powerhouse
🏆 Strengths
- • Completely free and open source
- • Excellent decompiler output
- • Multi-architecture support
- • Collaborative analysis features
- • Scriptable with Python/Java
💡 Best For
- • Beginners learning reverse engineering
- • Large-scale malware analysis
- • Academic and research projects
- • Cross-platform binary analysis
IDA Pro
Industry Standard
🏆 Strengths
- • Most mature analysis engine
- • Extensive plugin ecosystem
- • Superior debugging integration
- • Advanced signature matching
- • Professional support
💰 Considerations
- • Very expensive licensing
- • Complex learning curve
- • IDA Free has limitations
- • Proprietary/closed source
Binary Ninja
Modern UI Leader
🏆 Strengths
- • Beautiful, modern interface
- • Excellent API for automation
- • Strong community support
- • Innovative analysis techniques
- • Regular feature updates
🎯 Best For
- • Modern malware analysis
- • Custom analysis workflows
- • UI-focused analysts
- • Educational environments
🔧 Advanced Disassembly Techniques
Function Identification
Modern disassemblers use multiple techniques to identify function boundaries:
Signature-Based Recognition
Control Flow Analysis
Data Type Recovery
Inferring data structures from assembly code patterns:
Structure Field Access
Array Access Patterns
[🔤 STRING_ANALYSIS_MASTERY]
🎯 Why String Analysis is Critical
Strings are the DNA of malware - they reveal capabilities, targets, and intentions before execution. A single string can identify malware families, C&C servers, or attack vectors.
🔍 Intelligence Goldmine
- • C&C server URLs and IP addresses
- • Cryptocurrency wallet addresses
- • Registry keys for persistence
- • File paths and mutex names
- • Error messages and debug info
⚠️ Evasion Challenges
- • String encryption and obfuscation
- • Stack string construction
- • Unicode and encoding variations
- • Base64 and custom encoding
- • Runtime string deobfuscation
🛠️ String Extraction Tools
GNU strings (Basic)
FLOSS (Advanced)
Custom Regex Hunting
🏷️ String Classification & Analysis
🚨 High-Value Strings
• 192.168.1.100:4444
• evil.dyndns.org
• %TEMP%\\payload.dll
• ~/.bashrc
• SYSTEM\\CurrentControlSet\\Services
🔧 Analysis Techniques
Encoding Detection
String Entropy
Cross-Reference Analysis
[🌐 CONTROL_FLOW_ANALYSIS]
🧠 Understanding Program Logic
Control Flow Graphs (CFGs) reveal how malware thinks and behaves. By mapping the flow of execution, you can identify algorithms, understand decision logic, and predict program behavior.
📊 CFG Benefits
- • Visualize program structure
- • Identify unreachable code
- • Find algorithm patterns
- • Detect anti-analysis tricks
- • Guide dynamic analysis
🔍 Analysis Focus
- • Basic block identification
- • Loop structure recognition
- • Conditional branch analysis
- • Dead code detection
- • Code complexity metrics
🧩 Basic Block Analysis
What is a Basic Block?
A basic block is a maximal sequence of instructions with:
- • Single entry point - Only one way in
- • Single exit point - Only one way out
- • Sequential execution - No branches inside
- • Atomic unit - Either all instructions execute or none
Block Boundary Detection
Block Starts
- • Function entry points
- • Jump/call targets
- • Instructions after branches
- • Exception handler entries
Block Ends
- • Jump instructions (JMP, JNZ, etc.)
- • Call instructions
- • Return instructions
- • Last instruction before target
🔄 Common Control Flow Patterns
🔀 Conditional Branches
Analysis tip: Look for CMP/TEST followed by conditional jumps
🔄 Loop Structures
Pattern: Backward jumps typically indicate loops
🎯 Switch Statements
Indicator: Indirect jumps with address tables
🎯 Advanced CFG Analysis Techniques
Complexity Metrics
Cyclomatic Complexity
E = edges, N = nodes, P = programs
Interpretation
Anti-Analysis Detection
Obfuscation Patterns
- • Excessive conditional jumps
- • Dead code insertion
- • Opaque predicates (always true/false)
- • Control flow flattening
- • Indirect jumps through calculations
Detection Heuristics
[🎯 FUNCTION_IDENTIFICATION]
📝 Function Signature Analysis
Standard Library Functions
Many functions can be identified by their unique patterns and constants:
Cryptographic Functions
Crypto algorithms have distinctive constants and operations:
📞 Calling Convention Analysis
Windows x86 Conventions
stdcall (__stdcall)
cdecl (__cdecl)
fastcall (__fastcall)
x64 Conventions
Microsoft x64 ABI
[🔬 STATIC_ANALYSIS_WORKSHOP]
Apply your static analysis skills on real-world samples! Each exercise builds on the previous, teaching you to systematically dissect malware without ever executing it.
1Comprehensive Static Analysis: Banking Trojan
🏦 Real Binary Banking Trojan Sample
Analyze a compiled binary with realistic banking trojan patterns. This is a real Mach-O executable with actual functions you can decompile in Ghidra and Binary Ninja. Completely safe for analysis.
Phase 1: Initial Triage
Command Line Assessment
Entropy Analysis
Phase 2Ghidra Deep Dive
1. Initial Import and Auto-Analysis
2. Import Analysis in Ghidra
3. String Analysis in Ghidra
4. Function Analysis and Decompilation
Phase 3: Binary Ninja Analysis
1. Load and Initial Analysis
2. Control Flow Graph Analysis
3. API Cross-Reference Analysis
4. Advanced Taint Analysis
Phase 4: Advanced Analysis Synthesis
Ghidra vs Binary Ninja Findings
• More detailed string cross-references
• Superior decompiler for complex logic
• Real-time analysis updates
• Better taint/data flow analysis
Combined Intelligence Report
📊 Complete Analysis Summary
Malware Family
Banking Trojan / Credential Harvester
Attack Vectors
Browser injection, form grabbing, C&C communication
Persistence
Registry Run key, browser configuration modification
2Control Flow Analysis: Packed Malware
📦 Packed Malware Challenge
Analyze a packed malware sample that uses control flow obfuscation. Learn to identify unpacking stubs, find the original entry point (OEP), and understand evasion techniques.
Step 1: Multi-Tool Packer Detection
Command Line Detection
Section Analysis
Step 2: Ghidra Analysis of Packer Stub
1. Import and Analysis Setup
2. Entry Point Examination
3. Unpacking Algorithm Analysis
4. Memory Layout Analysis
Step 3: Binary Ninja Unpacking Strategy
1. Initial Load and Entropy Visualization
2. Control Flow Analysis of Unpacker
3. Static Unpacking Technique
4. Post-Unpacking Analysis
Step 4: Comparative Analysis Results
Packed vs Unpacked Analysis
• 23 readable strings
• Minimal import table
• High entropy sections
• 1,247 strings including C&C URLs
• Complete API imports visible
• Normal entropy distribution
Key Lessons Learned
[🚨 REAL_MALWARE_INDICATORS]
⚠️ Critical Difference: Educational vs Real Malware
Our educational samples contain malware patterns and strings but use only safe APIs like printf(). Real malware uses the same strings but calls dangerous APIs that actually perform malicious actions.
🔍 Professional Tip: Always check the Import Address Table (IAT) and actual API calls - not just strings!
📋 Registry Persistence: Educational vs Real
✅ Our Educational Sample
Strings Found
Actual API Calls
Safe for analysis: Contains learning patterns but performs no malicious actions
🚨 Real Banking Malware
Same Strings (Deception)
Dangerous API Calls
Real threat: Actually writes malicious entries to Windows registry
📋 Import Address Table (IAT) Analysis
🔍 Professional Detection Technique: IAT Analysis
The Import Address Table shows which external APIs a program can call. This is the most reliable wayto identify potential malicious capabilities, regardless of obfuscation or string encryption.
✅ Educational Sample IAT
Analysis: Can only print messages and manage memory - no malicious capabilities
🚨 Real Malware IAT
Analysis: Registry modification, network communication, keylogging, file operations
🎯 Professional Malware Detection Workflow
Step-by-Step Real Malware Analysis
Import Address Table Analysis
String Analysis & Cross-References
API Call Verification
Behavioral Pattern Recognition
🚩 Real Malware Red Flags Checklist
🚨 Critical Indicators
⚠️ Evasion Indicators
[🏆 MASTER_ANALYST_CHALLENGE]
🎯 Advanced Persistent Threat Analysis
You've discovered a sophisticated APT sample with multiple stages and advanced evasion techniques. Perform a complete static analysis and create comprehensive intelligence reports.
Phase 1: Multi-Stage Analysis
- • Identify all embedded stages and payloads
- • Map the complete infection chain
- • Extract configuration data and IOCs
- • Analyze anti-analysis techniques
Phase 2: Attribution Analysis
- • Compare with known APT TTP databases
- • Identify code reuse and shared infrastructure
- • Extract metadata for timeline analysis
- • Create threat intelligence reports
Phase 3: Signature Creation
- • Develop YARA rules for detection
- • Create Snort/Suricata network signatures
- • Build IOC packages for threat hunting
- • Design behavioral detection logic
🛠️ Professional Analyst Toolkit
Advanced Analysis Commands
📦 Master Challenge Kit
Complete the master challenge to earn your Static Analysis Expert certification!