SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Downloaden Sie, um offline zu lesen
Bitblaze


    Alex Bazhanyuk, @Abazhanyuk


“RE” school, DefCon-UA, 2012
Motivation
●   Service
●   Kernel space: kernel, drivers
●   Mobile
●   Embedded
Goal
●   vulnerabilities
●   malware
What we have?
●   Taint analysis
●   Symbolic execution
●   Solver:stp, smt, z3
●   Data-flow analysis, special case for
    graph analysis
Theory of taint analysis
The one of the data tracing

Taint sources:
Network, Keyboard, Memory, Disk,
Function outputs
• Taint propagation: a data flow technique
Shadow memory
Whole-system
Across register/memory/disk/swapping
Fundamentals of taint
     analysis
Taint propagation
 •If an operation uses the value of some
 tainted object, say X, to derive a value
for another, say Y, then object Y becomes
  tainted. Object X tainted the object Y
            •Taint operator t
                •X→ t(Y)
       •Taint operator is transitive
   X → t(Y) and Y→ t(Z), then X→ t(Z)
Static Taint Analysis

Analysis performed over multiple paths
of a program
* Typically performed on a control flow
graph (CFG):
statements are nodes, and there is an
edge between nodes if there is a
possible transfer of control.
BitBlaze: Binary Analysis
         Infrastructure
Automatically extracting security-related properties from
binary code
Build a unified binary analysis platform for security
- Static analysis + Dynamic analysis + Symbolic Analysis
- Leverages recent advances in program analysis, formal
methods, binary instrumentation…
Solve security problems via binary analysis
• More than a dozen different security applications
• Over 25 research publications
BitBlaze

http://bitblaze.cs.berkeley.edu/
TEMU,VINE
Rudder, Panorama, Renovo
TEMU
Confines TEMU

Only gcc-3.4
Qemu 0.9.1 - TEMU




Qemu 0.10 - TCG(Tiny Code Generator)-
TODO
Qemu 0.10 =! Qemu 1.01
Create trace with the network service:

$sudo ./tracecap/temu -m 256 -net nic,vlan=0 -net tap,vlan=0,script=/etc/qemu-ifup -monitor stdio winxp.img

(qemu) load_plugin tracecap/tracecap.so

general/trace_only_after_first_taint is enabled.

general/log_external_calls is disabled.

general/write_ops_at_insn_end is enabled.

general/save_state_at_trace_stop is disabled.

tracing/tracing_table_lookup is enabled.

tracing/tracing_tainted_only is disabled.

tracing/tracing_single_thread_only is disabled.

tracing/tracing_kernel is disabled.

tracing/tracing_kernel_tainted is disabled.

tracing/tracing_kernel_partial is disabled.

network/ignore_dns is disabled.

Enabled: 0x00 Proto: 0x00 Sport: 0 Dport: 0 Src: 0.0.0.0 Dst: 0.0.0.0

Loading plugin options from: SRC_PATH/tracecap/ini/hook_plugin.ini

Loading plugins from: SRC_PATH/shared/hooks/hook_plugins

tracecap/tracecap.so is loaded successfully!

(qemu) enable_emulation

Emulation is now enabled

(qemu) taint_nic 1

(qemu) tracebyname "FileZilla_server.exe" /traces/file_zilla

(Посылаем данные по сети)

(qemu) Time of first tainted data: 1289487729.962905

(qemu) trace_stop
VINE
The Vine Intermediate Language
Example of disasm:
fc32dcec:    rep stos %eax,%es:(%edi)   R@eax[0x00000000][4](R) T0      R@ecx[0x00000002][4]
(RCW)     T0    M@0xfb7bfff8[0x00000000][4](CW) T1 {15 (1231, 69624) (1231, 69625) (1231,
69626) (1231, 69627) }



fc32dcec:    rep stos %eax,%es:(%edi)   R@eax[0x00000000][4](R) T0      R@ecx[0x00000001][4]
(RCW)     T0    M@0xfb7bfffc[0x00000000][4](CW) T1 {15 (1231, 69628) (1231, 69629) (1231, 69630)
(1231, 69631) }

fc32dcee:    mov    %edx,%ecx     R@edx[0x0000015c][4](R) T0     R@ecx[0x00000000][4](W) T0

fc32dcf0:    and   $0×3,%ecx     I@0×00000000[0x00000003][1](R) T0       R@ecx[0x0000015c][4]
(RW)      T0

fc32dcf5:  andl $0×0,-0×4(%ebp) I@0×00000000[0x00000000][1](R) T0
M@0xfb5ae738[0x00000002][4](RW) T0

fc32dcf9:   jmp    0x00000000fc32c726     J@0×00000000[0xffffea2d][4](R) T0

fc32c726:  cmpl $0×0,-0×58(%ebp) I@0×00000000[0x00000000][1](R) T0
M@0xfb5ae6e4[0x00000000][4](R) T0

fc32c72a:    je    0x00000000fc32c369    J@0×00000000[0xfffffc3f][4](R) T0

fc32c369:    mov    0xc(%ebp),%eax M@0xfb5ae748[0x81144e70][4](R) T0         R@eax[0x00000000]
[4](W) T0

