SlideShare a Scribd company logo
How Triton can help to reverse virtual machine based
software protections
How to don’t kill yourself when you reverse obfuscated codes.
Jonathan Salwan and Romain Thomas
CSAW SOS in NYC, November 10, 2016
About us
Romain Thomas
• Security Research Engineer at Quarkslab
• Working on obfuscation and software protection
Jonathan Salwan
• Security Research Engineer at Quarkslab
• Working on program analysis and software verification
2
Roadmap of this talk
Part 1 Short introduction to the Triton framework
Part 2 Short introduction to virtual machine based software protections
Part 3 Demo - Triton vs VMs
3
The Triton framework [6]
Triton in a nutshell
• A Dynamic Binary Analysis Framework
• Deals with the Intel x86 and x86 64 Instruction Set Architecture (ISA)
• Contains:
• Dynamic Symbolic Execution (DSE) engine [4, 7]
• Taint analysis engine
• Emulation engine
• Representation of the ISA behaviour into an Abstract Syntax Tree (AST)
• AST simplification engine
• Two syntax representations of the AST
• Python
• SMT2
5
Triton’s design
Symbolic
Execution
Engine
Taint
Engine
IR
SMT2-Lib
Semantics
SMT
Solver
Interface
SMT
Optimization
Passes
Triton internal components
Multi-Arch
design
SMT
Simplifications
Rules
Taint
Engine
API
C++ / Python
Pin
Valgrind
DynamoRio
Qemu
DB (e.g: mysql)
Example of Tracers
LibTriton.so
6
The API’s input - Opcode to semantics
API
Instruction semantics
over AST
Instruction
7
The API’s input - Semantics with a context
API
Instruction semantics
over AST
Instruction
Context
8
The API’s input - Taint Analysis
API
Taint analysisInstruction semantics
over AST
9
The API’s input - Symbolic Execution
API
π
Symbolic ExecutionInstruction semantics
over AST
10
The API’s input - Simplification / Transformation
API
Simplification / Transformation
Instruction semantics
over AST
11
The API’s input - AST representations
Instruction semantics
over AST
(bvadd (_ bv1 8) (_ bv2 8))
((0x1 + 0x2) & 0xFF)
12
The API’s input - Symbolic Emulation
API
Instruction 1
Instruction 2
Instruction 3
Instruction 4
Symbolic
Emulation
13
Example - How to define an opcode and context
>>> inst = Instruction("x48x31xD0") # xor rax, rdx
>>> inst.setAddress(0x400000)
>>> inst.updateContext(Register(REG.RAX, 0x1234))
>>> inst.updateContext(Register(REG.RDX, 0x5678))
>>> processing(inst)
14
Example - How to get semantics expressions
>>> processing(inst)
>>> print inst
400000: xor rax, rdx
>>> for expr in inst.getSymbolicExpressions():
... print expr
...
ref_0 = (0x1234 ^ 05678) # XOR operation
ref_1 = 0x0 # Clears carry flag
ref_2 = 0x0 # Clears overflow flag
ref_3 = ((0x1 ^ [... skipped ...] & 0x1)) # Parity flag
ref_4 = ((ref_0 >> 63) & 0x1) # Sign flag
ref_5 = (0x1 if (ref_0 == 0x0) else 0x0) # Zero flag
ref_6 = 0x400003 # Program Counter 15
Example - How to get implicit and explicit read registers
>>> for r in inst.getReadRegisters():
... print r
...
(rax:64 bv[63..0], 0x1234)
(rdx:64 bv[63..0], 0x5678)
16
Example - How to get implicit and explicit written registers
>>> for w in inst.getWrittenRegisters():
... print w
...
(rax:64 bv[63..0], (0x1234 ^ 0x5678))
(rip:64 bv[63..0], 0x400003)
(cf:1 bv[0..0], 0x0)
(of:1 bv[0..0], 0x0)
(pf:1 bv[0..0], ... skipped ...)
(sf:1 bv[0..0], ((ref_0 >> 63) & 0x1))
(zf:1 bv[0..0], (0x1 if (ref_0 == 0x0) else 0x0))
17
To resume: What kind of information can I get from an instruction?
• All implicit and explicit semantics of an instruction
• GET, PUT, LOAD, STORE
• Semantics (side effects included) representation via an abstract syntax tree based
on the Static Single Assignment (SSA) form
18
What about emulation?
>>> inst1 = Instruction("x48xc7xc0x05x00x00x00") # mov rax, 5
>>> inst2 = Instruction("x48x83xC0x02") # add rax, 2
>>> processing(inst1)
>>> processing(inst2)
>>> getFullAstFromId(getSymbolicRegisterId(REG.RAX))
((0x5 + 0x2) & 0xFFFFFFFFFFFFFFFF)
>>> getAstFromId(getSymbolicRegisterId(REG.RAX)).evaluate()
7L
19
Ok, but what can I do with all of this?
• Use taint analysis to help during reverse engineering
• Use symbolic execution to cover code
• Use symbolic execution to know what value(s) can hold a register or memory cell
• Simplify expressions for deobfuscation
• Transform expressions for obfuscation
• Match behaviour models for vulnerabilities research
• Be imaginative :)
20
Mmmmh, and where instruction sequences can come from?
• From dynamic tracers like Pin, Valgrind, Qemu, ...
• From a memory dump
• From static tools like IDA or whatever...
21
Cool, but how many instruction semantics are supported by Triton?
• Development:
• 256 Intel x86 64 instructions 1
• Included 116 SSE/MMX/AVX instructions
• Testing:
• The tests suite 2
of the Qemu TCG 3
• Traces differential 4
1
http://triton.quarkslab.com/documentation/doxygen/SMT Semantics Supported page.html
2
http://github.com/qemu/qemu/tree/master/tests/tcg
3
http://wiki.qemu.org/Documentation/TCG
4
http://triton.quarkslab.com/blog/What-kind-of-semantics-information-Triton-can-provide/#4
22
Virtual Machine Based Software
Protections
VM Based Software Protections
Definition:
It’s a kind of obfuscation which transforms an original instruction set (e.g. x86) into
another custom instruction set (VM implementation).
24
Example: Virtualization
mov rax, 0x123456
and rax, rbx
call func
push 0x1 # rax_id
push 0x123456
call VM_MOVE
push rbx
push rax
mov rcx, [rsp]
mov rdx, [rsp - 0x4]
and rcx, rdx
mov rax, rcx
mov rbx, 0x1
call trampoline 25
Where are VMs
• Languages: Python, Java...
• Obfuscator: VM Protect 5, Tigress 6 [1, 3], Denuvo 7
• Malwares: Zeus 8
• CTF...
5
http://vmpsoft.com/
6
http://tigress.cs.arizona.edu/
7
http://www.denuvo.com/
8
http://www.miasm.re/blog/2016/09/03/zeusvm analysis.html
26
VM abstract architecture
Fetch Instruction
Decode Instruction
Dispatch
Handler 1Handler 2 Handler 3
Terminator
27
VM abstract architecture
Fetch Instruction:
Fetch the instruction which will be executed by the VM.
Decode Instruction:
Decode the instruction according to the VM instruction set.
Example:
decode(01 11 12):
• Opcode: 0x01
• Operand 1: 0x11
• Operand 2: 0x12
28
VM abstract architecture
Dispatcher:
Jump to the right handler according to opcode and/or operands.
Handlers:
Handlers are the implementation of the VM instruction set.
For instance, the handler for the instruction
mov REG, IMM
could be:
xor REG, REG
or REG, IMM
Terminator:
Finishes the VM execution or continues its execution.
29
Dispatcher
We can have two kinds of dispatcher:
• switch case like
• jump table
30
A switch case like dispatcher
31
A jump table based dispatcher
32
Using Triton to reverse a VM
Fetch Instruction
Decode Instruction
Dispatch
Handler 2Handler 1 Handler 3
Terminator
Triton
Triton
33
Demo: Tigress VM
Tigress challenges
35
Tigress challenges
$ ./tigress-challenge 1234
3920664950602727424
$ ./tigress-challenge 326423564
16724117216240346858
36
Tigress challenges
Problem: Given a very secret algorithm obfuscated with a VM. How can we recover
the algorithm without fully reversing the VM?
37
Step 1: Symbolically emulate the binary
Trace semantics
Symbolic
Emulation
Obfuscated binary
38
Step 2: Define the user input as symbolic variable
π
39
Step 3: Concretize everything which is not related to user input
+
x
π +
3 4
-
1 x
2 5
+
x
π 7
9
40
Step 4: Use a better canonical representation of expressions
• Arybo [2] uses the Algebraic Normal Form (ANF) representation
ππ
Triton AST Arybo AST
41
Step 5: Possible use of symbolic simplifications
ππ
Arybo AST Arybo AST
on steroids
8
https://pythonhosted.org/arybo/concepts.html
42
Step 6: From Arybo to LLVM-IR
π
Arybo AST LLVM-IR
43
Step 7: Recompile with -O2 optimization and win!
LLVM-IR
Deobfuscated binary
44
Results with only one trace
45
Cover paths to reconstruct the CFG
U =
46
Results with the union of two traces
47
Time of extraction per trace
48
Let me try by myself
Release: Everything related to this analysis is available on github 9.
9
https://github.com/JonathanSalwan/Tigress protection
49
Demo: Unknown VM
VM Architecture
Fetch Instruction
Decode Instruction
Dispatch
Switch case
Handler 1Handler 2 Handler 3
Terminator
op0 op1 op2 op3 op4
51
VM Architecture
52
Goal
Fetch Instruction
Decode Instruction
Dispatch
Switch case
Handler 1Handler 2 Handler 3
Terminator
op0 op1 op2 op3 op4
53
Goal
Fetch Instruction
Decode Instruction
Dispatch
Switch case
Handler 1Handler 2 Handler 3
Terminator
op0 op1 op2 op3 op4
Tim
e
out
54
Goal
Fetch Instruction
Decode Instruction
Dispatch
Switch case
Handler 1Handler 2 Handler 3
Terminator
op0 op1 op2 op3 op4
Step
1
Step2
55
Goal
Decode
BB2
BB3 BB4
Handler
c1→2 and c2→4
(BB4 and c4→5) or (BB3 and c3→5)
c1→2
c2→4
c3→5
c4→5
56
Conclusion
Conclusion
• Symbolic execution is powerful against obfuscations
• Use mathematical complexity expressions against such attacks
• The goal is to imply a timeout on SMT solvers side
58
Thanks
Any Questions?
59
Acknowledgements
• Thanks to Brendan Dolan-Gavitt for his invitation to the S.O.S workshop!
• Kudos to Adrien Guinet for his Arybo 10 framework!
10
https://github.com/quarkslab/arybo
60
Contact us
• Romain Thomas
• rthomas at quarkslab com
• @rh0main
• Jonathan Salwan
• jsalwan at quarkslab com
• @JonathanSalwan
• Triton team
• triton at quarkslab com
• @qb triton
• irc: #qb triton@freenode.org
61
References I
C. Collberg, S. Martin, J. Myers, and J. Nagra.
Distributed application tamper detection via continuous software updates.
In Proceedings of the 28th Annual Computer Security Applications Conference,
ACSAC ’12, pages 319–328, New York, NY, USA, 2012. ACM.
N. Eyrolles, A. Guinet, and M. Videau.
Arybo: Manipulation, canonicalization and identification of mixed
boolean-arithmetic symbolic expressions.
GreHack, France, Grenoble, 2016.
Y. Kanzaki, A. Monden, and C. Collberg.
Code artificiality: A metric for the code stealth based on an n-gram model.
In SPRO 2015 International Workshop on Software Protection, 2015.
62
References II
J. C. King.
Symbolic execution and program testing.
Communications of the ACM, 19(7):385–394, 1976.
C. Lattner and V. Adve.
LLVM: A compilation framework for lifelong program analysis and
transformation.
pages 75–88, San Jose, CA, USA, Mar 2004.
63
References III
F. Saudel and J. Salwan.
Triton: A dynamic symbolic execution framework.
In Symposium sur la s´ecurit´e des technologies de l’information et des
communications, SSTIC, France, Rennes, June 3-5 2015, pages 31–54. SSTIC,
2015.
K. Sen, D. Marinov, and G. Agha.
Cute: a concolic unit testing engine for c.
In ACM SIGSOFT Software Engineering Notes, volume 30, pages 263–272. ACM,
2005.
64

