SlideShare a Scribd company logo
André Baptista
@0xACB
Reverse Engineering
• Uncovering the hidden behaviour of a given
technology, system, program, protocol or device,
by analysing the structure and operation of its
components
• Extracting knowledge about any unknown
engineering invention
Reverse Engineering
“Is biology reverse engineering?”
History
Reverse Engineering

History
• Reversing was used to copy inventions from other
countries or business competitors
• Frequently used in the WW2 and Cold war:
• Jerry can
• Panzerschreck
• Tupolev Tu-4 / B-29
Binary Reverse Engineering
Motivation
• Software and hardware cracking
• Malware analysis - botnets, spyware, ransomware
• Finding bugs and developing 0day exploits
• Creating or improving docs
• Interpreting unknown protocols
• Academic purposes
• Industrial or military espionage
• Software interoperability
Who knows how to do this stuff?
• Hackers in general
• Intelligence agencies / cybercrime divisions
• Antivirus companies
• Students and curious people
Binary Reverse Engineering
• It’s the process of getting knowledge about
compiled software, in order to understand how it
works and how it was originally implemented.
Binary Reverse Engineering
• It’s the process of getting knowledge about
compiled software, in order to understand how it
works and how it was originally implemented.
Without the source code???
• It’s the process of getting knowledge about
compiled software, in order to understand how it
works and how it was originally implemented.
WTF?
WTF?WTF?
Without the source code???Binary Reverse Engineering
WTF?
WTF?
WTF?
WTF? WTF?
WTF?
WTF?
WTF?
WTF?
WTF?
WTF?
WTF?
WTF?
WTF?
Binary Reverse Engineering
Formats of compiled software
• ELF (Linux & UNIX like)
• Mach-O (OSX)
• PE (Windows)
• Class (Java bytecode)
• DEX (Android - Dalvik bytecode)
• PYC (Python bytecode)
• …
• Debugging (GDB, Valgrind, WinDbg)
• Assembly (x86, x64, ARM, MIPS and many others)
• Programming (C, C++, Java, etc)
• Software architecture
• Logic, math, crypto, protocols, networks
• Don’t giving up
Required skills
Awesome tools
• Disassemblers
• Debuggers
• Decompilers
• Patchers
Disassemblers
These programs translate machine code to assembly.
Debuggers
These programs are used to test
other programs.
Debuggers allow us to inspect
memory and CPU registers, modify
of variables in runtime, set
breakpoints and call functions
outside the program flow.
In reverse engineering we usually
use them for dynamic analysis.
Decompilers
These programs try to achieve the
near-impossible task of translating
compiled software to the original
source code.
Sometimes, the generated code is
more than enough to perform
reversing tasks

