SlideShare a Scribd company logo
THE POSTMODERN BINARY ANALYSIS
Onur ALANBEL
$ id -un
➤ Computer Engineer (IZTECH)
➤ Developer @TaintAll (taintall.com)
➤ AppSec Researcher
➤ Blog: onuralanbel.pro
➤ @onuralanbel
➤ https://packetstormsecurity.com/search/?q=onur+alanbel
AGENDA
➤ Dynamic Binary Instrumentation
➤ Taint Analysis
➤ Constraint Solving With Z3
➤ Symbolic/Concolic Execution
DYNAMIC BINARY INSTRUMENTATION
➤ Inject instrumentation code into a
running binary.
DYNAMIC BINARY INSTRUMENTATION
➤ Inject instrumentation code into a
running binary.
➤ Instrumentation code executes as
normal instructions.
DYNAMIC BINARY INSTRUMENTATION
➤ Inject instrumentation code into a
running binary.
➤ Instrumentation code executes as
normal instructions.
➤ Instrumentation is transparent to
the application.
DBI FRAMEWORKS
➤ Intel PIN Framework
➤ Win, Lin, OS X
➤ No IL
DBI FRAMEWORKS
➤ Intel PIN Framework
➤ Win, Lin, OS X
➤ No IL
➤ Valgrind
➤ Lin, OS X
➤ IL
DBI FRAMEWORKS
➤ Intel PIN Framework
➤ Win, Lin, OS X
➤ No IL
➤ Valgrind
➤ Lin, OS X
➤ IL
➤ DynamoRIO
➤ Win, Lin, Android
➤ No IL
DBI FRAMEWORKS
➤ Intel PIN Framework
➤ Win, Lin, OS X
➤ No IL
➤ Valgrind
➤ Lin, OS X
➤ IL
➤ DynamoRIO
➤ Win, Lin, Android
➤ No IL
➤ May be others like
➤ PEMU
➤ …
INSTRUCTION COUNTING
SIMPLE SIDE CHANNEL ATTACK
CAN WE DO BETTER?
➤ Use snapshots instead of Re-run
CAN WE DO BETTER?
➤ Use snapshots instead of Re-run
➤ Use multi-threading
CAN WE DO BETTER?
➤ Use snapshots instead of Re-run
➤ Use multi-threading
➤ What about doing something smarter?
TAINT ANALYSIS
➤ Which parts of the code can be controlled or affected by
tainted data (usually user input)
TAINT ANALYSIS
➤ Which parts of the code can be controlled or affected by
tainted data (usually user input)
TAINT ANALYSIS
taint RAX
TAINT ANALYSIS
taint RAX
mov RCX, RAX
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
…….
mov RCX, ptr [0x1234]
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
…….
mov RCX, ptr [0x1234]
pop RBX
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
…….
mov RCX, ptr [0x1234]
pop RBX
stop tainting
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
…….
mov RCX, ptr [0x1234]
pop RBX
stop tainting
Which are the tainted regs?
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
…….
mov RCX, ptr [0x1234]
pop RBX
stop tainting
Which are the tainted regs?
Which are the tainted mems?
TAINT ANALYSIS
taint RAX
mov RCX, RAX
push RCX
…….
mov RCX, ptr [0x1234]
pop RBX
stop tainting
Which are the tainted regs?
Which are the tainted mems?
RAX, RBX and 8 addresses

from the stack
TAINT ANALYSIS
taint RAX
mov AL, 0x1
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp ECX, EBX
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp ECX, EBX
jz 0x4321
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp ECX, EBX
jz 0x4321
Can we control this branch?
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp CL, BL
jz 0x4321
What about this one?
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp CL, BL
jz 0x4321
What about this one?
taint RCX
xor RCX, RDX
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp CL, BL
jz 0x4321
What about this one?
taint RCX
xor RCX, RDX
add RAX, RCX
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp CL, BL
jz 0x4321
What about this one?
taint RCX
xor RCX, RDX
add RAX, RCX
Should RAX be tainted?
TAINT ANALYSIS
taint RAX
mov AL, 0x1
mov ECX, EAX
cmp CL, BL
jz 0x4321
What about this one?
taint RCX
xor RCX, RCX
mov RAX, RCX
Now, should be ?
TAINT ANALYSIS
➤ With the help of PIN’s Inspection API (TaintAll)
TAINT ANALYSIS
➤ With the help of PIN’s Inspection API (TaintAll)
➤ With the help of Symbolic Execution (Triton Framework)
TAINT ANALYSIS
➤ With the help of PIN’s Inspection API (TaintAll)
➤ With the help of Symbolic Execution (Triton Framework)
➤ Using an Intermediate Language (TaintGrind)
TAINT ANALYSIS WITH TRITON
Triton/src/examples/pin/
runtime_memory_tainting.py
with a little modification
TAINT ANALYSIS WITH TRITON
Triton/src/examples/pin/
runtime_memory_tainting.py
with a little modification
A LITTLE BIT OF Z3
➤ “Z3 is a state-of-the art theorem prover from Microsoft
Research”
A LITTLE BIT OF Z3
➤ “Z3 is a state-of-the art theorem prover from Microsoft
Research”
➤ Input format is an extension of SMT-LIB 2.0 standard
A LITTLE BIT OF Z3
➤ “Z3 is a state-of-the art theorem prover from Microsoft
Research”
➤ Input format is an extension of SMT-LIB 2.0 standard
A LITTLE BIT OF Z3
➤ “Z3 is a state-of-the art theorem prover from Microsoft
Research”
➤ Input format is an extension of SMT-LIB 2.0 standard
➤ Or use Z3Py
The Postmodern Binary Analysis
For a real world example
Search: “Reversing the petya
ransomware with constraint solvers”
SYMBOLIC EXECUTION
➤ x = input()

