ch0 1
ch0 1
• Link Ch 2i
Packed and Obfuscated Malware
Packing Files
• The code is compressed, like Zip file
• This makes the strings and instructions unreadable
• All you'll see is the wrapper – small code that
unpacks the file when it is run
Detecting Packers with PEiD
UPX
Packing Obfuscates Strings
Portable Executable File Format
PE Files
• Used by Windows executable files, object
code, and DLLs
• A data structure that contains the information
necessary for Windows to load the file
• Almost every file executed on Windows is in PE
format
PE Header
• Information about the code
• Type of application
• Required library functions
• Space requirements
LordPE Demo
Main Sections
There are a
lot more
sections
• But the
main ones
are enough
for now
• Link Ch 2c
CNIT 126 Ch 1b
Linked Libraries and Functions
Imports
• Functions used by a program that are stored in
a different program, such as library
• Connected to the main EXE by Linking
• Can be linked three ways
– Statically
– At Runtime
– Dynamically
Static Linking
• Rarely used for Windows executables
• Common in Unix and Linux
• All code from the library is copied into the
executable
• Makes executable large in size
Runtime Linking
• Unpopular in friendly programs
• Common in malware, especially packed or
obfuscated malware
• Connect to libraries only when needed, not
when the program starts
• Most commonly done with the LoadLibrary
and GetProcAddress functions
Dynamic Linking
• Most common method
• Host OS searches for necessary libraries when
the program is loaded
Clues in Libraries
• The PE header lists every library and function
that will be loaded
• Their names can reveal what the program does
• URLDownloadToFile indicates that the
program downloads something
Dependency Walker
Shows Dynamically Linked Functions