More Related Content

What's hot

Bug Bounty - Hackers Job
Bug Bounty - Hackers JobBug Bounty - Hackers Job
Bug Bounty - Hackers JobArbin Godar
 
Методы обхода Web Application Firewall
Методы обхода Web Application FirewallМетоды обхода Web Application Firewall
Методы обхода Web Application FirewallDmitry Evteev
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
bugcrowd
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applications
Yura Nosenko
 
Bug Bounty 101
Bug Bounty 101Bug Bounty 101
Bug Bounty 101
Shahee Mirza
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
Himanshu Kumar Das
 
Static Code Analysis and Cppcheck
Static Code Analysis and CppcheckStatic Code Analysis and Cppcheck
Static Code Analysis and Cppcheck
Zachary Blair
 
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
bugcrowd
 
Bypass_AV-EDR.pdf
Bypass_AV-EDR.pdfBypass_AV-EDR.pdf
Bypass_AV-EDR.pdf
Farouk2nd
 
Dom based xss
Dom based xssDom based xss
Dom based xssLê Giáp
 
Bug Bounty Secrets
Bug Bounty Secrets Bug Bounty Secrets
Ekoparty 2017 - The Bug Hunter's Methodology
Ekoparty 2017 - The Bug Hunter's MethodologyEkoparty 2017 - The Bug Hunter's Methodology
Ekoparty 2017 - The Bug Hunter's Methodology
bugcrowd
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
OWASP Nagpur
 