y = x * 5

if x < 20:

print “ok”

else:

print “nope”
SYMBOLIC EXECUTION
➤ x = input()

y = x * 5

if x < 20:

print “ok”

else:

print “nope”
y=sym_x*5
sym_x
x < 20
ok nope
CONCRETE EXECUTION
➤ x = input()

y = x * 5

if x < 20:

print “ok”

else:

print “nope”
y=sym_x*5
sym_x
x < 20
ok nope
CONCOLIC EXECUTION
➤ x = input()

y = x * 5

if x < 20:

print “ok”

else:

print “nope”
y=sym_x*5
sym_x
x < 20
ok nope
The Postmodern Binary Analysis
OPEN SOURCE DBA FRAMEWORKS/TOOLS
➤ Triton
➤ Angr
➤ BitBlaze TEMU
➤ Valgrind Tools
➤ PIN Tools
REFERENCES
➤ http://uninformed.org/index.cgi?v=7&a=1&p=3
➤ https://software.intel.com/sites/landingpage/pintool/docs/
76991/Pin/html/
➤ http://smtlib.cs.uiowa.edu/solvers.shtml

More Related Content

PDF
Hacking the Gateways
PDF
Can We Prevent Use-after-free Attacks?
PDF
Raptor web application firewall
PDF
Ricardo J. Rodríguez & Daniel Uroz - When ROP meets Turing: Automatic Generat...
PDF
NSC #2 - Challenge Solution
PDF
Zero bugs found? Hold my beer AFL! how to improve coverage-guided fuzzing and...
PDF
Sheila Ayelen Berta - The Art of Persistence: "Mr. Windows… I don’t wanna go ...
Hacking the Gateways
Can We Prevent Use-after-free Attacks?
Raptor web application firewall
Ricardo J. Rodríguez & Daniel Uroz - When ROP meets Turing: Automatic Generat...
NSC #2 - Challenge Solution
Zero bugs found? Hold my beer AFL! how to improve coverage-guided fuzzing and...
Sheila Ayelen Berta - The Art of Persistence: "Mr. Windows… I don’t wanna go ...

What's hot (20)

PDF
Fuzzing malware for fun & profit. Applying Coverage-Guided Fuzzing to Find Bu...
PDF
Stealth post-exploitation with phpsploit
PDF
Chromium Sandbox on Linux (NDC Security 2019)
PDF
Chromium Sandbox on Linux (BlackHoodie 2018)
PDF
Hacking with Backtrack Lecture-3
PDF
44CON London 2015 - Is there an EFI monster inside your apple?
PDF
Linux Security APIs and the Chromium Sandbox
PDF
44CON 2014 - Breaking AV Software
PDF
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
PPTX
Hacking routers as Web Hacker
PDF
WAF protections and bypass resources
PDF
Introduction to VeriFast @ Kyoto
PDF
Introduction to Memory Exploitation (CppEurope 2021)
PDF
How to Setup A Pen test Lab and How to Play CTF
PPTX
Kali Linux - Falconer
PDF
Understand study
PDF
A Hypervisor IPS based on Hardware Assisted Virtualization Technology
PDF
Thunderbolts and Lightning: Very Very Frightening
PDF
Fuzzing underestimated method of finding hidden bugs
PDF
Talk NullByteCon 2015
Fuzzing malware for fun & profit. Applying Coverage-Guided Fuzzing to Find Bu...
Stealth post-exploitation with phpsploit
Chromium Sandbox on Linux (NDC Security 2019)
Chromium Sandbox on Linux (BlackHoodie 2018)
Hacking with Backtrack Lecture-3
44CON London 2015 - Is there an EFI monster inside your apple?
Linux Security APIs and the Chromium Sandbox
44CON 2014 - Breaking AV Software
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
Hacking routers as Web Hacker
WAF protections and bypass resources
Introduction to VeriFast @ Kyoto
Introduction to Memory Exploitation (CppEurope 2021)
How to Setup A Pen test Lab and How to Play CTF
Kali Linux - Falconer
Understand study
A Hypervisor IPS based on Hardware Assisted Virtualization Technology
Thunderbolts and Lightning: Very Very Frightening
Fuzzing underestimated method of finding hidden bugs
Talk NullByteCon 2015
Ad

