16
Decompilation of Binary Programs Christina Cifuentes & K. John Gough School of Computing Science Queensland University of Technology Presented by Conny Chan

Decompilation of Binary Programs

  • Upload
    diella

  • View
    21

  • Download
    1

Embed Size (px)

DESCRIPTION

Decompilation of Binary Programs. Christina Cifuentes & K. John Gough School of Computing Science Queensland University of Technology Presented by Conny Chan. Overview. Usage of decompiler Phases of the decompiler Front-end, UDM, Back-end The decompiling system Signature generator - PowerPoint PPT Presentation

Citation preview

Page 1: Decompilation of  Binary Programs

Decompilation of Binary Programs

Christina Cifuentes & K. John Gough

School of Computing ScienceQueensland University of

TechnologyPresented by Conny Chan

Page 2: Decompilation of  Binary Programs

OverviewUsage of decompilerPhases of the decompiler

Front-end, UDM, Back-end

The decompiling systemSignature generator

ConclusionDiscussion

Page 3: Decompilation of  Binary Programs

Perform inverse process of a compiler

Usage:Maintenance of Code

Lost code recoveryMigration of application to new HW platform.Translation of the obsolete code into new code.

Software SecurityMalicious code detection

Reverse Compiler

Binary code HLL program

Page 4: Decompilation of  Binary Programs

Note in advance:Decompiler in this article:

Experimental decompiler for the DOS OSIntel i80286 architectureRead .com and .exe filesProduce C programs as output.

Page 5: Decompilation of  Binary Programs

Decompiler StructureBinary Program

Front-end(machine dependent)

UDM(analysis)

Back-end(language dependent)

HLL program

Page 6: Decompilation of  Binary Programs

The Front-end

BinaryProgram

Virtual Memory

Loader Parser

1. Low-level Intermediate code2. Control flow graph

SemanticAnalysis

Page 7: Decompilation of  Binary Programs

The Semantic AnalysisPerforms idiom analysis e.g.

type propagation.E.g. long variable found at –1 to –4.

neg dxneg axsbb dx, 0

neg dx:ax

[bp-2]…

[bp-4]merged [bp-2]:[bp-4]

Page 8: Decompilation of  Binary Programs

The Universal Decompiling Machine (UDM)

1. Low-level Intermediate code2. Control flow graph

UDM

Data Flow Analysis

Control Flow Analysis1. High-level Intermediate code2. Structured control flow graph

Page 9: Decompilation of  Binary Programs

The Back-end

1. High-level Intermediate code2. Structured control flow graph

Restructuring

HLL Code Generation HLL Program

Page 10: Decompilation of  Binary Programs

The HLL code generationDefines:

Global variablesEmits code for each function

In each function:Comments of such procedures

Variables and procedures named in loc1, proc2, etc.

Page 11: Decompilation of  Binary Programs

The Decompiling System

Decompiler(dcc)

Signature Generator(dccSign)

Page 12: Decompilation of  Binary Programs

Signature Database

Signature Generator(dccSign)

SignatureDatabase

Compiler SignaturesLibrary Signatures

Decompiler(dcc)

Extract Signatures e.g. printf(), scanf()

If a library function matched, replaced by the library name instead of analyzed by dcc.

Page 13: Decompilation of  Binary Programs

SignaturesLibrary Signature

A series of instructions that identifies library function for a compiler.

Compiler SignatureA series of instructions that identifies a particular version of a compiler.

Page 14: Decompilation of  Binary Programs

Signature Checker

Determined if known compiler is used.Check first n bytes of instructions with pattern-matching

Decompiler(dcc)

Signature Checker

Page 15: Decompilation of  Binary Programs

ConclusionPresent one way for decompiling binary program.Prove the feasibility of writing a decompiler for a contemporary machine architecture.

Page 16: Decompilation of  Binary Programs

Discussion

Is decompilation legal?