Binary exploitation - AIS3
Binary exploitation - AIS3Binary exploitation - AIS3
Binary exploitation - AIS3
Angel Boy
 
Saying Hello to Bug Bounty
Saying Hello to Bug BountySaying Hello to Bug Bounty
Saying Hello to Bug Bounty
Null Bhubaneswar
 
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
Frans Rosén
 
SSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAPSSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAP
ERPScan
 
Advance ROP Attacks
Advance ROP AttacksAdvance ROP Attacks
JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013Vladimir Ivanov
 

What's hot (20)

Bug Bounty - Hackers Job
Bug Bounty - Hackers JobBug Bounty - Hackers Job
Bug Bounty - Hackers Job
 
Owasp zap
Owasp zapOwasp zap
Owasp zap
 
Методы обхода Web Application Firewall
Методы обхода Web Application FirewallМетоды обхода Web Application Firewall
Методы обхода Web Application Firewall
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applications
 
Bug Bounty 101
Bug Bounty 101Bug Bounty 101
Bug Bounty 101
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
 
Static Code Analysis and Cppcheck
Static Code Analysis and CppcheckStatic Code Analysis and Cppcheck
Static Code Analysis and Cppcheck
 
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
 
Bypass_AV-EDR.pdf
Bypass_AV-EDR.pdfBypass_AV-EDR.pdf
Bypass_AV-EDR.pdf
 
