Malware Analysis 101
Malware Analysis 101
Infosec COTS
Thanks
Great
security
equipment
for
small
businesses
@MiltonSecurity
@BulbSecurity
@PenTestTraining
Internships
Research Security/Tools Write about Security News No $$$ but Mentorship, Lots of Exposure in DC Area, & Part-Time Hit Me Up on Twi[er: @grecs
Agenda
IntroducBon
Environment
Methodology
Where
to
Learn
More
Conclusion
IntroducBon
Am
Not
Malware
Analysis
Expert
(or
even
a
novice
for
that
ma[er)
Just
Trying
to
Learn
&
Learn
Best
by
Teaching
Looking
for
Feedback
&
RecommendaBons
Environment
Setup
Virtual
Physical
OpBons
Single
Box
Dual+
Box
Environment
Setup
Virtual
Ecient
&
Easy
to
Setup
Snap-Shots
to
Revert
Back
To
Malware
DetecBng
VM
&
TerminaBng
Physical
VM
DetecBon
Not
Possible
Resource
Intensive
Be Careful
Environment
OpBons
Single
Box
All
Analysis
Performed
on
One
Machine
Risk
of
PotenBal
Malware
Sabotage
Dual+
Box
MiBgates
Some
PotenBal
Sabotage
Gateway
to
Simulate
More
Real
Network
RealisBc
External
View
(ports
open,
network
trac)
Environment
Environment
Process
Explorer
Shows
Files,
Registry
Keys,
Opened
by
Malware
WireShark
Snier
to
Capture
Network
the
Malware
May
Make
RegShot
View
Changes
Malware
May
Make
in
the
Registry
Process
Monitor:
h[p://technet.microsoj.com/en-us/sysinternals/bb896645.aspx
Process
Explorer:
h[p://technet.microsoj.com/en-us/sysinternals/bb896653
WireShark:
h[ps://www.wireshark.org/
RegShot:
h[p://sourceforge.net/projects/regshot/
Environment
TCPView
FakeNet
Aids
Dynamic
Analysis
of
Malicious
Sojware
Simulates
Network
so
Malware
Thinks
Its
InteracBng
with
Remote
Hosts
DNS,
HTTP,
SSL,
Dummy
Listener
TCPView:
h[p://technet.microsoj.com/en-us/sysinternals/bb897437
MAP:
h[p://www.woodmann.com/collaboraBve/tools/index.php/Malcode_Analysis_Pack
FakeNet:
h[p://pracBcalmalwareanalysis.com/fakenet/
Environment
OllyDbg
OllyDbg: h[p://www.ollydbg.de/ OllyDump: h[p://www.openrce.org/downloads/details/108/OllyDump IDA Pro Freeware: h[p://www.hex-rays.com/products/ida/support/download_freeware.shtml BinText: h[p://www.mcafee.com/us/downloads/free-tools/bintext.aspx
Environment
Specialized
Tools
PDFs:
Didier
Stevenss
pdd.py
&
pdf-parser.py
Flash:
SWFTtools
Others:
Java,
JavaScript
Environment
Baseline
Snapshot VM
Environment
Environment
Environment
Precongured
REMnux
The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the le again. If the red x still appears, you may have to delete the image and then insert it again.
v4
Load Malware on & Analyze Web-Based Malware (e.g., Malicious JavaScript, Java Programs, & Flash Files) Malicious Documents (e.g., Microsoj Oce & Adobe PDF les) UBliBes for Reversing Malware through Memory Forensics Emulate Network Services Used as Fake Server Emulate Services in Isolated Lab Environment Infects Another Laboratory System with Malware Sample Directs PotenBally-Malicious ConnecBons to REMnux that's Listening on Appropriate Ports
Dynamic Analysis
REMnux: h[p://zeltser.com/remnux/
Environment
Precongured
Environment
Precongured
SANS
InvesBgate
Forensic
Toolkit
(SIFT)
WorkstaBon
Development
Led
by
Rob
Lee
ISO
or
Virtual
Appliance
Useful
for
Both
StaBc
&
Dynamic
Analysis
More
Comprehensive
in
Terms
of
Tools
but
Focused
on
Forensics
Environment
Precongured
Environment
Precongured
CuckooBox
Automated
Dynamic
Analysis
of
Malware
Data
Captured
Trace
of
Performed
Relevant
Win32
API
Calls
Dump
of
Network
Trac
Generated
During
Analysis
CreaBon
of
Screenshots
Taken
During
Analysis
Dump
of
Files
Created,
Deleted
and
Downloaded
by
the
Malware
During
Analysis
Trace
of
Assembly
InstrucBons
Executed
by
Malware
Process
CuckooBox: h[p://cuckoobox.org/
Environment
Precongured
Methodology
1. Triage
2. Dynamic
Analysis
3. StaBc
Analysis
Methodology
1.
Triage
Run
through
External
Sandbox
Services
for
QnD
Results
If
Possible
Goals:
Establish
Rough
Idea
of
Malware
AcBviBes
Tools:
Norman
Sandbox,
GFI
Sandbox,
Anubis,
ThreatExpert,
Resources:
VirusTotal.com,
Goals:
When
Compiled,
Packed
or
Obfuscated)
Tools:
MAP,
FileAlyzer,
Google
Hash
UNIX le Command and/or TrID Open in 010 & Look for Magic Numbers: Win Exe (MZ), PDF (%PDF), ZIP (PK), (more at Wikipedia) Tools: OllyDump, PE Explorer (UPX built in) Goals: Discovery InteresBng Things Malware May Be ImporBng (networking APIs for non-networking app) Tools: FileAlyzer (PD Imports tab) Goals: Discover InteresBng Data Points like Host Name & IP Addressess Tools: MAP or BinText (e.g., for PDFs, Java, or Flash) MASTIFF (Linux): Automate much of the above plus more for EXEs & PDFs
Analyze Imports
Methodology
2.
Dynamic
Analysis
Take
RegShot
&
Start
WireShark,
Process
Monitor,
Process
Explorer,
FakeNet
&
TCPView
Monitors
File
and
Registry
Access,
Network
Trac,
Process
CreaBon,
etc.
Watching
WireShark,
Process
Monitor,
&
TCPView
for
Anything
InteresBng
Execute Malware & Let it Run for 15 Minutes or UnBl AcBvity Dies Down Take Second RegShot & Stop WireShark, Process Monitor, FakeNet Compare IniBal & Final RegShots & Review All Monitoring Tool Logs
Methodology
a.
c. b.
Methodology
d.
e.
f.
Methodology
g. Just Start
Methodology
h. Just Start
Methodology
i. Just Start
Methodology
2.
Dynamic
Analysis
(Execute
Malware)
Double-Click
EXE
Rundll32.exe
DLLName,
Export
arguments
PE
Explorer
to
Discover
Export
arguments
E.g.,
rundll32.exe
rip.dll,
Install
Watch All Monitoring Tools & Stop When AcBvity Dies Down
j. Just Monitor
Methodology
k. l.
Methodology
n.
Methodology
o.
Methodology
Methodology
3.
StaBc
Analysis
Use
OllyDbg
or
IDA
Pro
to
Disassemble
&
Analyze
Deobfuscated
Malware
Just
Stare
at
It
...
Stare
Some
More
...
And
Some
More
OpenSecurityTraining.info
Ma[ Briggs Reversing: Secrets of Reverse Engineering by E. Eilam The IDA Pro Book by C. Eagle Materials (videos, ) h[p://opensecuritytraining.info/ IntroducBonToReverseEngineering.html
In-Person Class
NoVA
Infosec
Workshop
Style
Conclusion
IntroducBon
Environment
Setup
Single
Box
-
VicBm
Dual+
Box
Fake
Server
Precongured
Methodology
Triage Dynamic Analysis StaBc Analysis OpenSecurityTraining.info Nova-Labs.org Binary Bash Zeltser.com, OpenRCE.org
Conclusion
QuesBons?