SlideShare a Scribd company logo
1 of 48
Download to read offline
ShellCon 2017 | What Can RE Do For You?
1
WHAT CAN
REVERSE
ENGINEERING
DO FOR YOU?
MALWARE UNICORN
ShellCon 2017 | What Can RE Do For You?
2
ABOUT ME
WHAT I DO
securedorg.github.io
Teach Malware RE
Look at malware
DEFCON
OPCDE
CFP Reviewer
Amanda Rousseau
Host Meetups
Follow Fashion Trends
meetup.com/Dead-Drop-SF
vanitysec.com
RSA, DEFCON
44Con, CanSecWest
Bsides SF, WiCys
DC3Con, MirCon
Speak at ConsSr.
Malware
Researcher
Endgame
Inc.
Occasionally Shitpost
@malwareunicorn
ShellCon 2017 | What Can RE Do For You?
3
Why
Reverse Engineering?
It is the foundation for both the blue and red teams
Vuln Research
Malware Analysis
Exploit Dev
Detection Sigs
Forensics
Pentesting Kits
Reverse Engineering
AV Engine Dev
ShellCon 2017 | What Can RE Do For You?
4
Watch out for
Rabbit Holes
It’s easy to get lost debugging
some random binary.
This talk will help you identify
specific patterns in assembly
routines commonly found in
malware.
ShellCon 2017 | What Can RE Do For You?
5
“YOU ONLY NEED A DISASSEMBLER,
DEBUGGER, AND A HEX EDITOR TO DO RE”
– ANONYMOUS DUDE
ShellCon 2017 | What Can RE Do For You?
6
The “RE” starter pack
ShellCon 2017 | What Can RE Do For You?
7
ALL TOOLS
SUPPORT
HxD Hex Editor
Python - used for automating tasks
INFORMATION GATHERING
CFF Explorer - PE header parser
PE Explorer - PE inspection
BinText - Extract strings
Sysinternals Suite
DISASSEMBLERS
Ida
Free
Pro (Most Popular)
Radare
Capstone
DEBUGGERS
x64dbg (My Favorite)
Immunity
OllyDbg (Most Popular)
WinDbg
GDB
ShellCon 2017 | What Can RE Do For You?
8
Approach
• Recognizing patterns comes with experience
• Break down algorithms into basic steps
• Information gathering is key, it helps define
how the binary and assembly is used for that
specific language
• Use Backward-Forward navigation and take
notes!
ShellCon 2017 | What Can RE Do For You?
9
BACKWARD-FORWARD
Start somewhere in the middle
and navigate backwards to the
entry point function.
Then go forwards to get back to
the middle while taking notes.
main()
Sub_1()
Sub_2()
Sub_4()Start
Sub_3()Next
Next
End
Sub_4()
Sub_2()
main()
Sub_1()
ShellCon 2017 | What Can RE Do For You?
10
BACKWARD-FORWARD
My Notes
ShellCon 2017 | What Can RE Do For You?
11
Common Assembly Patterns
Common techniques found in malware
PACKING EVASION CRYPTO SHELLCODE
ShellCon 2017 | What Can RE Do For You?
12
PACKING
1. Allocate a huge memory chunk
2. Load referenced section, resource, or
.data
3. Some routine that loops
4. Recreate the import table
5. Convert to R-W-X
6. Jump to start of newly copied bytes
Things to look for
ShellCon 2017 | What Can RE Do For You?
13
PACKING
HEADER
MAIN CODE
PACKED CODE
NEW MEMORY
RWX
RECREATE IMPORT TABLE
LOOP
1
2
5
4
3
6
JUMP
ShellCon 2017 | What Can RE Do For You?
14
PACKING
UPX
ShellCon 2017 | What Can RE Do For You?
15
PACKING
memory chuck == UPX0 section
ShellCon 2017 | What Can RE Do For You?
16
PACKING
Recreate the import table
ShellCon 2017 | What Can RE Do For You?
17
PACKING
Recreate the import table
ShellCon 2017 | What Can RE Do For You?
18
PACKING
Import table in the debugger
ShellCon 2017 | What Can RE Do For You?
19
PACKING
Convert to R-W-X with VirtualProtect
Some routine that loops
Jump to start of newly copied bytes
ShellCon 2017 | What Can RE Do For You?
20
PACKING
• Look for references to sections, resources, or .data
• Look for the jump call
Debugging
• Save the address to the new memory section. Set
an execution breakpoint on that memory location.
Static Analysis
How to get around it
ShellCon 2017 | What Can RE Do For You?
21
EVASION
• Lots of jumps where one jump
terminates the program
• Environment checking
• Useless routines
Things to look for
ShellCon 2017 | What Can RE Do For You?
22
EVASION
Sub_0()
Sub_1()
Sub_4()
Sub_3()
Exit()
Some Check
JZ Exit()
JZ Exit()
JZ Exit()
Some Check
Some Check
ShellCon 2017 | What Can RE Do For You?
23
EVASION
ShellCon 2017 | What Can RE Do For You?
24
EVASION
• VM Evasion – Checking the environment for VM artifacts
• Anti-analysis – useless jumps & functions
• Anti-AV Detection – Heavy obfuscation, environment checks
• Anti Automation – requires UI activity
Types of Evasion
ShellCon 2017 | What Can RE Do For You?
25
EVASION
VM Evasion
• Accessing registry keys for hardware & Bios
• Checking driver names for VM drivers
• Any check in Paranoid Fish
(https://github.com/a0rtega/pafish)
Things to look for
ShellCon 2017 | What Can RE Do For You?
26
EVASION
VM Evasion
• Accessing registry keys
for hardware, Bios,
and/or Physical Drive
ShellCon 2017 | What Can RE Do For You?
27
EVASION
VM Evasion
• Accessing registry keys
for hardware, Bios,
and/or Physical Drive
ShellCon 2017 | What Can RE Do For You?
28
EVASION
• useless jumps & functions
• Debugger checks
• Time bombs
• Tick timer checks
Things to look for
Anti-Analysis
ShellCon 2017 | What Can RE Do For You?
29
EVASION
• useless jumps & functions
• Debugger checks
• Time bombs
• Tick timer checks
Things to look for
Anti-Analysis
ShellCon 2017 | What Can RE Do For You?
30
EVASION
Anti-AV Detection
• Accessing registry keys for AV names
• Checking program files, DLLs, Driver names
• Stack based strings and IOCs
Things to look for
ShellCon 2017 | What Can RE Do For You?
31
EVASION
Anti-AV Detection
Stack based strings and IOCs
ShellCon 2017 | What Can RE Do For You?
32
EVASION
Anti Automation
• Checking for User Interaction
• Mouse movement
• Foreground window state change
• Long sleep/wait calls
• Internet connection tests
Things to look for
ShellCon 2017 | What Can RE Do For You?
33
• Checking for User Interaction
• Foreground window state
change
EVASION
Anti Automation
ShellCon 2017 | What Can RE Do For You?
34
EVASION
• Patch the CMP and JNZ jump calls so that it
always passes the check
Debugging
• Modify the Zero flag to bypass the check
Static Analysis
How to get around it
ShellCon 2017 | What Can RE Do For You?
35
EVASION
• Patch the CMP and JNZ jump calls so that it
always passes the check
Debugging
• Modify the Zero flag to bypass the check
Static Analysis
How to get around it
ShellCon 2017 | What Can RE Do For You?
36
CRYPTO
Call a function right after
STEP 2
Loop a lot
STEP 3
Load a reference in .DATA
STEP 1
XOR something
STEP 4
ShellCon 2017 | What Can RE Do For You?
37
CRYPTO
Call a function right after
STEP 2
Load a reference in .DATA
STEP 1
ShellCon 2017 | What Can RE Do For You?
38
CRYPTO
Loop a lot
STEP 3
ShellCon 2017 | What Can RE Do For You?
39
CRYPTO
xor A, B
xor A, A
xor [esi], al
xor eax, eax
XOR the lower byte of register eax
with the value at esi
Clear the register eax
XOR something
STEP 4
ShellCon 2017 | What Can RE Do For You?
40
CRYPTO
• Look for frequent usages of the function after data
loads
• Identify the crypto algorithm and create a simple
decryption script
Debugging
• Place a breakpoint before the return or after the
function to see the decrypted string
• Place a write hardware breakpoint in the newly
allocated memory region
Static Analysis
How to get around it
ShellCon 2017 | What Can RE Do For You?
41
SHELLCODE
• Heap or VirtualAlloc with R-W-X
permissions
• Copy a large chunk of bytes to
newly created memory
• Jump to an offset in that new
memory
• Or spawn a new thread
Things to look for
ShellCon 2017 | What Can RE Do For You?
42
SHELLCODE
• Similar to unpacking
• Shellcode is process independent code
• May or may not need an import table creation
Things to note
ShellCon 2017 | What Can RE Do For You?
43
SHELLCODE
HEADER
MAIN CODE
SHELLCODE
NEW MEMORY
RWX
LOOP
1
2
4
3
5
JUMP
ShellCon 2017 | What Can RE Do For You?
44
SHELLCODE
• value Offset+0x42B7 is being
saved in register esi and then
pushed onto the stack before
the function returns.
• Typically functions will pop the
ebp on the stack to restore
the previous stack frame of
the calling function.
Things to note
ShellCon 2017 | What Can RE Do For You?
45
SHELLCODE
• Look for references to sections, resources, or .data
• Look for the jump or push & ret call
Debugging
• Save the address to the new memory section. Set
an execution breakpoint on that memory location.
• Extract the shellcode from memory and convert it
into an exe
Static Analysis
How to get around it
ShellCon 2017 | What Can RE Do For You?
46
SHELLCODE
Converting Shellcode to an EXE
1. Download Yasm yasm-1.3.0-win32.exe
2. Extract yasm-1.3.0-win32.exe and rename it to yasm.exe
3. Download GoLink linker Golink.zip
4. Extract golink.exe
5. Create a shellcode.asm file with the following instructions
6. From a command line run the following command to assemble the code:
• yasm.exe -f win32 -o shellcode.obj shellcode.asm
7. Now run the linker
• golink /ni /entry Start shellcode.obj
8. Change the AddressOfEntryPoint. Add the current value to 0x42B7 which was the offset of where the
malware was going to return to in function sub_45B794. AddressOfEntryPoint should be 000052B7.
This will ensure that IDA knows where to start the disassembly.
Global Start
SECTION 'AyyLmao' write, execute,read
Start: incbin "shellcode.bin"
ShellCon 2017 | What Can RE Do For You?
47
Things to REmember
• Take notes
• PATCH, PATCH, PATCH - every evasion can be bypassed
• Memory & Hardware breakpoints are your friends
• Loops are annoying but good for identification
• Repeated functions are fishy indicators
ShellCon 2017 | What Can RE Do For You?
48
Thanks for coming!
Questions?
Twitter: @malwareunicorn

More Related Content

What's hot

Trusted Third Parties are NOT Trust Worthy!
Trusted Third Parties are NOT Trust Worthy!Trusted Third Parties are NOT Trust Worthy!
Trusted Third Parties are NOT Trust Worthy!nettitude_labs
 
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense TechniqueDARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense TechniqueChong-Kuan Chen
 
Статический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDLСтатический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDLPositive Hack Days
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...Shane McIntosh
 
The Impact of Code Review Coverage and Participation on Software Quality
The Impact of Code Review Coverage and Participation on Software QualityThe Impact of Code Review Coverage and Participation on Software Quality
The Impact of Code Review Coverage and Participation on Software QualityShane McIntosh
 
Open Canary - novahackers
Open Canary - novahackersOpen Canary - novahackers
Open Canary - novahackersChris Gates
 
Isolating GPU Access in its Own Process
Isolating GPU Access in its Own ProcessIsolating GPU Access in its Own Process
Isolating GPU Access in its Own ProcessPatricia Aas
 
Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)Rémi Jullian
 
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat DasNull Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat Dasnullowaspmumbai
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programmingkozossakai
 