Dom based xss
Dom based xssDom based xss
Dom based xss
 
Bug Bounty Secrets
Bug Bounty Secrets Bug Bounty Secrets
Bug Bounty Secrets
 
Ekoparty 2017 - The Bug Hunter's Methodology
Ekoparty 2017 - The Bug Hunter's MethodologyEkoparty 2017 - The Bug Hunter's Methodology
Ekoparty 2017 - The Bug Hunter's Methodology
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 
Binary exploitation - AIS3
Binary exploitation - AIS3Binary exploitation - AIS3
Binary exploitation - AIS3
 
Saying Hello to Bug Bounty
Saying Hello to Bug BountySaying Hello to Bug Bounty
Saying Hello to Bug Bounty
 
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
 
SSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAPSSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAP
 
Advance ROP Attacks
Advance ROP AttacksAdvance ROP Attacks
Advance ROP Attacks
 
JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013JVM JIT-compiler overview @ JavaOne Moscow 2013
JVM JIT-compiler overview @ JavaOne Moscow 2013
 

Similar to How Triton can help to reverse virtual machine based software protections

GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUsGOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
Priyanka Aash
 
Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017
Cristofaro Mune
 
Meltdown & Spectre attacks
Meltdown & Spectre attacksMeltdown & Spectre attacks
Meltdown & Spectre attacks
Marian Marinov
 
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
CODE BLUE
 