fc32c36c:   xor    %edx,%edx     R@edx[0x0000015c][4](R) T0     R@edx[0x0000015c][4](RW)
T0
Taint
T0 - means that the statement did not tainted.
T1 - means that the instruction tainted in curly brackets can be seen
that there tainted and what it depends.
Here's an example of:
fc32dcec: rep stos% eax,% es: (% edi) R @ eax [0x00000000] [4] (R)
T0 R @ ecx [0x00000001] [4] (RCW) T0 M @ 0xfb7bfffc [0x00000000]
[4] (CW) T1 {15 (1231, 628) (1231, 629) (1231, 630) (1231, 631)}
One can see that 4 bits of information tainted and they depend on
the offset: 628, 629, 630, 631. 1231 - this number (name).
appreplay
./vine-1.0/trace_utils/appreplay -trace font.trace -ir-
out font.trace.il -assertion-on-var false-use-post-var
false
where:
appreplay - ocaml script that we run;
-trace - the way to the trace;
-ir-out - the path to which we write IL code.
-assertion-on-var false-use-post-var false - flags that
show the format of IL code for this to false makes it
more readable text.
var R_EBP_0:reg32_t;


Example of IL code:                                       var R_ESP_1:reg32_t;
                                                          var R_ESI_2:reg32_t;
                                                          var R_EDI_3:reg32_t;
                                                          var R_EIP_4:reg32_t;
                                                          var R_EAX_5:reg32_t;
                                                          var R_EBX_6:reg32_t;
Begins with the declaration of variables:                 var R_ECX_7:reg32_t;
                                                          var R_EDX_8:reg32_t;
INPUT - it's free memory cells, those that                var EFLAGS_9:reg32_t;
are tested in the very beginning (back in                 var R_CF_10:reg1_t;
temu), input into the program from an                     var R_PF_11:reg1_t;
external source.                                          var R_AF_12:reg1_t;
                                                          var R_ZF_13:reg1_t;
                                                          var R_SF_14:reg1_t;
                                                          var R_OF_15:reg1_t;
var cond_000017_0x4010ce_00_162:reg1_t;
                                                          var R_CC_OP_16:reg32_t;
                                                          var R_CC_DEP1_17:reg32_t;
                                                          var R_CC_DEP2_18:reg32_t;
var cond_000013_0x4010c3_00_161:reg1_t;
                                                          var R_CC_NDEP_19:reg32_t;
var cond_000012_0x4010c0_00_160:reg1_t;                   var R_DFLAG_20:reg32_t;
                                                          var R_IDFLAG_21:reg32_t;
var cond_000007_0x4010b6_00_159:reg1_t;
                                                          var R_ACFLAG_22:reg32_t;
var INPUT_10000_0000_62:reg8_t;                           var R_EMWARN_23:reg32_t;
                                                          var R_LDT_24:reg32_t;
var INPUT_10000_0001_63:reg8_t;
                                                          var R_GDT_25:reg32_t;
var INPUT_10000_0002_64:reg8_t;                           var R_CS_26:reg16_t;
var INPUT_10000_0003_65:reg8_t;                           var R_DS_27:reg16_t;
                                                          var R_ES_28:reg16_t;
var mem_arr_57:reg8_t[4294967296]; – memory as an array   var R_FS_29:reg16_t;
var mem_35:mem32l_t;                                      var R_GS_30:reg16_t;
                                                          var R_SS_31:reg16_t;
                                                          var R_FTOP_32:reg32_t;
label pc_0x40143c_1: –is the name of which is the address of instruction