FRIDA 101 Android
FRIDA 101 AndroidFRIDA 101 Android
FRIDA 101 AndroidTony Thomas
 
Ida python intro
Ida python introIda python intro
Ida python intro小静 安
 
Justin collins - Practical Static Analysis for continuous application delivery
Justin collins - Practical Static Analysis for continuous application deliveryJustin collins - Practical Static Analysis for continuous application delivery
Justin collins - Practical Static Analysis for continuous application deliveryDevSecCon
 
Mining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are NecessaryMining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are NecessaryShane McIntosh
 
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...CODE BLUE
 
Pentesting Android Apps using Frida (Beginners)
Pentesting Android Apps using Frida (Beginners)Pentesting Android Apps using Frida (Beginners)
Pentesting Android Apps using Frida (Beginners)Chandrapal Badshah
 
DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...
DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...
DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...DevSecCon
 
DBI-Assisted Android Application Reverse Engineering
DBI-Assisted Android Application Reverse EngineeringDBI-Assisted Android Application Reverse Engineering
DBI-Assisted Android Application Reverse EngineeringSahil Dhar
 
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)GangSeok Lee
 

What's hot (20)

Trusted Third Parties are NOT Trust Worthy!
Trusted Third Parties are NOT Trust Worthy!Trusted Third Parties are NOT Trust Worthy!
Trusted Third Parties are NOT Trust Worthy!
 
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense TechniqueDARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
 