GOD MODE Unlocked: Hardware backdoors in x86 CPUs
GOD MODE Unlocked: Hardware backdoors in x86 CPUsGOD MODE Unlocked: Hardware backdoors in x86 CPUs
GOD MODE Unlocked: Hardware backdoors in x86 CPUs
Priyanka Aash
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linuxAjin Abraham
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
Moabi.com
 
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...Positive Hack Days
 
OT Security - h-c0n 2020
OT Security - h-c0n 2020OT Security - h-c0n 2020
OT Security - h-c0n 2020
Jose Palanco
 
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilitiesBlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat Security Conference
 
Grow and Shrink - Dynamically Extending the Ruby VM Stack
Grow and Shrink - Dynamically Extending the Ruby VM StackGrow and Shrink - Dynamically Extending the Ruby VM Stack
Grow and Shrink - Dynamically Extending the Ruby VM Stack
KeitaSugiyama1
 
Finding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyFinding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated Disassembly
Priyanka Aash
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
Koan-Sin Tan
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityDefconRussia
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -evechiportal
 
Java Memory Model
Java Memory ModelJava Memory Model
Java Memory Model
Łukasz Koniecki
 
The Spectre of Meltdowns
The Spectre of MeltdownsThe Spectre of Meltdowns
The Spectre of Meltdowns
Andriy Berestovskyy
 
Valgrind
ValgrindValgrind
Valgrind
aidanshribman
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniques
Satpal Parmar
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
National Cheng Kung University
 

Similar to How Triton can help to reverse virtual machine based software protections (20)

GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUsGOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
 
Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017Escalating Privileges in Linux using Fault Injection - FDTC 2017
Escalating Privileges in Linux using Fault Injection - FDTC 2017
 
Meltdown & Spectre attacks
Meltdown & Spectre attacksMeltdown & Spectre attacks
Meltdown & Spectre attacks
 
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
PANDEMONIUM: Automated Identification of Cryptographic Algorithms using Dynam...
 
GOD MODE Unlocked: Hardware backdoors in x86 CPUs
GOD MODE Unlocked: Hardware backdoors in x86 CPUsGOD MODE Unlocked: Hardware backdoors in x86 CPUs
GOD MODE Unlocked: Hardware backdoors in x86 CPUs
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
 
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
 
OT Security - h-c0n 2020
OT Security - h-c0n 2020OT Security - h-c0n 2020
OT Security - h-c0n 2020
 
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilitiesBlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
 
Grow and Shrink - Dynamically Extending the Ruby VM Stack
Grow and Shrink - Dynamically Extending the Ruby VM StackGrow and Shrink - Dynamically Extending the Ruby VM Stack
Grow and Shrink - Dynamically Extending the Ruby VM Stack
 
Finding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated DisassemblyFinding Xori: Malware Analysis Triage with Automated Disassembly
Finding Xori: Malware Analysis Triage with Automated Disassembly
 
running stable diffusion on android
running stable diffusion on androidrunning stable diffusion on android
running stable diffusion on android
 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
Java Memory Model
Java Memory ModelJava Memory Model
Java Memory Model
 
The Spectre of Meltdowns
The Spectre of MeltdownsThe Spectre of Meltdowns
The Spectre of Meltdowns
 
Valgrind
ValgrindValgrind
Valgrind
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniques
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 

Recently uploaded

road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
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
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
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
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
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
 

Recently uploaded (20)

road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
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
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
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
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
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...
 