Patchers
A patcher is very useful for changing binary code in order to modify the
software behaviour. Hex editors can be used as patchers, but there are
better tools in the wild, that allow us to patch assembly instructions.
Badass tools
• Disassemblers, debuggers and patchers
• IDA Pro - https://www.hex-rays.com/products/ida
• Hopper Disassembler - http://www.hopperapp.com
• binary.ninja - https://binary.ninja
• Radare 2 - http://rada.re
• ODA - http://www.onlinedisassembler.com
• OllyDbg - http://www.ollydbg.de
• ILSpy - http://ilspy.net
• Linux tools: objdump, ltrace, strace, readelf, gdb
• Apktool - https://ibotpeaches.github.io/Apktool
Badass tools
• Decompilers
• IDA Pro - https://www.hex-rays.com/products/ida (x86, x64, ARM, MIPS,
Gameboy, etc)
• Hopper Disassembler - http://www.hopperapp.com (x86, x64, ARM)
• Retargetable Decompiler (AVG) - https://retdec.com (x86, ARM, MIPS, Power PC)
• JADX - https://github.com/skylot/jadx (DEX)
• Online android decompilers: http://www.javadecompilers.com/apk | http://
www.decompileandroid.com
• JetBrains dotPeek - https://www.jetbrains.com/decompiler (.NET)
• ILSpy - http://ilspy.net (.NET)
• uncompyle2 - https://github.com/Mysterie/uncompyle2 (Python bytecode)
Static Analysis
• Do not execute the program
• Read the spooky assembly/decompiled code
• Inspect flow charts
• Take lots of notes
• Translate procedures to the programming language of
your choice
• It’s a pain in the ass to reverse obfuscated of very
complex programs
Dynamic Analysis
• Execute the program
• Inspect the program behaviour
• Use a debugger to understand the values of the
CPU registers, memory (stack, heap) and the
guessed arguments for functions calls in a
specific state of execution
• It’s difficult to achieve if any anti-debugging
protections exist (Some even crash IDA PRO)
Binary RE
https://github.com/RPISEC/MBE
Binary RE
https://github.com/RPISEC/MBE
Demo 1 - Dynamic analysis
https://goo.gl/XXoPCV
Cracking
• This demo was a very simple cracking scenario
• The real stuff involves a much more complex task
(static analysis, dynamic analysis, concolic
analysis)
• E.g. If you want to create a keygen you need to
understand the serial number validation algorithm
• You need to be a patching ninja to remove anti-
cracking protections (usually triggered in runtime)
Cracking
• In the good old times: to crack a game you just
needed to patch code to bypass PC-CDROM ID or
Integrity checks
• Reverse engineering is one of the main categories in
Security CTFs
• In CTFs, the contestants are typically challenged to
solve cracking problems
• The simplest case is just like the last demo. Find the
correct input
Cracking
Advanced techniques
🤔
Cracking
Advanced techniques
• Timing attacks
• When a char is correct: one more cycle is executed, i.e.
more instructions
• It’s possible to launch a timing attack, char by char
• The attack complexity is reduced from to
• How can we prevent this kind of attacks?
• Tools for local binary timing attacks: Pin tool, GDB scripts
Cracking
Advanced techniques
• Solvers
• Serial number validation algorithms are usually composed
by complex verifications, whose components are the
values of certain indexes of the serial number. 



E.g.
• These verifications can be translated to systems of
equations, that can be easily solved by powerful tools like
Z3 Theorem Prover, Sage, Maple, Matlab
• Z3 supports both arithmetic and bitwise operators, and
custom functions as well.
Cracking
Advanced techniques - Z3
Python script Solutions
What about the future?
Predicting the future using Naive Mayes
Let’s get to the powerful stuff
DARPA CGC
• A very important mark in the history of infosec
• It was the first-ever all-machine hacking
tournament
• These machines were able to automatically find
and patch vulnerabilities in binaries
• The Mechanical Phish project, from the Shellphish
team, was able to identify vulnerabilities using both
fuzzing and symbolic execution techniques.
DARPA CGC
Mechanical Phish - Driller
DARPA CGC
Mechanical Phish - ANGR
• ANGR is a very powerful binary analysis framework. It was
implemented mostly by the Shellphish team and is one of the main
components of Driller
• It’s one of the most recent open source technologies to perform
reversing/cracking tasks
• We can easily accomplish control-flow analysis, i.e., realize the damn
conditions that make the program reach a specific state of execution
• First, it translates the binary in VEX Intermediate Representation.
Then, simulates instructions in a simulation engine: SimuVEX
• Finally, they use a custom Z3 wrapper. It is called claripy: “a
abstracted constraint-solving wrapper”
Demo 2 - Angr
https://goo.gl/42T4mi
Ponce
IDA plugin contest - 2016
• Taint analysis: this mode is used to understand
and track where a user input occurs inside a
program
• Symbolic analysis: in this mode, the plugin
maintains a symbolic state of registers and
memory at each step in a binary’s execution
path, allowing the user to solve user-controlled
conditions to do manually guided execution
RGAT
An instruction trace visualisation tool
Useful links to fry your brain
(Over 1337 ºC)
• Chill
• https://github.com/RPISEC/MBE (lectures 2 and 3)
• Reddit
• https://reddit.com/r/reverseengineering
• https://reddit.com/r/netsec
• Practice
• http://reversing.kr
• https://ringzer0team.com
• http://crackmes.de
• https://ctftime.org (Read CTF writeups and try to solve some challenges)
• Play CTFs (Hackover CTF just started and HITCON CTF starts in 7 hours)
The end
Why secure

my code…

I’ll just hide it!
Security through obscurity

More Related Content

What's hot

An Introduction to MISRA C:2012
An Introduction to MISRA C:2012An Introduction to MISRA C:2012
An Introduction to MISRA C:2012
PRQA
 
Scala の関数型プログラミングを支える技術
Scala の関数型プログラミングを支える技術Scala の関数型プログラミングを支える技術
Scala の関数型プログラミングを支える技術
Naoki Aoyama
 