Статический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDLСтатический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDL
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
Tracing Software Build Processes to Uncover License Compliance Inconsistencie...
 
The Impact of Code Review Coverage and Participation on Software Quality
The Impact of Code Review Coverage and Participation on Software QualityThe Impact of Code Review Coverage and Participation on Software Quality
The Impact of Code Review Coverage and Participation on Software Quality
 
Open Canary - novahackers
Open Canary - novahackersOpen Canary - novahackers
Open Canary - novahackers
 
Isolating GPU Access in its Own Process
Isolating GPU Access in its Own ProcessIsolating GPU Access in its Own Process
Isolating GPU Access in its Own Process
 
Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)
 
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat DasNull Mumbai Meet_Android Reverse Engineering by Samrat Das
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
 
FRIDA 101 Android
FRIDA 101 AndroidFRIDA 101 Android
FRIDA 101 Android
 
Ida python intro
Ida python introIda python intro
Ida python intro
 
Justin collins - Practical Static Analysis for continuous application delivery
Justin collins - Practical Static Analysis for continuous application deliveryJustin collins - Practical Static Analysis for continuous application delivery
Justin collins - Practical Static Analysis for continuous application delivery
 
Introduction to Frida
Introduction to FridaIntroduction to Frida
Introduction to Frida
 
Mining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are NecessaryMining Co-Change Information to Understand when Build Changes are Necessary
Mining Co-Change Information to Understand when Build Changes are Necessary
 
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
For the Greater Good: Leveraging VMware's RPC Interface for fun and profit by...
 