How Triton can help to reverse virtual machine based software protections

  • 1. How Triton can help to reverse virtual machine based software protections How to don’t kill yourself when you reverse obfuscated codes. Jonathan Salwan and Romain Thomas CSAW SOS in NYC, November 10, 2016
  • 2. About us Romain Thomas • Security Research Engineer at Quarkslab • Working on obfuscation and software protection Jonathan Salwan • Security Research Engineer at Quarkslab • Working on program analysis and software verification 2
  • 3. Roadmap of this talk Part 1 Short introduction to the Triton framework Part 2 Short introduction to virtual machine based software protections Part 3 Demo - Triton vs VMs 3
  • 5. Triton in a nutshell • A Dynamic Binary Analysis Framework • Deals with the Intel x86 and x86 64 Instruction Set Architecture (ISA) • Contains: • Dynamic Symbolic Execution (DSE) engine [4, 7] • Taint analysis engine • Emulation engine • Representation of the ISA behaviour into an Abstract Syntax Tree (AST) • AST simplification engine • Two syntax representations of the AST • Python • SMT2 5
  • 6. Triton’s design Symbolic Execution Engine Taint Engine IR SMT2-Lib Semantics SMT Solver Interface SMT Optimization Passes Triton internal components Multi-Arch design SMT Simplifications Rules Taint Engine API C++ / Python Pin Valgrind DynamoRio Qemu DB (e.g: mysql) Example of Tracers LibTriton.so 6
  • 7. The API’s input - Opcode to semantics API Instruction semantics over AST Instruction 7
  • 8. The API’s input - Semantics with a context API Instruction semantics over AST Instruction Context 8
  • 9. The API’s input - Taint Analysis API Taint analysisInstruction semantics over AST 9
  • 10. The API’s input - Symbolic Execution API π Symbolic ExecutionInstruction semantics over AST 10
  • 11. The API’s input - Simplification / Transformation API Simplification / Transformation Instruction semantics over AST 11
  • 12. The API’s input - AST representations Instruction semantics over AST (bvadd (_ bv1 8) (_ bv2 8)) ((0x1 + 0x2) & 0xFF) 12
  • 13. The API’s input - Symbolic Emulation API Instruction 1 Instruction 2 Instruction 3 Instruction 4 Symbolic Emulation 13
  • 14. Example - How to define an opcode and context >>> inst = Instruction("x48x31xD0") # xor rax, rdx >>> inst.setAddress(0x400000) >>> inst.updateContext(Register(REG.RAX, 0x1234)) >>> inst.updateContext(Register(REG.RDX, 0x5678)) >>> processing(inst) 14
  • 15. Example - How to get semantics expressions >>> processing(inst) >>> print inst 400000: xor rax, rdx >>> for expr in inst.getSymbolicExpressions(): ... print expr ... ref_0 = (0x1234 ^ 05678) # XOR operation ref_1 = 0x0 # Clears carry flag ref_2 = 0x0 # Clears overflow flag ref_3 = ((0x1 ^ [... skipped ...] & 0x1)) # Parity flag ref_4 = ((ref_0 >> 63) & 0x1) # Sign flag ref_5 = (0x1 if (ref_0 == 0x0) else 0x0) # Zero flag ref_6 = 0x400003 # Program Counter 15
  • 16. Example - How to get implicit and explicit read registers >>> for r in inst.getReadRegisters(): ... print r ... (rax:64 bv[63..0], 0x1234) (rdx:64 bv[63..0], 0x5678) 16
  • 17. Example - How to get implicit and explicit written registers >>> for w in inst.getWrittenRegisters(): ... print w ... (rax:64 bv[63..0], (0x1234 ^ 0x5678)) (rip:64 bv[63..0], 0x400003) (cf:1 bv[0..0], 0x0) (of:1 bv[0..0], 0x0) (pf:1 bv[0..0], ... skipped ...) (sf:1 bv[0..0], ((ref_0 >> 63) & 0x1)) (zf:1 bv[0..0], (0x1 if (ref_0 == 0x0) else 0x0)) 17
  • 18. To resume: What kind of information can I get from an instruction? • All implicit and explicit semantics of an instruction • GET, PUT, LOAD, STORE • Semantics (side effects included) representation via an abstract syntax tree based on the Static Single Assignment (SSA) form 18
  • 19. What about emulation? >>> inst1 = Instruction("x48xc7xc0x05x00x00x00") # mov rax, 5 >>> inst2 = Instruction("x48x83xC0x02") # add rax, 2 >>> processing(inst1) >>> processing(inst2) >>> getFullAstFromId(getSymbolicRegisterId(REG.RAX)) ((0x5 + 0x2) & 0xFFFFFFFFFFFFFFFF) >>> getAstFromId(getSymbolicRegisterId(REG.RAX)).evaluate() 7L 19
  • 20. Ok, but what can I do with all of this? • Use taint analysis to help during reverse engineering • Use symbolic execution to cover code • Use symbolic execution to know what value(s) can hold a register or memory cell • Simplify expressions for deobfuscation • Transform expressions for obfuscation • Match behaviour models for vulnerabilities research • Be imaginative :) 20
  • 21. Mmmmh, and where instruction sequences can come from? • From dynamic tracers like Pin, Valgrind, Qemu, ... • From a memory dump • From static tools like IDA or whatever... 21
  • 22. Cool, but how many instruction semantics are supported by Triton? • Development: • 256 Intel x86 64 instructions 1 • Included 116 SSE/MMX/AVX instructions • Testing: • The tests suite 2 of the Qemu TCG 3 • Traces differential 4 1 http://triton.quarkslab.com/documentation/doxygen/SMT Semantics Supported page.html 2 http://github.com/qemu/qemu/tree/master/tests/tcg 3 http://wiki.qemu.org/Documentation/TCG 4 http://triton.quarkslab.com/blog/What-kind-of-semantics-information-Triton-can-provide/#4 22
  • 23. Virtual Machine Based Software Protections
  • 24. VM Based Software Protections Definition: It’s a kind of obfuscation which transforms an original instruction set (e.g. x86) into another custom instruction set (VM implementation). 24
  • 25. Example: Virtualization mov rax, 0x123456 and rax, rbx call func push 0x1 # rax_id push 0x123456 call VM_MOVE push rbx push rax mov rcx, [rsp] mov rdx, [rsp - 0x4] and rcx, rdx mov rax, rcx mov rbx, 0x1 call trampoline 25
  • 26. Where are VMs • Languages: Python, Java... • Obfuscator: VM Protect 5, Tigress 6 [1, 3], Denuvo 7 • Malwares: Zeus 8 • CTF... 5 http://vmpsoft.com/ 6 http://tigress.cs.arizona.edu/ 7 http://www.denuvo.com/ 8 http://www.miasm.re/blog/2016/09/03/zeusvm analysis.html 26
  • 27. VM abstract architecture Fetch Instruction Decode Instruction Dispatch Handler 1Handler 2 Handler 3 Terminator 27
  • 28. VM abstract architecture Fetch Instruction: Fetch the instruction which will be executed by the VM. Decode Instruction: Decode the instruction according to the VM instruction set. Example: decode(01 11 12): • Opcode: 0x01 • Operand 1: 0x11 • Operand 2: 0x12 28
  • 29. VM abstract architecture Dispatcher: Jump to the right handler according to opcode and/or operands. Handlers: Handlers are the implementation of the VM instruction set. For instance, the handler for the instruction mov REG, IMM could be: xor REG, REG or REG, IMM Terminator: Finishes the VM execution or continues its execution. 29
  • 30. Dispatcher We can have two kinds of dispatcher: • switch case like • jump table 30
  • 31. A switch case like dispatcher 31
  • 32. A jump table based dispatcher 32
  • 33. Using Triton to reverse a VM Fetch Instruction Decode Instruction Dispatch Handler 2Handler 1 Handler 3 Terminator Triton Triton 33
  • 36. Tigress challenges $ ./tigress-challenge 1234 3920664950602727424 $ ./tigress-challenge 326423564 16724117216240346858 36
  • 37. Tigress challenges Problem: Given a very secret algorithm obfuscated with a VM. How can we recover the algorithm without fully reversing the VM? 37
  • 38. Step 1: Symbolically emulate the binary Trace semantics Symbolic Emulation Obfuscated binary 38
  • 39. Step 2: Define the user input as symbolic variable π 39
  • 40. Step 3: Concretize everything which is not related to user input + x π + 3 4 - 1 x 2 5 + x π 7 9 40
  • 41. Step 4: Use a better canonical representation of expressions • Arybo [2] uses the Algebraic Normal Form (ANF) representation ππ Triton AST Arybo AST 41
  • 42. Step 5: Possible use of symbolic simplifications ππ Arybo AST Arybo AST on steroids 8 https://pythonhosted.org/arybo/concepts.html 42
  • 43. Step 6: From Arybo to LLVM-IR π Arybo AST LLVM-IR 43
  • 44. Step 7: Recompile with -O2 optimization and win! LLVM-IR Deobfuscated binary 44
  • 45. Results with only one trace 45
  • 46. Cover paths to reconstruct the CFG U = 46
  • 47. Results with the union of two traces 47
  • 48. Time of extraction per trace 48
  • 49. Let me try by myself Release: Everything related to this analysis is available on github 9. 9 https://github.com/JonathanSalwan/Tigress protection 49
  • 51. VM Architecture Fetch Instruction Decode Instruction Dispatch Switch case Handler 1Handler 2 Handler 3 Terminator op0 op1 op2 op3 op4 51
  • 53. Goal Fetch Instruction Decode Instruction Dispatch Switch case Handler 1Handler 2 Handler 3 Terminator op0 op1 op2 op3 op4 53
  • 54. Goal Fetch Instruction Decode Instruction Dispatch Switch case Handler 1Handler 2 Handler 3 Terminator op0 op1 op2 op3 op4 Tim e out 54
  • 55. Goal Fetch Instruction Decode Instruction Dispatch Switch case Handler 1Handler 2 Handler 3 Terminator op0 op1 op2 op3 op4 Step 1 Step2 55
  • 56. Goal Decode BB2 BB3 BB4 Handler c1→2 and c2→4 (BB4 and c4→5) or (BB3 and c3→5) c1→2 c2→4 c3→5 c4→5 56
  • 58. Conclusion • Symbolic execution is powerful against obfuscations • Use mathematical complexity expressions against such attacks • The goal is to imply a timeout on SMT solvers side 58
  • 60. Acknowledgements • Thanks to Brendan Dolan-Gavitt for his invitation to the S.O.S workshop! • Kudos to Adrien Guinet for his Arybo 10 framework! 10 https://github.com/quarkslab/arybo 60
  • 61. Contact us • Romain Thomas • rthomas at quarkslab com • @rh0main • Jonathan Salwan • jsalwan at quarkslab com • @JonathanSalwan • Triton team • triton at quarkslab com • @qb triton • irc: #qb triton@freenode.org 61
  • 62. References I C. Collberg, S. Martin, J. Myers, and J. Nagra. Distributed application tamper detection via continuous software updates. In Proceedings of the 28th Annual Computer Security Applications Conference, ACSAC ’12, pages 319–328, New York, NY, USA, 2012. ACM. N. Eyrolles, A. Guinet, and M. Videau. Arybo: Manipulation, canonicalization and identification of mixed boolean-arithmetic symbolic expressions. GreHack, France, Grenoble, 2016. Y. Kanzaki, A. Monden, and C. Collberg. Code artificiality: A metric for the code stealth based on an n-gram model. In SPRO 2015 International Workshop on Software Protection, 2015. 62
  • 63. References II J. C. King. Symbolic execution and program testing. Communications of the ACM, 19(7):385–394, 1976. C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis and transformation. pages 75–88, San Jose, CA, USA, Mar 2004. 63
  • 64. References III F. Saudel and J. Salwan. Triton: A dynamic symbolic execution framework. In Symposium sur la s´ecurit´e des technologies de l’information et des communications, SSTIC, France, Rennes, June 3-5 2015, pages 31–54. SSTIC, 2015. K. Sen, D. Marinov, and G. Agha. Cute: a concolic unit testing engine for c. In ACM SIGSOFT Software Engineering Notes, volume 30, pages 263–272. ACM, 2005. 64