メディアコンテンツ向け記事検索DBとして使うElasticsearch
メディアコンテンツ向け記事検索DBとして使うElasticsearchメディアコンテンツ向け記事検索DBとして使うElasticsearch
メディアコンテンツ向け記事検索DBとして使うElasticsearch
Yasuhiro Murata
 
Verification and Validation in Software Engineering SE19
Verification and Validation in Software Engineering SE19Verification and Validation in Software Engineering SE19
Verification and Validation in Software Engineering SE19koolkampus
 
Software Estimation
Software EstimationSoftware Estimation
Software Estimation
Nguyen Hai
 
CodeIgniter入門
CodeIgniter入門CodeIgniter入門
CodeIgniter入門
Sho A
 
Software development methodologies
Software development methodologiesSoftware development methodologies
Software development methodologies
Ankita Lachhwani
 
ワタシハ Azure Functions チョットデキル
ワタシハ Azure Functions チョットデキルワタシハ Azure Functions チョットデキル
ワタシハ Azure Functions チョットデキル
Tsuyoshi Ushio
 
Common Problems of Software Development
Common Problems of Software DevelopmentCommon Problems of Software Development
Common Problems of Software Development
Aleksejs Truhans
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
Zahoorali Khan
 
Software reverse engineering
Software reverse engineeringSoftware reverse engineering
Software reverse engineering
Parminder Singh
 
Software Engineering Methodologies
Software Engineering MethodologiesSoftware Engineering Methodologies
Software Engineering MethodologiesDamian T. Gordon
 
Blazor WebAssembly と Windows Forms でのロジック共有例
Blazor WebAssembly と Windows Forms でのロジック共有例Blazor WebAssembly と Windows Forms でのロジック共有例
Blazor WebAssembly と Windows Forms でのロジック共有例
Koichi Ota
 
Software Project Organisation
Software Project OrganisationSoftware Project Organisation
Software Project OrganisationSavaş Şakar
 
List of Software Development Model and Methods
List of Software Development Model and MethodsList of Software Development Model and Methods
List of Software Development Model and Methods
Riant Soft
 
Unit iv-testing-pune-university-sres-coe
Unit iv-testing-pune-university-sres-coeUnit iv-testing-pune-university-sres-coe
Unit iv-testing-pune-university-sres-coe
Hitesh Mohapatra
 
SpringBootによるDB更新
SpringBootによるDB更新SpringBootによるDB更新
SpringBootによるDB更新
iPride Co., Ltd.
 
What is the psychology of testing
What is the psychology of testingWhat is the psychology of testing
What is the psychology of testing
Software Testing Books
 
Requirement Analysis
Requirement AnalysisRequirement Analysis
Requirement Analysis
SADEED AMEEN
 

What's hot (20)

An Introduction to MISRA C:2012
An Introduction to MISRA C:2012An Introduction to MISRA C:2012
An Introduction to MISRA C:2012
 
Scala の関数型プログラミングを支える技術
Scala の関数型プログラミングを支える技術Scala の関数型プログラミングを支える技術
Scala の関数型プログラミングを支える技術
 
メディアコンテンツ向け記事検索DBとして使うElasticsearch
メディアコンテンツ向け記事検索DBとして使うElasticsearchメディアコンテンツ向け記事検索DBとして使うElasticsearch
メディアコンテンツ向け記事検索DBとして使うElasticsearch
 
Verification and Validation in Software Engineering SE19
Verification and Validation in Software Engineering SE19Verification and Validation in Software Engineering SE19
Verification and Validation in Software Engineering SE19
 
Software Estimation
Software EstimationSoftware Estimation
Software Estimation
 
CodeIgniter入門
CodeIgniter入門CodeIgniter入門
CodeIgniter入門
 
Software development methodologies
Software development methodologiesSoftware development methodologies
Software development methodologies
 
ワタシハ Azure Functions チョットデキル
ワタシハ Azure Functions チョットデキルワタシハ Azure Functions チョットデキル
ワタシハ Azure Functions チョットデキル
 
Common Problems of Software Development
Common Problems of Software DevelopmentCommon Problems of Software Development
Common Problems of Software Development
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Software reverse engineering
Software reverse engineeringSoftware reverse engineering
Software reverse engineering
 