Pentesting Android Apps using Frida (Beginners)
Pentesting Android Apps using Frida (Beginners)Pentesting Android Apps using Frida (Beginners)
Pentesting Android Apps using Frida (Beginners)
 
DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...
DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...
DevSecCon London 2019: A Kernel of Truth: Intrusion Detection and Attestation...
 
DBI-Assisted Android Application Reverse Engineering
DBI-Assisted Android Application Reverse EngineeringDBI-Assisted Android Application Reverse Engineering
DBI-Assisted Android Application Reverse Engineering
 
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
 

Similar to What Can Reverse Engineering Do For You?

Adding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17xAdding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17xMandi Walls
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017Mandi Walls
 
Winning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test CycleWinning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test CycleRusty Klophaus
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?AFUP_Limoges
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDays Riga
 
One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...
One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...
One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...Priyanka Aash
 
Ephemeral DevOps: Adventures in Managing Short-Lived Systems
Ephemeral DevOps: Adventures in Managing Short-Lived SystemsEphemeral DevOps: Adventures in Managing Short-Lived Systems
Ephemeral DevOps: Adventures in Managing Short-Lived SystemsPriyanka Aash
 
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersDefcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersAlexandre Moneger
 
You're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareYou're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareCylance
 
InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017Mandi Walls
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018Giulio Vian
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Sysdig
 
Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...Lucas Leong
 
08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen oneAlexandre Moneger
 
Building a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntBuilding a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntAshley Roach
 
Reuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldReuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldDmitri Zimine
 
