Reverse Engineering Malware For Newbies: A Guide For Those of You Who Want To Break Into The Fun World of Malware
Reverse Engineering Malware For Newbies: A Guide For Those of You Who Want To Break Into The Fun World of Malware
Reverse Engineering Malware For Newbies: A Guide For Those of You Who Want To Break Into The Fun World of Malware
It will be in the folder named ‘samples’ on the drives I handed out. Open it up in your
debugger / VM and we’ll go over it together.
Reporting
There is no “typical” reporting structure when it comes to classifying /
documenting malware, however I like to keep my reports with the most
essential fields such as the MD5, API’s, C&C IP’s, and IOC’s
Its good to keep reports descriptive, but do not go overboard.
Example of one of my reports: http://gironsec.com/typical_report.txt
Unpacking 101
• Most malware today is packed in some way to help get
around AV signature detection
• There are over 8000 known packers out there, each
with their own signatures.
• They can range from simple compression to full on
encryption / debugger detection and generally make
the life of the Malware Reverser a pain.
• Packers are not fool proof – the exe HAS to be
decrypted / decompressed at SOME point in order to
run on the OS.
Unpacking p2
Before we start to unpack, let's go over how we identify
a program is packed to begin with.
• If in IDA we see a bunch of nothing such as hardly any
imports, lots of BS in the data section.
• We see odd named section headers. One can use 7zip
sometimes to view section headers of executables, but
generally you can do this with CFF explorer or IDA.
• HookAnalyser comes with a decent packer database
with something like 4400 different packer signatures.
• Hands down the best packer identifier in my opinion is
exeinfo. it beats HookAnalyser's db with a grand total of
7075 packer signatures. Not only will it tell you who
packed an exe, it will provide a link for how to unpack it.
Thanks guys!
• Once we know what kind of packer is used (if any) we
can begin our unpacking. Be forewarned through, some
packers are hard to get around. Really hard. At some
point it becomes not worth it in which case we might
want to skip the entire reversing process from a
debugger level and instead opt for the live analysis tools
to save time and a major migrane. Don't feel bad if you
can't get around a packer, it happens to me from time
to time.
Unpacking p3
Pic on the left demonstrates
HookAnalyzer running an
analysis on a UPX packed
binary. It’s not a perfect
tool, if you’ll notice the false
positive of supposed NOP
instructions. The nice thing
about HookAnalyser is it will
extract IP addresses for you
automatically – very useful
for malware analysis.
Unpacking p4
When it comes to identifying
packers, there is no tool
better than exeinfo, second
only to experience.
It has a packer database with
which it searches through,
can scan for media files, IP
addresses, hostnames, and
all that other good stuff.
And its free which makes it
#1.
Unpacking demonstration
Fire up your debuggers. We’ll be going over the ‘Local-Appwizard.exe’ file in the
‘Samples’ folder.
Dynamic Analysis
• For when you either a) don’t care about the
inner workings and only want basic info from
the malware or b) malware packed /encrypted
tight and you cant get around it.
• This is where proper usage of procmon /
wireshark / cuckoo are a godsend. Even if a
program’s assembly code isn’t available, we
can still see what its doing and probe it
blackbox style.
Memory Analysis
• HookAnalyzer and Volatility are excellent
memory analysis tools. HookAnalyzer will do it
live, but Volatility requires a memory dump
and has to be done post execution.
• Process Hacker allows you to dump a running
process’s memory for inspection and allows for
filtering and searching. The same can be done
via your debugger, but this isn’t always
feasible.
Hook Analyser
This tool supports live memory analysis of running processes This makes it indispensable.
Process Hacker
Another must have useful tool. Capable of live memory searching and dumping, it
provides things taskmanager should but doesn’t including disk IO monitoring and
networking activity monitoring capabilities.
Volatility In Action
• <video of me using volatility or I’ll do it live>
Where Do I Get Malware?
• http://www.offensivecomputing.net/
• IRC
• Reddit / 4chan / Tumblr
• me ([email protected]),
• Twitter #malwaremustdie
• AV companies
• http://syrianmalware.net
• Torrents / cracked software / gnutella network.
• Spam email
Help! I’m stuck
If you ever get stuck on a
sample, fear not. There are
communities out there that
deal with malware forensics.
Reddit, Exeforums, woodman,
kernelmode.info, mailing lists,
and even twitter are excellent
sources full of people who will
help. Even IRC still works.
Additional Resources
• https://code.google.com/p/corkami/
• ^^ An excellent resource for info on reversing
• http://www.woodmann.com/collaborative/tools/ind
ex.php/Category:RCE_Tools
• ^^ huge resource for reverse engineering tools
• http://reddit.com/r/ReverseEngineering/
• ^^ Still better than /r/malware. Avoid /r/malware
• http://gironsec.com/blog/
• ^^ shameless self promotion? No, I got plenty of
good guides!
Questions?
Contact Info
Name: Joe Giron
Email: [email protected]
Phone: 512-902-3787