Software Engineering Methodologies
Software Engineering MethodologiesSoftware Engineering Methodologies
Software Engineering Methodologies
 
Blazor WebAssembly と Windows Forms でのロジック共有例
Blazor WebAssembly と Windows Forms でのロジック共有例Blazor WebAssembly と Windows Forms でのロジック共有例
Blazor WebAssembly と Windows Forms でのロジック共有例
 
Software Project Organisation
Software Project OrganisationSoftware Project Organisation
Software Project Organisation
 
List of Software Development Model and Methods
List of Software Development Model and MethodsList of Software Development Model and Methods
List of Software Development Model and Methods
 
Sdlc
SdlcSdlc
Sdlc
 
Unit iv-testing-pune-university-sres-coe
Unit iv-testing-pune-university-sres-coeUnit iv-testing-pune-university-sres-coe
Unit iv-testing-pune-university-sres-coe
 
SpringBootによるDB更新
SpringBootによるDB更新SpringBootによるDB更新
SpringBootによるDB更新
 
What is the psychology of testing
What is the psychology of testingWhat is the psychology of testing
What is the psychology of testing
 
Requirement Analysis
Requirement AnalysisRequirement Analysis
Requirement Analysis
 

Viewers also liked

Bringing Down the House - How One Python Script Ruled Over AntiVirus
Bringing Down the House - How One Python Script Ruled Over AntiVirusBringing Down the House - How One Python Script Ruled Over AntiVirus
Bringing Down the House - How One Python Script Ruled Over AntiVirus
CTruncer
 
Alphorm.com Formation SOPHOS XG FIREWALL, Administration
Alphorm.com Formation SOPHOS XG FIREWALL, AdministrationAlphorm.com Formation SOPHOS XG FIREWALL, Administration
Alphorm.com Formation SOPHOS XG FIREWALL, Administration
Alphorm
 
Alphorm.com Formation Excel 2016 Expert I - partie 1
Alphorm.com Formation Excel 2016 Expert I - partie 1Alphorm.com Formation Excel 2016 Expert I - partie 1
Alphorm.com Formation Excel 2016 Expert I - partie 1
Alphorm
 
Nouveaux outils et dérives de la communication politique : interview exclusiv...
Nouveaux outils et dérives de la communication politique : interview exclusiv...Nouveaux outils et dérives de la communication politique : interview exclusiv...
Nouveaux outils et dérives de la communication politique : interview exclusiv...
Damien ARNAUD
 
Fortinet UTM - les Fonctionnalités avancéese
Fortinet UTM - les Fonctionnalités avancéeseFortinet UTM - les Fonctionnalités avancéese
Fortinet UTM - les Fonctionnalités avancéese
Alphorm
 
AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0
CTruncer
 
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypassObject Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Sam Thomas
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
Daniel Bohannon
 

Viewers also liked (9)

6 MONTH INTERNSHIP AT
6 MONTH INTERNSHIP AT6 MONTH INTERNSHIP AT
6 MONTH INTERNSHIP AT
 
Bringing Down the House - How One Python Script Ruled Over AntiVirus
Bringing Down the House - How One Python Script Ruled Over AntiVirusBringing Down the House - How One Python Script Ruled Over AntiVirus
Bringing Down the House - How One Python Script Ruled Over AntiVirus
 
Alphorm.com Formation SOPHOS XG FIREWALL, Administration
Alphorm.com Formation SOPHOS XG FIREWALL, AdministrationAlphorm.com Formation SOPHOS XG FIREWALL, Administration
Alphorm.com Formation SOPHOS XG FIREWALL, Administration
 
Alphorm.com Formation Excel 2016 Expert I - partie 1
Alphorm.com Formation Excel 2016 Expert I - partie 1Alphorm.com Formation Excel 2016 Expert I - partie 1
Alphorm.com Formation Excel 2016 Expert I - partie 1
 
Nouveaux outils et dérives de la communication politique : interview exclusiv...
Nouveaux outils et dérives de la communication politique : interview exclusiv...Nouveaux outils et dérives de la communication politique : interview exclusiv...
Nouveaux outils et dérives de la communication politique : interview exclusiv...
 
Fortinet UTM - les Fonctionnalités avancéese
Fortinet UTM - les Fonctionnalités avancéeseFortinet UTM - les Fonctionnalités avancéese
Fortinet UTM - les Fonctionnalités avancéese
 
AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0AntiVirus Evasion Reconstructed - Veil 3.0
AntiVirus Evasion Reconstructed - Veil 3.0
 
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypassObject Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypass
 
Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017Invoke-Obfuscation nullcon 2017
Invoke-Obfuscation nullcon 2017
 

Similar to Demystifying Binary Reverse Engineering - Pixels Camp

Reverse Engineering.pptx
Reverse Engineering.pptxReverse Engineering.pptx
Reverse Engineering.pptxSameer Sapra
 
EMBA Firmware analysis - TROOPERS22
EMBA Firmware analysis - TROOPERS22EMBA Firmware analysis - TROOPERS22
EMBA Firmware analysis - TROOPERS22
MichaelM85042
 
михаил дударев
михаил дударевмихаил дударев
михаил дударевapps4allru
 
Mapping Detection Coverage
Mapping Detection CoverageMapping Detection Coverage
Mapping Detection Coverage
Jared Atkinson
 
EMBA - Firmware analysis - Black Hat Arsenal USA 2022
EMBA - Firmware analysis - Black Hat Arsenal USA 2022EMBA - Firmware analysis - Black Hat Arsenal USA 2022
EMBA - Firmware analysis - Black Hat Arsenal USA 2022
MichaelM85042
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
Lorna Mitchell
 
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an..."Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
SegInfo
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
Maven Logix
 
AV Evasion with the Veil Framework
AV Evasion with the Veil FrameworkAV Evasion with the Veil Framework
AV Evasion with the Veil Framework
VeilFramework
 
Reverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical GuideReverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical Guide
intertelinvestigations
 
Aleksei Dremin - Application Security Pipeline - phdays9
Aleksei Dremin - Application Security Pipeline - phdays9Aleksei Dremin - Application Security Pipeline - phdays9
Aleksei Dremin - Application Security Pipeline - phdays9
Alexey Dremin
 
TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...
TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...
TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...
Priyanka Aash
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
nitinscribd
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
Peter Hlavaty
 
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malwareDefcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
DaveEdwards12
 
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
MichaelM85042
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptx
ShivashankarHR1
 
Nullcon 2011- Behaviour Analysis with DBI
Nullcon 2011- Behaviour Analysis with DBINullcon 2011- Behaviour Analysis with DBI
Nullcon 2011- Behaviour Analysis with DBI
Sunil Kumar
 
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentationnullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
n|u - The Open Security Community
 

Similar to Demystifying Binary Reverse Engineering - Pixels Camp (20)

Reverse Engineering.pptx
Reverse Engineering.pptxReverse Engineering.pptx
Reverse Engineering.pptx
 
EMBA Firmware analysis - TROOPERS22
EMBA Firmware analysis - TROOPERS22EMBA Firmware analysis - TROOPERS22
EMBA Firmware analysis - TROOPERS22
 
михаил дударев
михаил дударевмихаил дударев
михаил дударев
 
Mapping Detection Coverage
Mapping Detection CoverageMapping Detection Coverage
Mapping Detection Coverage
 
EMBA - Firmware analysis - Black Hat Arsenal USA 2022
EMBA - Firmware analysis - Black Hat Arsenal USA 2022EMBA - Firmware analysis - Black Hat Arsenal USA 2022
EMBA - Firmware analysis - Black Hat Arsenal USA 2022
 
Tool up your lamp stack
Tool up your lamp stackTool up your lamp stack
Tool up your lamp stack
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an..."Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
"Automated Malware Analysis" de Gabriel Negreira Barbosa, Malware Research an...
 
Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
 
AV Evasion with the Veil Framework
AV Evasion with the Veil FrameworkAV Evasion with the Veil Framework
AV Evasion with the Veil Framework
 
Reverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical GuideReverse Engineering Malware - A Practical Guide
Reverse Engineering Malware - A Practical Guide
 
Aleksei Dremin - Application Security Pipeline - phdays9
Aleksei Dremin - Application Security Pipeline - phdays9Aleksei Dremin - Application Security Pipeline - phdays9
Aleksei Dremin - Application Security Pipeline - phdays9
 
TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...
TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...
TRITON: How it Disrupted Safety Systems and Changed the Threat Landscape of I...
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
 
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malwareDefcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
Defcon 22-wesley-mc grew-instrumenting-point-of-sale-malware
 
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022EMBA - Firmware analysis DEFCON30 demolabs USA 2022
EMBA - Firmware analysis DEFCON30 demolabs USA 2022
 