Python testing like a pro by Keith Yang
Python testing like a pro by Keith YangPython testing like a pro by Keith Yang
Python testing like a pro by Keith YangPYCON MY PLT
 

Similar to What Can Reverse Engineering Do For You? (20)

Adding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17xAdding Security to Your Workflow With InSpec - SCaLE17x
Adding Security to Your Workflow With InSpec - SCaLE17x
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017
 
Winning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test CycleWinning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test Cycle
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
 
One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...
One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...
One bite and all your dreams will come true: Analyzing and Attacking Apple Ke...
 
Ephemeral DevOps: Adventures in Managing Short-Lived Systems
Ephemeral DevOps: Adventures in Managing Short-Lived SystemsEphemeral DevOps: Adventures in Managing Short-Lived Systems
Ephemeral DevOps: Adventures in Managing Short-Lived Systems
 
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbersDefcon 22 - Stitching numbers - generating rop payloads from in memory numbers
Defcon 22 - Stitching numbers - generating rop payloads from in memory numbers
 
You're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareYou're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security Software
 
InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Ruby Under The Hood
Ruby Under The HoodRuby Under The Hood
Ruby Under The Hood
 
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
 
Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...
 
08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one
 
Building a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger HuntBuilding a REST API Microservice for the DevNet API Scavenger Hunt
Building a REST API Microservice for the DevNet API Scavenger Hunt
 
Reuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldReuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless World
 
Python testing like a pro by Keith Yang
Python testing like a pro by Keith YangPython testing like a pro by Keith Yang
Python testing like a pro by Keith Yang
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