/*Filter IRs:*/                                                            And the filter itself changes.
Now comes the filter initialization:
                                                                           /*ASM IR:*/

                                                                           {
{
                                                                           var T_32t0_58:reg32_t;
/*Initializers*/                                                           var T_32t1_59:reg32_t;
                                                                           var T_32t2_60:reg32_t;
                                                                           var T_32t3_61:reg32_t;
R_EAX_5:reg32_t = 0×73657930:reg32_t;                                      T_32t2_60:reg32_t = R_ESP_1:reg32_t;
{
                                                                           T_32t1_59:reg32_t = T_32t2_60:reg32_t + 0x1c8:reg32_t;
                                                                           T_32t3_61:reg32_t =
var idx_144:reg32_t;                                                       (
var val_143:reg8_t;
                                                                           (
                                                                           cast(mem_arr_57[T_32t1_59:reg32_t +
idx_144:reg32_t = 0x12fef0:reg32_t;                                              0:reg32_t]:reg8_t)U:reg32_t
val_143:reg8_t = INPUT_10000_0000_62:reg8_t;                               << 0:reg32_t
                                                                           |
mem_arr_57[idx_144:reg32_t + 0:reg32_t]:reg8_t =
                                                                           cast(mem_arr_57[T_32t1_59:reg32_t +
cast((val_143:reg8_t & 0xff:reg8_t) >> 0:reg8_t)L:reg8_t;                        1:reg32_t]:reg8_t)U:reg32_t
                                                                           << 8:reg32_t
                                                                           )
}                                                                          |
                                                                           cast(mem_arr_57[T_32t1_59:reg32_t +
{
                                                                                 2:reg32_t]:reg8_t)U:reg32_t
var idx_146:reg32_t;                                                       << 0×10:reg32_t
                                                                           )
var val_145:reg8_t;
                                                                           |
idx_146:reg32_t = 0x12fef1:reg32_t;                                        cast(mem_arr_57[T_32t1_59:reg32_t +
val_145:reg8_t = INPUT_10000_0001_63:reg8_t;
                                                                                 3:reg32_t]:reg8_t)U:reg32_t
                                                                           << 0×18:reg32_t
mem_arr_57[idx_146:reg32_t + 0:reg32_t]:reg8_t =                           ;
cast((val_145:reg8_t & 0xff:reg8_t) >> 0:reg8_t)L:reg8_t;
                                                                           R_EAX_5:reg32_t = T_32t3_61:reg32_t;

                                                                           }
}
Weakest precondition
    Vine:
●   CFG → DPG(DDG) → GCL → (WP form)
    DPG - Program-Dependence Graphs
    DDG - Data-Dependence Graphs
    GCL - Guarded Command Language
    WP(S,R) – S is formula, R is condition.
What is STP and what it
             does?
STP - a solver for bit-vector expressions.
This is a separate project independent of the

http://sites.google.com/site/stpfastprover/bitblaze
To produce STP code from IL code:
./vine-1.0/utils/wputil trace.il -stpout stp.code
where the input is IL code, and the output is
STP code.
STP program example
bv : BITVECTOR(10);
a : BOOLEAN;
QUERY(
0bin01100000[5:3]=(0bin1111001@bv[0:0])[4:2]
AND
0bin1@(IF a THEN 0bin0 ELSE 0bin1 ENDIF)=(IF a
THEN 0bin110 ELSE 0bin011 ENDIF)[1:0]
);
STP Example code:

Begin with the declaration of variables:



R_EBX_6_16 : BITVECTOR(32);

INPUT_10000_0003_65_7 : BITVECTOR(8);

INPUT_10000_0002_64_6 : BITVECTOR(8);

INPUT_10000_0001_63_5 : BITVECTOR(8);

mem_arr_57_8 : ARRAY BITVECTOR(64) OF BITVECTOR(8);

INPUT_10000_0000_62_4 : BITVECTOR(8);

% end free variables.

The very expression of the form question (assert)

ASSERT( 0bin1 =

(LET R_EAX_5_232 =

0hex73657930

IN

(LET idx_144_233 =

0hex0012fef0

IN

(LET val_143_234 =

INPUT_10000_0000_62_4

IN

(LET mem_arr_57_393 =

(mem_arr_57_8 WITH [(0bin00000000000000000000000000000000 @ BVPLUS(32, idx_144_233,0hex00000000))] := (val_143_234;0hexff)[7:0])

…….

IN

(cond_000017_0x4010ce_00_162_392;0bin1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));

It's a question:

This expression is not true?

QUERY (FALSE);

And to give a counter example:

COUNTEREXAMPLE;
STP example
How to ask for a decision at STP:


./stp stp.code
Example of STP output:
ASSERT( INPUT_10000_0001_63_5 = 0×00 );
ASSERT( INPUT_10000_0002_64_6 = 0×00 );
ASSERT( INPUT_10000_0000_62_4 = 0×61 );
ASSERT( INPUT_10000_0003_65_7 = 0×00 );
Invalid.
Solver
●   SeL4
●   Hash: md5, …
●   Physics
Diagram from basic method
input
 data           software

                    TEMU

                           Trace, alloc-file, state

                                                 appreplay
                                      Trace
                                                               IL
                                                               code
                   Vine

                                                      wputil
input               stp                Stp
data
                                       code
SASV Components:
Temu (tracecap: start/stop tracing. Various additions to tracecap(hooks etc.))
Vine (appreplay, wputil)


STP


IDA plugins:
- DangerFunctions – finds calls to malloc,strcpy,memcpy etc.
- IndirectCalls – indirect jumps, indirect calls.
- ida2sql (zynamics) –idb in the mysql db. (http://blog.zynamics.com/2010/06/29/ida2sql-exporting-ida-
databases-to-mysql/)


Iterators – wrapper for temu, vine, stp.
Various publishers – for DeviceIoControl etc.
How does SASV work?
SASV

Pattern:




Min Goal: 100% coverage of the danger code

Max Goal: 100% coverage of the all code
SASV basic algorithm
1.   Work of IDA plugins -> danger places
2.   Publisher -> invoke analyzing code
3.   TEMU -> trace
4.   Trace -> appreplay -> IL
5.   IL -> change path algo -> IL’
6.   IL’ -> wputil -> STP_prorgam’
7.   STP_prorgam’ -> STP -> data for n+1
     iteration
8.   Goto #2
Diagram for new path in graph
input
 data         software

                  TEMU

                         Trace, alloc-file, state
                                                             IL
                                               appreplay     code
  Next
  Iteration                         Trace
                                                             Changer,
                                                             symbolic
                 Vine                                        execution

                                                    wputil
New                                                           IL’
input             stp                Stp’                     code
data                                 code
Complex system

               1)

input data                  New input data
                                              Blackbox
                     SASV
                                               fuzzer

               2)

                               input data                   New input
Set of input
data                Coverage
                                                     data               Blackbox
                                              SASV
                                                                         fuzzer

               3)


                                Set of                   New input
input data                      new
                     SASV
                                                     data               Blackbox
                                input        Coverage
                                data                                     fuzzer
Diagram from basic method
input
 data           software

                    TEMU

                           Trace, alloc-file, state

                                                 appreplay
                                      Trace
                                                               IL
                                                               code
                   Vine

                                                      wputil
input               stp                Stp
data
                                       code
Bitblaze vs blackbox-fuzzer
                Optipng
                                               1 byte change:
PNG format file:
                                               PNG format file:
- 7309 iterations. Unique addresses:           - initial set: 3654
                                               - time for one iteration: 10 sec
12313. Time: 73:32 hours. Coverage:            - number of iterations: 43200
                                               GIF format file:
36.27%.
                                               - initial set: 8442
- size first input data: 2.3Kb.                - time for one iteration: 3 sec
                                               - number of iterations: 86400
BMP format file:                               BMP format file:
                                               - initial set: 2368
- 2368 iterations. Unique addresses:
                                               - time for one iteration: 3 sec
9620. Time: 12:35 hours. Coverage:             - number of iterations: 86400
                                               2 byte change:
28.34%.                                        PNG format file:
                                               - initial set: 3654
- size first input data: 1.1Kb.
                                               - time for one iteration: 10 sec
GIF format file:                               - number of iterations: 86400
                                               GIF format file:
- 16884 iterations. Unique addresses:          - initial set: 8442
                                               - time for one iteration: 3 sec
10361. Time: 112:21 hours. Coverage:
                                               - number of iterations: 172800
30.52%.                                        BMP format file:
                                               - initial set: 2368
- size first input data: 0.9Kb, 2.3Kb, 15Kb.   - time for one iteration: 3 sec
                                               - number of iterations: 172800
Result
Blackbox-fuzzer – 1
Bitblaze – 0



Blackbox-fuzzer + BitBlaze = 3
CFG
Call graph
Disadvantages
The target of vulnerability is difficult question.
Performance – speed of tracing in TEMU is
AWFUL
Get rid of that damned
            QEMU!

Move taint propagation to Hypervisor!


Damn good idea!


But a lot of code to port/rewrite
S2E
●   Symbolic execution
●
    Architecture Hypothesis for S²E Android support
BAP
●   Dynamic: PIN-tools
●   Static: llvm
S2E + SASV

       S2E=Qemu+Klee
        Klee=LLVM+Stp


Input data => taint analysis (new
            concept)
          Support Arm
      Support Qemu 0.12
LLVM

LLVM ELLCC - The Embedded LLVM
Compiler Collection
Data-flow analysis
Integrity graph
Data Flow Analysis Schema
State machine
Thanks :)




virvdova@gmail.com

Weitere ähnliche Inhalte

Was ist angesagt?

[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus AnalysisGangSeok Lee
 
The Ring programming language version 1.5.1 book - Part 77 of 180
The Ring programming language version 1.5.1 book - Part 77 of 180The Ring programming language version 1.5.1 book - Part 77 of 180
The Ring programming language version 1.5.1 book - Part 77 of 180Mahmoud Samir Fayed
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)jon_bell
 
Splint the C code static checker
Splint the C code static checkerSplint the C code static checker
Splint the C code static checkerUlisses Costa
 
Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)ujihisa
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言Simen Li
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1Little Tukta Lita
 
Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Andrey Karpov
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisaujihisa
 
