how to grow a tree from cbass
play

How to Grow a TREE from CBASS Interactive Binary Analysis for - PowerPoint PPT Presentation

How to Grow a TREE from CBASS Interactive Binary Analysis for Security Professionals Lixin (Nathan) Li, Xing Li, Loc Nguyen, James E. Just Outline Background Interactive Binary Analysis with TREE and CBASS Demonstrations


  1. How to Grow a TREE from CBASS Interactive Binary Analysis for Security Professionals Lixin (Nathan) Li, Xing Li, Loc Nguyen, James E. Just

  2. Outline • Background • Interactive Binary Analysis with TREE and CBASS • Demonstrations • Conclusions

  3. Interactive Binary Analysis • Automated binary analyses useful for certain tasks (e.g., finding crashes) • Many binary analyses can’t be automated • Expert experience and heuristics are still key to binary analyses

  4. Benefits of Interactive Binary Analysis • Applicable to many security problems • Our tools increase productivity in: – Finding vulnerabilities – Analyzing root causes – Exploitability and risk assessment

  5. Interactive Analysis Like Connecting Dots What’s in the dots?

  6. Our Tools are Designed to Help Explore Connect Fix the the Dots New Dots Dots

  7. What Do Our Tools Do? Connect Explore Fix the the Dots New Dots Dots TREE CBASS Replay & Taint Analysis Symbolic Execution Cross-platform Binary Tainted-enabled Reverse Automated Symbolic Engineering Environment execution System

  8. Gaps between Research and Interactive Binary Analysis • Existing research does not support interactive binary analysis – No practical tools – No uniform trace collection tools – No unified Instruction Set Architecture(ISA) -independent analysis tools

  9. Bringing Proven Research Techniques to Interactive Binary Analysis • Our tools use dynamic, trace-based, offline analysis approach – Interactive binary analysis [1] – Dynamic taint analysis ([2][3][4]) – Symbolic execution/ SMT solver ([2][5]) – Trace replay ([6])

  10. Making It Practical • TREE integrates with IDA Pro now and • Simple Static Analyses other mainstream binary analysis – Cyclomatic complexity environments (later) – Loop Detection • TREE leverages debugging infrastructure to • IR Translation support tracing on multiple platforms – CBASS and TREE are separate components and • CBASS uses Intermediate Representation work in a client/server architecture – CBASS and TREE share native to IR mapping (REIL [6][7])-based approach to support through IR Store ISA-independent analysis

  11. CBASS Supports Both Automated & Interactive Analysis TREE Automated Fuzzer Interactive Analysis Automated Analysis CBASS IR-based Symbolic Execution Engine TREE fills gaps for interactive analysis

  12. Tools Support Interactive Binary Analyses Connect Explore Fix the the Dots New Dots Dots CBASS TREE Symbolic Execution Replay Don’t chase a moving target Explore the unexplored Taint Analysis path and code Focus only on data and code that are relevant

  13. Illustrative Dots in Vulnerability Analysis: A Running Example //INPUT ReadFile(hFile, sBigBuf, 16, &dwBytesRead, NULL); //Vulnerable Function void StackOVflow(char *sBig,int num) //INPUT TRANSFORMATIONS { …… char sBuf[8]= {0}; …… //PATH CONDITIONS for(int i=0;i<num;i++) if(sBigBuf[0]=='b') iCount++; //Overflow when num>8 if(sBigBuf[1]=='a') iCount++; { if(sBigBuf[2]=='d') iCount++; sBuf[i] = sBig[i]; if(sBigBuf[3]=='!') iCount++; } if(iCount==4) // bad! …… StackOVflow(sBigBuf,dwBytesRead) return; else // Good } printf (“Good!”);

  14. Our Tools Support Fixing the Dots (TREE)

  15. Fix the Dots • Reverse engineers don’t like moving dots • Why do the dots move? – Concurrency (multi-thread/multi-core) brings non-deterministic behavior – ASLR guarantees nothing will be the same

  16. Fix the Dots • How does TREE work? – Generates the trace at runtime – Replays it offline • TREE trace – Captures program state = {Instruction, Thread, Register, Memory} – Fully automated generation • TREE can collect traces from multiple platforms – Windows/Linux/Mac OS User/Kernel and real devices (Android/ARM, Cisco routers/MIPS, PowePC)

  17. TREE Taint-based Replay vs. Debug-based Replay • Debug-replay lets you connect the dots – Single step, stop at function boundary, Breakpoint • TREE replay connects dots for you – Deterministic replay with taint-point break

  18. Our Tools Support Connecting the Dots (TREE)

  19. Connecting Dots is Hard • Basic elements complex in real programs – Code size can be thousands (++) of lines – Inputs can come from many places – Transformations can be lengthy – Paths grow exponentially • Basic elements likely separated by millions of instructions, spatially and temporally • Multiple protections built in

  20. Techniques Help Connect the Dots • Dynamic Taint Analysis – Basic Definitions o Taint source o Taint Sink: o Taint Policy: • Taint-based Dynamic Slicing – Taint focused on data – Slicing focused on relevant instructions and sequences

  21. Connect the Dots • TREE connects dots -- using taint analysis Taint Source:

  22. Connect the Dots • TREE connects dots -- using taint analysis Taint Source: Taint Sink:

  23. Connect the Dots • TREE connects dots -- using taint analysis Taint Source: Taint policy Taint Sink:

  24. Connect the Dots • TREE connects dots -- using taint analysis Taint Source: Taint policy Taint Sink: - Dynamic Slicing

  25. Find the Dots and Slice that Matter In practice, most dots don’t matter – eliminate them quickly to focus on what matters

  26. Connecting Dots in Running Example The Slice The Taint Graph Taint Source: call ds:ReadFile (Input) movb (%eax), %dl Taint policy (Data) movb %dl, -0x8(%ebp,%ecx,1) retl Taint Sink: eip

  27. What You Connect is What You Get • Dots can be connected in different ways – Data dependency – Address dependency – Branch conditions – Loop counter • Connect dots in different taint policies

  28. TAINT-ENABLED REVERSE ENGINEERING ENVIRONMENT

  29. TREE Key Components IDA Plug-in TREE Replay Taint Taint Visualizer Execution Taint Analyzer & & Slice Navigator Trace Graph Slicing (IDA Native/Qt) Execution Tracer (Cross-platform Debugging)

  30. TREE: The Front-end of Our Interactive Analysis System Taint Graph

  31. TREE: The Front-end of Our Interactive Analysis System Taint Table

  32. TREE: The Front-end of Our Interactive Analysis System Execution Trace Table

  33. TREE: The Front-end of Our Interactive Analysis System Register/stack/ memory Views

  34. TREE: The Front-end of Our Interactive Analysis System Replay is focal point of user interaction

  35. Tree Demo Using TREE to Analyze a Crash

  36. Our Tools Support Exploring New Dots

  37. A Key Branch Point for a Duck Connects 16 ->17

  38. The Path for a … • Reverse engineers don’t just connect dots; they want to explore new dots: Connects 16 ->26

  39. Explore New Dots • How do you force the program to take a different path to lead to “bad!”? //INPUT ReadFile(hFile, sBigBuf, 16, &dwBytesRead, NULL); …… //PATH CONDITION if(sBigBuf[0]=='b') iCount++; if(sBigBuf[1]=='a') iCount++; if(sBigBuf[2]=='d') iCount++; if(sBigBuf[3]=='!') iCount++; if(iCount==4) // “bad!” path StackOVflow(sBigBuf,dwBytesRead) ? Else // “Good” path printf (“Good!”);

  40. Explore New Dots • User wants execution to take different path at a branch point Y – what input will make that happen? User: TREE: Can How to execute we negate different path path at branch Y? condition at Y? TREE: Input CBASS [0] must be ‘b’ TREE (symbolic CBASS: execution) This byte must be ‘b’

  41. Explore New Dots Demo IDA Plugin TREE (Front End) 1 Replay Execution Taint Execution 4 Taint Taint Visualizer Trace 3 Graph Tracer Analyzer & & Slice Navigator (Cross-platform Slicing (IDA Native Qt) 8 Debugging) 5 New On-demand Path 2 input Selection Symbolic Execution & Constraint Generation Path 6 Satisfiable 7 CBASS constraints input (BACK End) SMT Solver

  42. Task 1: Force the Program to Take “bad!” Path Branch Conditions In Disassembly //INPUT ReadFile(hFile, sBigBuf, 16, &dwBytesRead, NULL); //INPUT TRANSFORMATION …… //PATH CONDITION if(sBigBuf[0]=='b') iCount++; if(sBigBuf[1]=='a') iCount++; if(sBigBuf[2]=='d') iCount++; if(sBigBuf[3]=='!') iCount++; if(iCount==4) // “bad!” path //Vulnerable Function StackOVflow(sBigBuf,dwBytesRead) else printf (“Good!”);

  43. TREE Pin Trace 1 PIN: A popular Dynamic Binary Instrumentation (DBI) Framework http://software.intel.com/en-us/articles/pin-a-dynamic-binary- instrumentation-tool

  44. TREE Console: Trace Generation 2 PINAgent: Connects TREE with PIN tracer

  45. TREE: Taint Analysis Configuration 3

  46. TREE: Branch Taint Graph 4

  47. Negate Tainted Path Condition to 5 Exercise a New (“Bad”) Path CBASS (Cross-platform “Bad!” Path Query Symbolic Execution) Result ‘ b ’ ‘ a ’ ‘ d ’

Recommend


More recommend