Static-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptxStatic-Analysis-in-Industry.pptx
Static-Analysis-in-Industry.pptx
 
Nullcon 2011- Behaviour Analysis with DBI
Nullcon 2011- Behaviour Analysis with DBINullcon 2011- Behaviour Analysis with DBI
Nullcon 2011- Behaviour Analysis with DBI
 
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentationnullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
nullcon 2011 - Automatic Program Analysis using Dynamic Binary Instrumentation
 

Recently uploaded

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 

Recently uploaded (20)

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 

Demystifying Binary Reverse Engineering - Pixels Camp

  • 2.
  • 3. Reverse Engineering • Uncovering the hidden behaviour of a given technology, system, program, protocol or device, by analysing the structure and operation of its components • Extracting knowledge about any unknown engineering invention
  • 4. Reverse Engineering “Is biology reverse engineering?”
  • 6. Reverse Engineering
 History • Reversing was used to copy inventions from other countries or business competitors • Frequently used in the WW2 and Cold war: • Jerry can • Panzerschreck • Tupolev Tu-4 / B-29
  • 7. Binary Reverse Engineering Motivation • Software and hardware cracking • Malware analysis - botnets, spyware, ransomware • Finding bugs and developing 0day exploits • Creating or improving docs • Interpreting unknown protocols • Academic purposes • Industrial or military espionage • Software interoperability
  • 8. Who knows how to do this stuff? • Hackers in general • Intelligence agencies / cybercrime divisions • Antivirus companies • Students and curious people
  • 9. Binary Reverse Engineering • It’s the process of getting knowledge about compiled software, in order to understand how it works and how it was originally implemented.
  • 10. Binary Reverse Engineering • It’s the process of getting knowledge about compiled software, in order to understand how it works and how it was originally implemented. Without the source code???
  • 11. • It’s the process of getting knowledge about compiled software, in order to understand how it works and how it was originally implemented. WTF? WTF?WTF? Without the source code???Binary Reverse Engineering WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF? WTF?
  • 12. Binary Reverse Engineering Formats of compiled software • ELF (Linux & UNIX like) • Mach-O (OSX) • PE (Windows) • Class (Java bytecode) • DEX (Android - Dalvik bytecode) • PYC (Python bytecode) • …
  • 13.
  • 14. • Debugging (GDB, Valgrind, WinDbg) • Assembly (x86, x64, ARM, MIPS and many others) • Programming (C, C++, Java, etc) • Software architecture • Logic, math, crypto, protocols, networks • Don’t giving up Required skills
  • 15. Awesome tools • Disassemblers • Debuggers • Decompilers • Patchers
  • 16. Disassemblers These programs translate machine code to assembly.
  • 17. Debuggers These programs are used to test other programs. Debuggers allow us to inspect memory and CPU registers, modify of variables in runtime, set breakpoints and call functions outside the program flow. In reverse engineering we usually use them for dynamic analysis.
  • 18. Decompilers These programs try to achieve the near-impossible task of translating compiled software to the original source code. Sometimes, the generated code is more than enough to perform reversing tasks

  • 19. Patchers A patcher is very useful for changing binary code in order to modify the software behaviour. Hex editors can be used as patchers, but there are better tools in the wild, that allow us to patch assembly instructions.
  • 20. Badass tools • Disassemblers, debuggers and patchers • IDA Pro - https://www.hex-rays.com/products/ida • Hopper Disassembler - http://www.hopperapp.com • binary.ninja - https://binary.ninja • Radare 2 - http://rada.re • ODA - http://www.onlinedisassembler.com • OllyDbg - http://www.ollydbg.de • ILSpy - http://ilspy.net • Linux tools: objdump, ltrace, strace, readelf, gdb • Apktool - https://ibotpeaches.github.io/Apktool
  • 21. Badass tools • Decompilers • IDA Pro - https://www.hex-rays.com/products/ida (x86, x64, ARM, MIPS, Gameboy, etc) • Hopper Disassembler - http://www.hopperapp.com (x86, x64, ARM) • Retargetable Decompiler (AVG) - https://retdec.com (x86, ARM, MIPS, Power PC) • JADX - https://github.com/skylot/jadx (DEX) • Online android decompilers: http://www.javadecompilers.com/apk | http:// www.decompileandroid.com • JetBrains dotPeek - https://www.jetbrains.com/decompiler (.NET) • ILSpy - http://ilspy.net (.NET) • uncompyle2 - https://github.com/Mysterie/uncompyle2 (Python bytecode)
  • 22. Static Analysis • Do not execute the program • Read the spooky assembly/decompiled code • Inspect flow charts • Take lots of notes • Translate procedures to the programming language of your choice • It’s a pain in the ass to reverse obfuscated of very complex programs
  • 23. Dynamic Analysis • Execute the program • Inspect the program behaviour • Use a debugger to understand the values of the CPU registers, memory (stack, heap) and the guessed arguments for functions calls in a specific state of execution • It’s difficult to achieve if any anti-debugging protections exist (Some even crash IDA PRO)
  • 26. Demo 1 - Dynamic analysis https://goo.gl/XXoPCV
  • 27. Cracking • This demo was a very simple cracking scenario • The real stuff involves a much more complex task (static analysis, dynamic analysis, concolic analysis) • E.g. If you want to create a keygen you need to understand the serial number validation algorithm • You need to be a patching ninja to remove anti- cracking protections (usually triggered in runtime)
  • 28. Cracking • In the good old times: to crack a game you just needed to patch code to bypass PC-CDROM ID or Integrity checks • Reverse engineering is one of the main categories in Security CTFs • In CTFs, the contestants are typically challenged to solve cracking problems • The simplest case is just like the last demo. Find the correct input
  • 30. Cracking Advanced techniques • Timing attacks • When a char is correct: one more cycle is executed, i.e. more instructions • It’s possible to launch a timing attack, char by char • The attack complexity is reduced from to • How can we prevent this kind of attacks? • Tools for local binary timing attacks: Pin tool, GDB scripts
  • 31. Cracking Advanced techniques • Solvers • Serial number validation algorithms are usually composed by complex verifications, whose components are the values of certain indexes of the serial number. 
 
 E.g. • These verifications can be translated to systems of equations, that can be easily solved by powerful tools like Z3 Theorem Prover, Sage, Maple, Matlab • Z3 supports both arithmetic and bitwise operators, and custom functions as well.
  • 32. Cracking Advanced techniques - Z3 Python script Solutions
  • 33. What about the future? Predicting the future using Naive Mayes
  • 34. Let’s get to the powerful stuff
  • 35.
  • 36.
  • 37. DARPA CGC • A very important mark in the history of infosec • It was the first-ever all-machine hacking tournament • These machines were able to automatically find and patch vulnerabilities in binaries • The Mechanical Phish project, from the Shellphish team, was able to identify vulnerabilities using both fuzzing and symbolic execution techniques.
  • 39. DARPA CGC Mechanical Phish - ANGR • ANGR is a very powerful binary analysis framework. It was implemented mostly by the Shellphish team and is one of the main components of Driller • It’s one of the most recent open source technologies to perform reversing/cracking tasks • We can easily accomplish control-flow analysis, i.e., realize the damn conditions that make the program reach a specific state of execution • First, it translates the binary in VEX Intermediate Representation. Then, simulates instructions in a simulation engine: SimuVEX • Finally, they use a custom Z3 wrapper. It is called claripy: “a abstracted constraint-solving wrapper”
  • 40. Demo 2 - Angr https://goo.gl/42T4mi
  • 41. Ponce IDA plugin contest - 2016 • Taint analysis: this mode is used to understand and track where a user input occurs inside a program • Symbolic analysis: in this mode, the plugin maintains a symbolic state of registers and memory at each step in a binary’s execution path, allowing the user to solve user-controlled conditions to do manually guided execution
  • 42.
  • 43. RGAT An instruction trace visualisation tool
  • 44. Useful links to fry your brain (Over 1337 ºC) • Chill • https://github.com/RPISEC/MBE (lectures 2 and 3) • Reddit • https://reddit.com/r/reverseengineering • https://reddit.com/r/netsec • Practice • http://reversing.kr • https://ringzer0team.com • http://crackmes.de • https://ctftime.org (Read CTF writeups and try to solve some challenges) • Play CTFs (Hackover CTF just started and HITCON CTF starts in 7 hours)
  • 45. The end Why secure
 my code…
 I’ll just hide it! Security through obscurity