ROP 輕鬆談
ROP 輕鬆談ROP 輕鬆談
ROP 輕鬆談hackstuff
 
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack FirmwareSimen Li
 
Zend VMにおける例外の実装
Zend VMにおける例外の実装Zend VMにおける例外の実装
Zend VMにおける例外の実装Yoshio Hanawa
 
Rechecking Apache HTTP Server
Rechecking Apache HTTP ServerRechecking Apache HTTP Server
Rechecking Apache HTTP ServerPVS-Studio
 
Checking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static AnalyzerChecking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static AnalyzerAndrey Karpov
 
The Ring programming language version 1.2 book - Part 58 of 84
The Ring programming language version 1.2 book - Part 58 of 84The Ring programming language version 1.2 book - Part 58 of 84
The Ring programming language version 1.2 book - Part 58 of 84Mahmoud Samir Fayed
 
Happy To Use SIMD
Happy To Use SIMDHappy To Use SIMD
Happy To Use SIMDWei-Ta Wang
 
StackOverflow
StackOverflowStackOverflow
StackOverflowSusam Pal
 

Was ist angesagt? (20)

[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
 
The Ring programming language version 1.5.1 book - Part 77 of 180
The Ring programming language version 1.5.1 book - Part 77 of 180The Ring programming language version 1.5.1 book - Part 77 of 180
The Ring programming language version 1.5.1 book - Part 77 of 180
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
 
Splint the C code static checker
Splint the C code static checkerSplint the C code static checker
Splint the C code static checker
 
Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
 
Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2Checking Oracle VM VirtualBox. Part 2
Checking Oracle VM VirtualBox. Part 2
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 
ROP 輕鬆談
ROP 輕鬆談ROP 輕鬆談
ROP 輕鬆談
 
Michael kontopoulo1s
Michael kontopoulo1sMichael kontopoulo1s
Michael kontopoulo1s
 
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware
[ZigBee 嵌入式系統] ZigBee 應用實作 - 使用 TI Z-Stack Firmware
 
Zend VMにおける例外の実装
Zend VMにおける例外の実装Zend VMにおける例外の実装
Zend VMにおける例外の実装
 
Rechecking Apache HTTP Server
Rechecking Apache HTTP ServerRechecking Apache HTTP Server
Rechecking Apache HTTP Server
 
Checking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static AnalyzerChecking Wine with PVS-Studio and Clang Static Analyzer
Checking Wine with PVS-Studio and Clang Static Analyzer
 
The Ring programming language version 1.2 book - Part 58 of 84
The Ring programming language version 1.2 book - Part 58 of 84The Ring programming language version 1.2 book - Part 58 of 84
The Ring programming language version 1.2 book - Part 58 of 84
 
Message in a bottle
Message in a bottleMessage in a bottle
Message in a bottle
 
Happy To Use SIMD
Happy To Use SIMDHappy To Use SIMD
Happy To Use SIMD
 
OpenBot-Code
OpenBot-CodeOpenBot-Code
OpenBot-Code
 
StackOverflow
StackOverflowStackOverflow
StackOverflow
 

Ähnlich wie 4

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
 
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析Mr. Vengineer
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaJuan Fumero
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisitionazhar557
 
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizationsEgor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizationsEgor Bogatov
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework HelpC++ Homework Help
 
망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15종인 전
 
Lathe Spindle Sensor
Lathe Spindle SensorLathe Spindle Sensor
Lathe Spindle SensorJoeCritt
 
l. read Data This function is to read the input and store it into th.pdf
l. read Data This function is to read the input and store it into th.pdfl. read Data This function is to read the input and store it into th.pdf
l. read Data This function is to read the input and store it into th.pdffabmallkochi
 
Kernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry code
Kernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry codeKernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry code
Kernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry codeAnne Nicolas
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler DevelopmentLogan Chien
 
Linuxカーネルを読んで改めて知るプロセスとスレッドの違い
Linuxカーネルを読んで改めて知るプロセスとスレッドの違いLinuxカーネルを読んで改めて知るプロセスとスレッドの違い
Linuxカーネルを読んで改めて知るプロセスとスレッドの違いRetrieva inc.
 
Laboratory Report Sample
Laboratory Report SampleLaboratory Report Sample
Laboratory Report SampleMarkus Flicke
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersMarina Kolpakova
 

Ähnlich wie 4 (20)

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...
 
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
 
ARM instruction set
ARM instruction  setARM instruction  set
ARM instruction set
 
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizationsEgor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
 
A Close Look at ARM Code Size
A Close Look at ARM Code SizeA Close Look at ARM Code Size
A Close Look at ARM Code Size
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework Help
 
망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15
 
Slides13.pdf
Slides13.pdfSlides13.pdf
Slides13.pdf
 
Lathe Spindle Sensor
Lathe Spindle SensorLathe Spindle Sensor
Lathe Spindle Sensor
 
l. read Data This function is to read the input and store it into th.pdf
l. read Data This function is to read the input and store it into th.pdfl. read Data This function is to read the input and store it into th.pdf
l. read Data This function is to read the input and store it into th.pdf
 
Kernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry code
Kernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry codeKernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry code
Kernel Recipes 2016 - entry_*.S: A carefree stroll through kernel entry code
 
Php engine
Php enginePhp engine
Php engine
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
Lampiran 1.programdocx
Lampiran 1.programdocxLampiran 1.programdocx
Lampiran 1.programdocx
 
Linuxカーネルを読んで改めて知るプロセスとスレッドの違い
Linuxカーネルを読んで改めて知るプロセスとスレッドの違いLinuxカーネルを読んで改めて知るプロセスとスレッドの違い
Linuxカーネルを読んで改めて知るプロセスとスレッドの違い
 
Laboratory Report Sample
Laboratory Report SampleLaboratory Report Sample
Laboratory Report Sample
 
Ddhdl 17
Ddhdl 17Ddhdl 17
Ddhdl 17
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
 

Kürzlich hochgeladen

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Kürzlich hochgeladen (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 

4

  • 1. Bitblaze Alex Bazhanyuk, @Abazhanyuk “RE” school, DefCon-UA, 2012
  • 2. Motivation ● Service ● Kernel space: kernel, drivers ● Mobile ● Embedded
  • 3. Goal ● vulnerabilities ● malware
  • 4. What we have? ● Taint analysis ● Symbolic execution ● Solver:stp, smt, z3 ● Data-flow analysis, special case for graph analysis
  • 5. Theory of taint analysis
  • 6. The one of the data tracing Taint sources: Network, Keyboard, Memory, Disk, Function outputs • Taint propagation: a data flow technique Shadow memory Whole-system Across register/memory/disk/swapping
  • 8. Taint propagation •If an operation uses the value of some tainted object, say X, to derive a value for another, say Y, then object Y becomes tainted. Object X tainted the object Y •Taint operator t •X→ t(Y) •Taint operator is transitive X → t(Y) and Y→ t(Z), then X→ t(Z)
  • 9. Static Taint Analysis Analysis performed over multiple paths of a program * Typically performed on a control flow graph (CFG): statements are nodes, and there is an edge between nodes if there is a possible transfer of control.
  • 10.
  • 11.
  • 12. BitBlaze: Binary Analysis Infrastructure Automatically extracting security-related properties from binary code Build a unified binary analysis platform for security - Static analysis + Dynamic analysis + Symbolic Analysis - Leverages recent advances in program analysis, formal methods, binary instrumentation… Solve security problems via binary analysis • More than a dozen different security applications • Over 25 research publications
  • 14. TEMU
  • 15. Confines TEMU Only gcc-3.4 Qemu 0.9.1 - TEMU Qemu 0.10 - TCG(Tiny Code Generator)- TODO Qemu 0.10 =! Qemu 1.01
  • 16. Create trace with the network service: $sudo ./tracecap/temu -m 256 -net nic,vlan=0 -net tap,vlan=0,script=/etc/qemu-ifup -monitor stdio winxp.img (qemu) load_plugin tracecap/tracecap.so general/trace_only_after_first_taint is enabled. general/log_external_calls is disabled. general/write_ops_at_insn_end is enabled. general/save_state_at_trace_stop is disabled. tracing/tracing_table_lookup is enabled. tracing/tracing_tainted_only is disabled. tracing/tracing_single_thread_only is disabled. tracing/tracing_kernel is disabled. tracing/tracing_kernel_tainted is disabled. tracing/tracing_kernel_partial is disabled. network/ignore_dns is disabled. Enabled: 0x00 Proto: 0x00 Sport: 0 Dport: 0 Src: 0.0.0.0 Dst: 0.0.0.0 Loading plugin options from: SRC_PATH/tracecap/ini/hook_plugin.ini Loading plugins from: SRC_PATH/shared/hooks/hook_plugins tracecap/tracecap.so is loaded successfully! (qemu) enable_emulation Emulation is now enabled (qemu) taint_nic 1 (qemu) tracebyname "FileZilla_server.exe" /traces/file_zilla (Посылаем данные по сети) (qemu) Time of first tainted data: 1289487729.962905 (qemu) trace_stop
  • 17. VINE
  • 19. Example of disasm: fc32dcec: rep stos %eax,%es:(%edi) R@eax[0x00000000][4](R) T0 R@ecx[0x00000002][4] (RCW) T0 M@0xfb7bfff8[0x00000000][4](CW) T1 {15 (1231, 69624) (1231, 69625) (1231, 69626) (1231, 69627) } fc32dcec: rep stos %eax,%es:(%edi) R@eax[0x00000000][4](R) T0 R@ecx[0x00000001][4] (RCW) T0 M@0xfb7bfffc[0x00000000][4](CW) T1 {15 (1231, 69628) (1231, 69629) (1231, 69630) (1231, 69631) } fc32dcee: mov %edx,%ecx R@edx[0x0000015c][4](R) T0 R@ecx[0x00000000][4](W) T0 fc32dcf0: and $0×3,%ecx I@0×00000000[0x00000003][1](R) T0 R@ecx[0x0000015c][4] (RW) T0 fc32dcf5: andl $0×0,-0×4(%ebp) I@0×00000000[0x00000000][1](R) T0 M@0xfb5ae738[0x00000002][4](RW) T0 fc32dcf9: jmp 0x00000000fc32c726 J@0×00000000[0xffffea2d][4](R) T0 fc32c726: cmpl $0×0,-0×58(%ebp) I@0×00000000[0x00000000][1](R) T0 M@0xfb5ae6e4[0x00000000][4](R) T0 fc32c72a: je 0x00000000fc32c369 J@0×00000000[0xfffffc3f][4](R) T0 fc32c369: mov 0xc(%ebp),%eax M@0xfb5ae748[0x81144e70][4](R) T0 R@eax[0x00000000] [4](W) T0 fc32c36c: xor %edx,%edx R@edx[0x0000015c][4](R) T0 R@edx[0x0000015c][4](RW) T0
  • 20. Taint T0 - means that the statement did not tainted. T1 - means that the instruction tainted in curly brackets can be seen that there tainted and what it depends. Here's an example of: fc32dcec: rep stos% eax,% es: (% edi) R @ eax [0x00000000] [4] (R) T0 R @ ecx [0x00000001] [4] (RCW) T0 M @ 0xfb7bfffc [0x00000000] [4] (CW) T1 {15 (1231, 628) (1231, 629) (1231, 630) (1231, 631)} One can see that 4 bits of information tainted and they depend on the offset: 628, 629, 630, 631. 1231 - this number (name).
  • 21. appreplay ./vine-1.0/trace_utils/appreplay -trace font.trace -ir- out font.trace.il -assertion-on-var false-use-post-var false where: appreplay - ocaml script that we run; -trace - the way to the trace; -ir-out - the path to which we write IL code. -assertion-on-var false-use-post-var false - flags that show the format of IL code for this to false makes it more readable text.
  • 22. var R_EBP_0:reg32_t; Example of IL code: var R_ESP_1:reg32_t; var R_ESI_2:reg32_t; var R_EDI_3:reg32_t; var R_EIP_4:reg32_t; var R_EAX_5:reg32_t; var R_EBX_6:reg32_t; Begins with the declaration of variables: var R_ECX_7:reg32_t; var R_EDX_8:reg32_t; INPUT - it's free memory cells, those that var EFLAGS_9:reg32_t; are tested in the very beginning (back in var R_CF_10:reg1_t; temu), input into the program from an var R_PF_11:reg1_t; external source. var R_AF_12:reg1_t; var R_ZF_13:reg1_t; var R_SF_14:reg1_t; var R_OF_15:reg1_t; var cond_000017_0x4010ce_00_162:reg1_t; var R_CC_OP_16:reg32_t; var R_CC_DEP1_17:reg32_t; var R_CC_DEP2_18:reg32_t; var cond_000013_0x4010c3_00_161:reg1_t; var R_CC_NDEP_19:reg32_t; var cond_000012_0x4010c0_00_160:reg1_t; var R_DFLAG_20:reg32_t; var R_IDFLAG_21:reg32_t; var cond_000007_0x4010b6_00_159:reg1_t; var R_ACFLAG_22:reg32_t; var INPUT_10000_0000_62:reg8_t; var R_EMWARN_23:reg32_t; var R_LDT_24:reg32_t; var INPUT_10000_0001_63:reg8_t; var R_GDT_25:reg32_t; var INPUT_10000_0002_64:reg8_t; var R_CS_26:reg16_t; var INPUT_10000_0003_65:reg8_t; var R_DS_27:reg16_t; var R_ES_28:reg16_t; var mem_arr_57:reg8_t[4294967296]; – memory as an array var R_FS_29:reg16_t; var mem_35:mem32l_t; var R_GS_30:reg16_t; var R_SS_31:reg16_t; var R_FTOP_32:reg32_t;
  • 23. label pc_0x40143c_1: –is the name of which is the address of instruction /*Filter IRs:*/ And the filter itself changes. Now comes the filter initialization: /*ASM IR:*/ { { var T_32t0_58:reg32_t; /*Initializers*/ var T_32t1_59:reg32_t; var T_32t2_60:reg32_t; var T_32t3_61:reg32_t; R_EAX_5:reg32_t = 0×73657930:reg32_t; T_32t2_60:reg32_t = R_ESP_1:reg32_t; { T_32t1_59:reg32_t = T_32t2_60:reg32_t + 0x1c8:reg32_t; T_32t3_61:reg32_t = var idx_144:reg32_t; ( var val_143:reg8_t; ( cast(mem_arr_57[T_32t1_59:reg32_t + idx_144:reg32_t = 0x12fef0:reg32_t; 0:reg32_t]:reg8_t)U:reg32_t val_143:reg8_t = INPUT_10000_0000_62:reg8_t; << 0:reg32_t | mem_arr_57[idx_144:reg32_t + 0:reg32_t]:reg8_t = cast(mem_arr_57[T_32t1_59:reg32_t + cast((val_143:reg8_t & 0xff:reg8_t) >> 0:reg8_t)L:reg8_t; 1:reg32_t]:reg8_t)U:reg32_t << 8:reg32_t ) } | cast(mem_arr_57[T_32t1_59:reg32_t + { 2:reg32_t]:reg8_t)U:reg32_t var idx_146:reg32_t; << 0×10:reg32_t ) var val_145:reg8_t; | idx_146:reg32_t = 0x12fef1:reg32_t; cast(mem_arr_57[T_32t1_59:reg32_t + val_145:reg8_t = INPUT_10000_0001_63:reg8_t; 3:reg32_t]:reg8_t)U:reg32_t << 0×18:reg32_t mem_arr_57[idx_146:reg32_t + 0:reg32_t]:reg8_t = ; cast((val_145:reg8_t & 0xff:reg8_t) >> 0:reg8_t)L:reg8_t; R_EAX_5:reg32_t = T_32t3_61:reg32_t; } }
  • 24. Weakest precondition Vine: ● CFG → DPG(DDG) → GCL → (WP form) DPG - Program-Dependence Graphs DDG - Data-Dependence Graphs GCL - Guarded Command Language WP(S,R) – S is formula, R is condition.
  • 25.
  • 26. What is STP and what it does? STP - a solver for bit-vector expressions. This is a separate project independent of the http://sites.google.com/site/stpfastprover/bitblaze To produce STP code from IL code: ./vine-1.0/utils/wputil trace.il -stpout stp.code where the input is IL code, and the output is STP code.
  • 27. STP program example bv : BITVECTOR(10); a : BOOLEAN; QUERY( 0bin01100000[5:3]=(0bin1111001@bv[0:0])[4:2] AND 0bin1@(IF a THEN 0bin0 ELSE 0bin1 ENDIF)=(IF a THEN 0bin110 ELSE 0bin011 ENDIF)[1:0] );
  • 28. STP Example code: Begin with the declaration of variables: R_EBX_6_16 : BITVECTOR(32); INPUT_10000_0003_65_7 : BITVECTOR(8); INPUT_10000_0002_64_6 : BITVECTOR(8); INPUT_10000_0001_63_5 : BITVECTOR(8); mem_arr_57_8 : ARRAY BITVECTOR(64) OF BITVECTOR(8); INPUT_10000_0000_62_4 : BITVECTOR(8); % end free variables. The very expression of the form question (assert) ASSERT( 0bin1 = (LET R_EAX_5_232 = 0hex73657930 IN (LET idx_144_233 = 0hex0012fef0 IN (LET val_143_234 = INPUT_10000_0000_62_4 IN (LET mem_arr_57_393 = (mem_arr_57_8 WITH [(0bin00000000000000000000000000000000 @ BVPLUS(32, idx_144_233,0hex00000000))] := (val_143_234;0hexff)[7:0]) ……. IN (cond_000017_0x4010ce_00_162_392;0bin1)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); It's a question: This expression is not true? QUERY (FALSE); And to give a counter example: COUNTEREXAMPLE;
  • 29. STP example How to ask for a decision at STP: ./stp stp.code Example of STP output: ASSERT( INPUT_10000_0001_63_5 = 0×00 ); ASSERT( INPUT_10000_0002_64_6 = 0×00 ); ASSERT( INPUT_10000_0000_62_4 = 0×61 ); ASSERT( INPUT_10000_0003_65_7 = 0×00 ); Invalid.
  • 30. Solver ● SeL4 ● Hash: md5, … ● Physics
  • 31. Diagram from basic method input data software TEMU Trace, alloc-file, state appreplay Trace IL code Vine wputil input stp Stp data code
  • 32. SASV Components: Temu (tracecap: start/stop tracing. Various additions to tracecap(hooks etc.)) Vine (appreplay, wputil) STP IDA plugins: - DangerFunctions – finds calls to malloc,strcpy,memcpy etc. - IndirectCalls – indirect jumps, indirect calls. - ida2sql (zynamics) –idb in the mysql db. (http://blog.zynamics.com/2010/06/29/ida2sql-exporting-ida- databases-to-mysql/) Iterators – wrapper for temu, vine, stp. Various publishers – for DeviceIoControl etc.
  • 33. How does SASV work?
  • 34. SASV Pattern: Min Goal: 100% coverage of the danger code Max Goal: 100% coverage of the all code
  • 35. SASV basic algorithm 1. Work of IDA plugins -> danger places 2. Publisher -> invoke analyzing code 3. TEMU -> trace 4. Trace -> appreplay -> IL 5. IL -> change path algo -> IL’ 6. IL’ -> wputil -> STP_prorgam’ 7. STP_prorgam’ -> STP -> data for n+1 iteration 8. Goto #2
  • 36. Diagram for new path in graph input data software TEMU Trace, alloc-file, state IL appreplay code Next Iteration Trace Changer, symbolic Vine execution wputil New IL’ input stp Stp’ code data code
  • 37. Complex system 1) input data New input data Blackbox SASV fuzzer 2) input data New input Set of input data Coverage data Blackbox SASV fuzzer 3) Set of New input input data new SASV data Blackbox input Coverage data fuzzer
  • 38. Diagram from basic method input data software TEMU Trace, alloc-file, state appreplay Trace IL code Vine wputil input stp Stp data code
  • 39. Bitblaze vs blackbox-fuzzer Optipng 1 byte change: PNG format file: PNG format file: - 7309 iterations. Unique addresses: - initial set: 3654 - time for one iteration: 10 sec 12313. Time: 73:32 hours. Coverage: - number of iterations: 43200 GIF format file: 36.27%. - initial set: 8442 - size first input data: 2.3Kb. - time for one iteration: 3 sec - number of iterations: 86400 BMP format file: BMP format file: - initial set: 2368 - 2368 iterations. Unique addresses: - time for one iteration: 3 sec 9620. Time: 12:35 hours. Coverage: - number of iterations: 86400 2 byte change: 28.34%. PNG format file: - initial set: 3654 - size first input data: 1.1Kb. - time for one iteration: 10 sec GIF format file: - number of iterations: 86400 GIF format file: - 16884 iterations. Unique addresses: - initial set: 8442 - time for one iteration: 3 sec 10361. Time: 112:21 hours. Coverage: - number of iterations: 172800 30.52%. BMP format file: - initial set: 2368 - size first input data: 0.9Kb, 2.3Kb, 15Kb. - time for one iteration: 3 sec - number of iterations: 172800
  • 40. Result Blackbox-fuzzer – 1 Bitblaze – 0 Blackbox-fuzzer + BitBlaze = 3
  • 41. CFG
  • 43. Disadvantages The target of vulnerability is difficult question. Performance – speed of tracing in TEMU is AWFUL
  • 44.
  • 45. Get rid of that damned QEMU! Move taint propagation to Hypervisor! Damn good idea! But a lot of code to port/rewrite
  • 46. S2E ● Symbolic execution ● Architecture Hypothesis for S²E Android support
  • 47. BAP ● Dynamic: PIN-tools ● Static: llvm
  • 48. S2E + SASV S2E=Qemu+Klee Klee=LLVM+Stp Input data => taint analysis (new concept) Support Arm Support Qemu 0.12
  • 49. LLVM LLVM ELLCC - The Embedded LLVM Compiler Collection