SMT in reverse engineering, for dummies Carl Svensson September 4, - - PowerPoint PPT Presentation

smt in reverse engineering for dummies
SMART_READER_LITE
LIVE PREVIEW

SMT in reverse engineering, for dummies Carl Svensson September 4, - - PowerPoint PPT Presentation

SMT in reverse engineering, for dummies Carl Svensson September 4, 2016 SEC-T 2016 About me Carl Svensson, 25 MSc in Computer Science, KTH IT Security consultant, Bitsec AB CTF-player, HackingForSoju


slide-1
SLIDE 1

SMT in reverse engineering, for dummies

Carl Svensson September 4, 2016

SEC-T 2016

slide-2
SLIDE 2

About me

∙ Carl Svensson, 25 ∙ MSc in Computer Science, KTH ∙ IT Security consultant, Bitsec AB ∙ CTF-player, HackingForSoju ∙  calle.svensson@zeta-two.com ∙  @zetatwo ∙  https://zeta-two.com

1

slide-3
SLIDE 3

Reverse engineering in 15 seconds?

∙ Take stuff, e.g. software, apart ∙ Understand how it works ∙ Many possible goals

∙ How can I reach a specific state?

2

slide-4
SLIDE 4

What is SMT?

∙ Satisfiability modulo theories, SMT ∙ A bunch of variables ∙ A bunch of theories

∙ Theory = A bunch of rules

∙ A bunch of formulas ∙ Can we find values for all values s.t. all formulas are satisifed?

3

slide-5
SLIDE 5

SMT: Example 1

x + 13 = 37

4

slide-6
SLIDE 6

SMT: Example 2

x + y + 13 = 37 − z x − 2 · y + 10 = 10 · z 4 · x − z + 13 = 37 + y

5

slide-7
SLIDE 7

SMT: Example 3

6

slide-8
SLIDE 8

Microsoft to the rescue

∙ Can we automate? Yes! ∙ Microsoft Research ∙ Z3 Theorem Prover

∙ General purpose ∙ Own language ∙ Bindings for several languages ∙ Open source & cross platform

7

slide-9
SLIDE 9

Using Z3 in RE

Throwback Thursday: Starcraft

8

slide-10
SLIDE 10

Throwback Thursday: Starcraft

∙ Commercial software ∙ Released in 1998

∙ Simple protections ∙ Good starting point

∙ Requires a serial key ∙ Can we create our own?

9

slide-11
SLIDE 11

Getting to the core: Installer

10

slide-12
SLIDE 12

Getting to the core: Serial key input

11

slide-13
SLIDE 13

Getting to the core: Resource strings

12

slide-14
SLIDE 14

Getting to the core: Decompilation

13

slide-15
SLIDE 15

Getting to the core: Call graph

14

slide-16
SLIDE 16

Getting to the core: Call graph

15

slide-17
SLIDE 17

Getting to the core: Decompilation

16

slide-18
SLIDE 18

Z3: Formulating formulas

17

slide-19
SLIDE 19

Z3: Formulating formulas

18

slide-20
SLIDE 20

Once again, with fee... angr

∙ ”python framework for analyzing binaries” ∙ ”both static and dynamic symbolic (concolic)” ∙ Computer Security Lab at UC Santa Barbara ∙ Uses Z3 internally

19

slide-21
SLIDE 21

Angr management: Extracting the code

20

slide-22
SLIDE 22

Angr management: Minimizing the code

21

slide-23
SLIDE 23

Angr management: Writing the explorer

22

slide-24
SLIDE 24

Thanks for listening!

23