What Can Reverse Engineering Do For You?

  • 1. ShellCon 2017 | What Can RE Do For You? 1 WHAT CAN REVERSE ENGINEERING DO FOR YOU? MALWARE UNICORN
  • 2. ShellCon 2017 | What Can RE Do For You? 2 ABOUT ME WHAT I DO securedorg.github.io Teach Malware RE Look at malware DEFCON OPCDE CFP Reviewer Amanda Rousseau Host Meetups Follow Fashion Trends meetup.com/Dead-Drop-SF vanitysec.com RSA, DEFCON 44Con, CanSecWest Bsides SF, WiCys DC3Con, MirCon Speak at ConsSr. Malware Researcher Endgame Inc. Occasionally Shitpost @malwareunicorn
  • 3. ShellCon 2017 | What Can RE Do For You? 3 Why Reverse Engineering? It is the foundation for both the blue and red teams Vuln Research Malware Analysis Exploit Dev Detection Sigs Forensics Pentesting Kits Reverse Engineering AV Engine Dev
  • 4. ShellCon 2017 | What Can RE Do For You? 4 Watch out for Rabbit Holes It’s easy to get lost debugging some random binary. This talk will help you identify specific patterns in assembly routines commonly found in malware.
  • 5. ShellCon 2017 | What Can RE Do For You? 5 “YOU ONLY NEED A DISASSEMBLER, DEBUGGER, AND A HEX EDITOR TO DO RE” – ANONYMOUS DUDE
  • 6. ShellCon 2017 | What Can RE Do For You? 6 The “RE” starter pack
  • 7. ShellCon 2017 | What Can RE Do For You? 7 ALL TOOLS SUPPORT HxD Hex Editor Python - used for automating tasks INFORMATION GATHERING CFF Explorer - PE header parser PE Explorer - PE inspection BinText - Extract strings Sysinternals Suite DISASSEMBLERS Ida Free Pro (Most Popular) Radare Capstone DEBUGGERS x64dbg (My Favorite) Immunity OllyDbg (Most Popular) WinDbg GDB
  • 8. ShellCon 2017 | What Can RE Do For You? 8 Approach • Recognizing patterns comes with experience • Break down algorithms into basic steps • Information gathering is key, it helps define how the binary and assembly is used for that specific language • Use Backward-Forward navigation and take notes!
  • 9. ShellCon 2017 | What Can RE Do For You? 9 BACKWARD-FORWARD Start somewhere in the middle and navigate backwards to the entry point function. Then go forwards to get back to the middle while taking notes. main() Sub_1() Sub_2() Sub_4()Start Sub_3()Next Next End Sub_4() Sub_2() main() Sub_1()
  • 10. ShellCon 2017 | What Can RE Do For You? 10 BACKWARD-FORWARD My Notes
  • 11. ShellCon 2017 | What Can RE Do For You? 11 Common Assembly Patterns Common techniques found in malware PACKING EVASION CRYPTO SHELLCODE
  • 12. ShellCon 2017 | What Can RE Do For You? 12 PACKING 1. Allocate a huge memory chunk 2. Load referenced section, resource, or .data 3. Some routine that loops 4. Recreate the import table 5. Convert to R-W-X 6. Jump to start of newly copied bytes Things to look for
  • 13. ShellCon 2017 | What Can RE Do For You? 13 PACKING HEADER MAIN CODE PACKED CODE NEW MEMORY RWX RECREATE IMPORT TABLE LOOP 1 2 5 4 3 6 JUMP
  • 14. ShellCon 2017 | What Can RE Do For You? 14 PACKING UPX
  • 15. ShellCon 2017 | What Can RE Do For You? 15 PACKING memory chuck == UPX0 section
  • 16. ShellCon 2017 | What Can RE Do For You? 16 PACKING Recreate the import table
  • 17. ShellCon 2017 | What Can RE Do For You? 17 PACKING Recreate the import table
  • 18. ShellCon 2017 | What Can RE Do For You? 18 PACKING Import table in the debugger
  • 19. ShellCon 2017 | What Can RE Do For You? 19 PACKING Convert to R-W-X with VirtualProtect Some routine that loops Jump to start of newly copied bytes
  • 20. ShellCon 2017 | What Can RE Do For You? 20 PACKING • Look for references to sections, resources, or .data • Look for the jump call Debugging • Save the address to the new memory section. Set an execution breakpoint on that memory location. Static Analysis How to get around it
  • 21. ShellCon 2017 | What Can RE Do For You? 21 EVASION • Lots of jumps where one jump terminates the program • Environment checking • Useless routines Things to look for
  • 22. ShellCon 2017 | What Can RE Do For You? 22 EVASION Sub_0() Sub_1() Sub_4() Sub_3() Exit() Some Check JZ Exit() JZ Exit() JZ Exit() Some Check Some Check
  • 23. ShellCon 2017 | What Can RE Do For You? 23 EVASION
  • 24. ShellCon 2017 | What Can RE Do For You? 24 EVASION • VM Evasion – Checking the environment for VM artifacts • Anti-analysis – useless jumps & functions • Anti-AV Detection – Heavy obfuscation, environment checks • Anti Automation – requires UI activity Types of Evasion
  • 25. ShellCon 2017 | What Can RE Do For You? 25 EVASION VM Evasion • Accessing registry keys for hardware & Bios • Checking driver names for VM drivers • Any check in Paranoid Fish (https://github.com/a0rtega/pafish) Things to look for
  • 26. ShellCon 2017 | What Can RE Do For You? 26 EVASION VM Evasion • Accessing registry keys for hardware, Bios, and/or Physical Drive
  • 27. ShellCon 2017 | What Can RE Do For You? 27 EVASION VM Evasion • Accessing registry keys for hardware, Bios, and/or Physical Drive
  • 28. ShellCon 2017 | What Can RE Do For You? 28 EVASION • useless jumps & functions • Debugger checks • Time bombs • Tick timer checks Things to look for Anti-Analysis
  • 29. ShellCon 2017 | What Can RE Do For You? 29 EVASION • useless jumps & functions • Debugger checks • Time bombs • Tick timer checks Things to look for Anti-Analysis
  • 30. ShellCon 2017 | What Can RE Do For You? 30 EVASION Anti-AV Detection • Accessing registry keys for AV names • Checking program files, DLLs, Driver names • Stack based strings and IOCs Things to look for
  • 31. ShellCon 2017 | What Can RE Do For You? 31 EVASION Anti-AV Detection Stack based strings and IOCs
  • 32. ShellCon 2017 | What Can RE Do For You? 32 EVASION Anti Automation • Checking for User Interaction • Mouse movement • Foreground window state change • Long sleep/wait calls • Internet connection tests Things to look for
  • 33. ShellCon 2017 | What Can RE Do For You? 33 • Checking for User Interaction • Foreground window state change EVASION Anti Automation
  • 34. ShellCon 2017 | What Can RE Do For You? 34 EVASION • Patch the CMP and JNZ jump calls so that it always passes the check Debugging • Modify the Zero flag to bypass the check Static Analysis How to get around it
  • 35. ShellCon 2017 | What Can RE Do For You? 35 EVASION • Patch the CMP and JNZ jump calls so that it always passes the check Debugging • Modify the Zero flag to bypass the check Static Analysis How to get around it
  • 36. ShellCon 2017 | What Can RE Do For You? 36 CRYPTO Call a function right after STEP 2 Loop a lot STEP 3 Load a reference in .DATA STEP 1 XOR something STEP 4
  • 37. ShellCon 2017 | What Can RE Do For You? 37 CRYPTO Call a function right after STEP 2 Load a reference in .DATA STEP 1
  • 38. ShellCon 2017 | What Can RE Do For You? 38 CRYPTO Loop a lot STEP 3
  • 39. ShellCon 2017 | What Can RE Do For You? 39 CRYPTO xor A, B xor A, A xor [esi], al xor eax, eax XOR the lower byte of register eax with the value at esi Clear the register eax XOR something STEP 4
  • 40. ShellCon 2017 | What Can RE Do For You? 40 CRYPTO • Look for frequent usages of the function after data loads • Identify the crypto algorithm and create a simple decryption script Debugging • Place a breakpoint before the return or after the function to see the decrypted string • Place a write hardware breakpoint in the newly allocated memory region Static Analysis How to get around it
  • 41. ShellCon 2017 | What Can RE Do For You? 41 SHELLCODE • Heap or VirtualAlloc with R-W-X permissions • Copy a large chunk of bytes to newly created memory • Jump to an offset in that new memory • Or spawn a new thread Things to look for
  • 42. ShellCon 2017 | What Can RE Do For You? 42 SHELLCODE • Similar to unpacking • Shellcode is process independent code • May or may not need an import table creation Things to note
  • 43. ShellCon 2017 | What Can RE Do For You? 43 SHELLCODE HEADER MAIN CODE SHELLCODE NEW MEMORY RWX LOOP 1 2 4 3 5 JUMP
  • 44. ShellCon 2017 | What Can RE Do For You? 44 SHELLCODE • value Offset+0x42B7 is being saved in register esi and then pushed onto the stack before the function returns. • Typically functions will pop the ebp on the stack to restore the previous stack frame of the calling function. Things to note
  • 45. ShellCon 2017 | What Can RE Do For You? 45 SHELLCODE • Look for references to sections, resources, or .data • Look for the jump or push & ret call Debugging • Save the address to the new memory section. Set an execution breakpoint on that memory location. • Extract the shellcode from memory and convert it into an exe Static Analysis How to get around it
  • 46. ShellCon 2017 | What Can RE Do For You? 46 SHELLCODE Converting Shellcode to an EXE 1. Download Yasm yasm-1.3.0-win32.exe 2. Extract yasm-1.3.0-win32.exe and rename it to yasm.exe 3. Download GoLink linker Golink.zip 4. Extract golink.exe 5. Create a shellcode.asm file with the following instructions 6. From a command line run the following command to assemble the code: • yasm.exe -f win32 -o shellcode.obj shellcode.asm 7. Now run the linker • golink /ni /entry Start shellcode.obj 8. Change the AddressOfEntryPoint. Add the current value to 0x42B7 which was the offset of where the malware was going to return to in function sub_45B794. AddressOfEntryPoint should be 000052B7. This will ensure that IDA knows where to start the disassembly. Global Start SECTION 'AyyLmao' write, execute,read Start: incbin "shellcode.bin"
  • 47. ShellCon 2017 | What Can RE Do For You? 47 Things to REmember • Take notes • PATCH, PATCH, PATCH - every evasion can be bypassed • Memory & Hardware breakpoints are your friends • Loops are annoying but good for identification • Repeated functions are fishy indicators
  • 48. ShellCon 2017 | What Can RE Do For You? 48 Thanks for coming! Questions? Twitter: @malwareunicorn