Similar to The Postmodern Binary Analysis (20)

PDF
Taint analysis
PDF
A guided fuzzing approach for security testing of network protocol software
PPTX
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
PDF
Dmitriy D1g1 Evdokimov - DBI Intro
PDF
[2010 CodeEngn Conference 04] passket - Taint analysis for vulnerability disc...
PDF
Dynamic Binary Analysis and Obfuscated Codes
PDF
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
PDF
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
PDF
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
PDF
St hack2015 dynamic_behavior_analysis_using_binary_instrumentation_jonathan_s...
PPTX
Memory protection using dynamic tainting
PPT
Dc 12 Chiueh
PPTX
Memory Corruption: from sandbox to SMM
PDF
Automating Analysis and Exploitation of Embedded Device Firmware
PDF
BlueHat Seattle 2019 || Modern Binary Analysis with ILs
PDF
Model-checking for efficient malware detection
PPT
Georgy Nosenko - An introduction to the use SMT solvers for software security
PPT
13517398.ppt
PPTX
Advanced malware analysis training session4 anti-analysis techniques
PPT
Detecting and Preventing Memory Attacks#
Taint analysis
A guided fuzzing approach for security testing of network protocol software
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
Dmitriy D1g1 Evdokimov - DBI Intro
[2010 CodeEngn Conference 04] passket - Taint analysis for vulnerability disc...
Dynamic Binary Analysis and Obfuscated Codes
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
[2011 CodeEngn Conference 05] Deok9 - DBI(Dynamic Binary Instrumentation)를 이용...
Sthack 2015 - Jonathan "@JonathanSalwan" Salwan - Dynamic Behavior Analysis U...
St hack2015 dynamic_behavior_analysis_using_binary_instrumentation_jonathan_s...
Memory protection using dynamic tainting
Dc 12 Chiueh
Memory Corruption: from sandbox to SMM
Automating Analysis and Exploitation of Embedded Device Firmware
BlueHat Seattle 2019 || Modern Binary Analysis with ILs
Model-checking for efficient malware detection
Georgy Nosenko - An introduction to the use SMT solvers for software security
13517398.ppt
Advanced malware analysis training session4 anti-analysis techniques
Detecting and Preventing Memory Attacks#
Ad

More from Onur Alanbel (7)

PDF
Başarılı Bir Siber Saldırının Perde Arkası ve Vaka Analizi
PDF
SOC Ekiplerinin Problemlerine Güncel Yaklaşımlar
PDF
Dünden Bugüne Exploit Dünyası
PDF
Shellshock
PDF
Binary Hacking Hakkında Herşey
PDF
Developing MIPS Exploits to Hack Routers
PDF
OWASPTR Uygulama Güvenliği Günü 2013
Başarılı Bir Siber Saldırının Perde Arkası ve Vaka Analizi
SOC Ekiplerinin Problemlerine Güncel Yaklaşımlar
Dünden Bugüne Exploit Dünyası
Shellshock
Binary Hacking Hakkında Herşey
Developing MIPS Exploits to Hack Routers
OWASPTR Uygulama Güvenliği Günü 2013

Recently uploaded (20)

PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
PPT
Ethics in Information System - Management Information System
PDF
Slides PDF: The World Game (s) Eco Economic Epochs.pdf
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
PDF
simpleintnettestmetiaerl for the simple testint
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
Internet Safety for Seniors presentation
PPTX
newyork.pptxirantrafgshenepalchinachinane
PPTX
1402_iCSC_-_RESTful_Web_APIs_--_Josef_Hammer.pptx
PPTX
artificial intelligence overview of it and more
PPTX
Slides PPTX: World Game (s): Eco Economic Epochs.pptx
PPTX
Funds Management Learning Material for Beg
PDF
SlidesGDGoCxRAIS about Google Dialogflow and NotebookLM.pdf
PPTX
Database Information System - Management Information System
PPTX
E -tech empowerment technologies PowerPoint
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PDF
The Evolution of Traditional to New Media .pdf
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
Uptota Investor Deck - Where Africa Meets Blockchain
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
Ethics in Information System - Management Information System
Slides PDF: The World Game (s) Eco Economic Epochs.pdf
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
simpleintnettestmetiaerl for the simple testint
SASE Traffic Flow - ZTNA Connector-1.pdf
Internet Safety for Seniors presentation
newyork.pptxirantrafgshenepalchinachinane
1402_iCSC_-_RESTful_Web_APIs_--_Josef_Hammer.pptx
artificial intelligence overview of it and more
Slides PPTX: World Game (s): Eco Economic Epochs.pptx
Funds Management Learning Material for Beg
SlidesGDGoCxRAIS about Google Dialogflow and NotebookLM.pdf
Database Information System - Management Information System
E -tech empowerment technologies PowerPoint
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Exploring VPS Hosting Trends for SMBs in 2025
The Evolution of Traditional to New Media .pdf
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Uptota Investor Deck - Where Africa Meets Blockchain

The Postmodern Binary Analysis