Assembly Code Verification Using Model Checking Hao XIAO Singapore University of Technology and Design.

Slides:



Advertisements
Similar presentations
Course Outline Traditional Static Program Analysis Software Testing
Advertisements

1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
Dec 5, 2007University of Virginia1 Efficient Dynamic Tainting using Multiple Cores Yan Huang University of Virginia Dec
C Programming and Assembly Language Janakiraman V – NITK Surathkal 2 nd August 2014.
CPSC Compiler Tutorial 8 Code Generator (unoptimized)
TaintCheck and LockSet LBA Reading Group Presentation by Shimin Chen.
1 Static Testing: defect prevention SIM objectives Able to list various type of structured group examinations (manual checking) Able to statically.
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Programmable System on Chip Fully Configurable Mixed Signal Array Allows for Completely Customizable System Designs Capable of Internal MCU.
X86 ISA Compiler Baojian Hua Front End source code abstract syntax tree lexical analyzer parser tokens IR semantic analyzer.
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
Software Development and Software Loading in Embedded Systems.
A Portable Virtual Machine for Program Debugging and Directing Camil Demetrescu University of Rome “La Sapienza” Irene Finocchi University of Rome “Tor.
6.828: PC hardware and x86 Frans Kaashoek
DOP - A CPU CORE FOR TEACHING BASICS OF COMPUTER ARCHITECTURE Miloš Bečvář, Alois Pluháček and Jiří Daněček Department of Computer Science and Engineering.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Cosc 2150: Computer Organization
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
ITEC 352 Lecture 12 ISA(3). Review Buses Memory ALU Registers Process of compiling.
CMPE 511 Computer Architecture A Faster Optimal Register Allocator Betül Demiröz.
The ISA Level The Instruction Set Architecture (ISA) is positioned between the microarchtecture level and the operating system level.  Historically, this.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Execution of an instruction
Lecture 14 Today’s topics MARIE Architecture Registers Buses
1 ICS 51 Introductory Computer Organization Fall 2009.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Chapter 1 Introduction Study Goals: Master: the phases of a compiler Understand: what is a compiler Know: interpreter,compiler structure.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
CNIT 127: Exploit Development Ch 1: Before you begin.
AMD64/EM64T – Dyninst & ParadynMarch 17, 2005 The AMD64/EM64T Port of Dyninst and Paradyn Greg Quinn Ray Chen
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Buffer Overflow Attack- proofing of Code Binaries Ramya Reguramalingam Gopal Gupta Gopal Gupta Department of Computer Science University of Texas at Dallas.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Execution Architecture MTT CPU08 Core M CPU08 INTRODUCTION.
ECE 447 Fall 2009 Lecture 4: TI MSP430 Architecture and Instruction Set.
Computer Organization Instructions Language of The Computer (MIPS) 2.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
ROP Exploit. ROP Return Oriented Programming (ROP): is a hacking exploit technique where you exploit buffer overflow to inject a chain of gadgets. Each.
Correct RelocationMarch 20, 2016 Correct Relocation: Do You Trust a Mutated Binary? Drew Bernat
DR. MIGUEL ÁNGEL OROS HERNÁNDEZ 2. Software de bajo nivel.
Chapter Overview General Concepts IA-32 Processor Architecture
Section 5: Procedures & Stacks
Exploiting & Defense Day 1 Recap
Instruction Set Architecture
Instruction Set Architectures
Basic Computer Organization and Design
COMP2121: Microprocessors and Interfacing
Assembly language.
Introduction to Compiler Construction
Control Unit Lecture 6.
Compiler Construction (CS-636)
Computer Architecture and Assembly Language
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Introduction to Compilers Tim Teitelbaum
Introduction to System Programming
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
MARIE: An Introduction to a Simple Computer
System Calls David Ferry CSCI 3500 – Operating Systems
Week 2: Buffer Overflow Part 1.
Computer Architecture CST 250
Introduction to Microprocessor Programming
CS334: MIPS language _Mars simulator Lab 2_1
Computer Architecture and System Programming Laboratory
Presentation transcript:

Assembly Code Verification Using Model Checking Hao XIAO Singapore University of Technology and Design

Outline Motivation Approach overview ILA PAT On-going & future work

Motivation

Benefits Achieve more reliability. More software components can be verified. Circumvent problems caused by compiler. The verification target is most close to what is running on a CPU than the source code. Easy to verify. Binaries have more elegant syntax and well defined semantics than source code.

Challenges Instruction complexity. Lack of high level semantic information. Dynamic jump and call, no clear boundaries for “function”. How to specify properties for assembly code. Scalability. Assembly code is much longer than source code.

Design Goals Accuracy: Faithfully handle the complex instructions in some ISA. Extensibility: Easy extensible to handle different Instruction Set of various architecture. Ease of Use: Those who are not familiar with temporal logic or assembly language should also find it is useful. High Efficiency: Scalable to large programs.

Approach Overview (1) ELF Vine IL Vine Emulator Static Analyzer Model Checker User & Built in properties Properties Parser Counter Example

Approach Overview (2) Accuracy and Extensibility: Vine IL. Ease of Use: Built in properties, if source is available, link counter examples back to source. High Efficiency: property guided abstractions techniques for state space reduction; Function abstraction.

PAT Vine IL Emulator Static Analyses Built in properties Example-buffer overflow checking

Vine IL Binary file Assembly VEX IR Vine IL Libbfd VineLibVex

Vine IL Example

Emulator(State builder) Emulator is used to generate the successor states based on the current state. A state consists of CPU registers, PC, memory. Separate global states from local states. Byte precision memory model.

Static Analyses for Space Reduction Stack Analysis Dead Variable Analysis. Value Set Analysis Interrupt Flag Analysis. Path Reduction

Built-in Properties Stack overflow checking Integer overflow checking Null pointer deference. Division by zero checking Uninitialized variable checking Data race checking

Example-Buffer Overflow Checking Buffer overflow in assembly level: write to a memory location beyond the boundaries of current stack frame. Identify instrumentation point: find write operations which have a variable d as its destination address. Assertion instrumentation: Add assertion d > %ebp && d < %esp before the write instruction. Model checking assertions.

Example- C++ source code

Example-Assembly Code s1 s2 s3 s4 s5 s6

S1 S2 S3 S4S5 S6 J1 J2 J3 Control Flow Graph

S1 S3 S4.1 S5 S6 J1 J3 CFG for Instrumented Code S4.2 A1 Error esp1 = esp0 - 0x4 M[esp1] = ebp0 ebp1 = esp1 esp2 = esp1 - max{0, 15} esp3 = esp2 – 0x20 M[ebp1 +0x8]>1 eax0= M[ebp1 + 0xc] eax1= M[eax0 + 0x4] M[esp3 + 0x18] = eax1 M[esp3 + 0x1c] = 0 ebx0 =φ(S3,S4.2,M[ esp3 + 0x1c]) eax2 = M[esp3 + 0x18] eax3 = strlen (eax2) eax3 < ebx0 eax4 = M[esp3 + 0x1c] eax5 = eax4 + M[esp3 + 0x18] edx0 = M[eax5] eax6 = esp3 + 0x10 eax7 = M[esp3 + 0x1c] + eax6 eax7 > ebp1 && eax7 < esp3 M[eax7] = edx0 M[esp3+0x1c] = M[esp3 + 0x1c] + 1

On-going & future Work Implementation. More abstraction techniques(e.g., irrelevant code elimination). Symbolic model checking

The End Thanks !