EECS 354 Network Security Reverse Engineering. Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable.

Slides:



Advertisements
Similar presentations
Practical Malware Analysis
Advertisements

Lots of content, the hope is that they will be used as reference material after the presentation.
.NET IL Obfuscation Presented by: Sarath Chandra Dorbala.
Lecture 01 - Introduction Eran Yahav 1. 2 Who? Eran Yahav Taub 734 Tel: Monday 13:30-14:30
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
JETT 2003 Java.compareTo(C++). JAVA Java Platform consists of 4 parts: –Java Language –Java API –Java class format –Java Virtual Machine.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
Microcomputer & Interfacing Lecture 3
ARM C Language & Assembler. Using C instead of Java (or Python, or your other favorite language)? C is the de facto standard for embedded systems because.
Compiled by Benjamin Muganzi 3.2 Functions and Purposes of Translators Computing 9691 Paper 3 1.
Code Injection and Software Cracking’s Effect on Network Security Group 5 Jason Fritts Utsav Kanani Zener Bayudan ECE 4112 Fall 2007.
F13 Forensic tool analysis Dr. John P. Abraham Professor UTPA.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 18: 0xCAFEBABE (Java Byte Codes)
Trying to like a boss… REVERSE ENGINEERING. WHAT EVEN IS… REVERSE ENGINEERING?? Reverse engineering is the process of disassembling and analyzing a particular.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Application Security Tom Chothia Computer Security, Lecture 14.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Hello ASM World: A Painless and Contextual Introduction to x86 Assembly rogueclown DerbyCon 3.0 September 28, 2013.
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Binary Auditing Geller Bedoya Michael Wozniak. Background  Binary auditing is a technique used to test the security and discover the inner workings of.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Old Chapter 10: Programming Tools A Developer’s Candy Store.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
CS266 Software Reverse Engineering (SRE) Reversing and Patching Java Bytecode Teodoro (Ted) Cipresso,
Introduction to Information Security מרצים : Dr. Eran Tromer: Prof. Avishai Wool: מתרגלים : Itamar Gilad
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
Introduction to InfoSec – Recitation 2 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
1 Code Generation. 2 Position of a Code Generator in the Compiler Model Front-End Code Optimizer Source program Symbol Table Lexical error Syntax error.
Reverse Engineering Workshop
Introduction to Information Security מרצים : Dr. Eran Tromer: Prof. Avishai Wool: מתרגלים : Itamar Gilad
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
Introduction  Program: Set of sequence instruction that tell the computer what to do.  Software: A collection of programs, data, and information. 
Introduction to Reverse Engineering
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Computer Software 1.
Code Generation Part I Chapter 8 (1st ed. Ch.9)
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Chapter 1 Introduction Samuel College of Computer Science & Technology Harbin Engineering University.
Malware malicious software which is specifically designed to disrupt, damage, or gain authorized access to a computer system Analysis detailed examination.
Why don’t programmers have to program in machine code?
Advanced Computer Systems
Component 1.6.
GCSE COMPUTER SCIENCE Computers 1.5 Assembly Language.
Computer Architecture CST 250
Assembly language.
Static and dynamic analysis of binaries
Introduction to Compiler Construction
Microprocessor T. Y. B. Sc..
Topic: Difference b/w JDK, JRE, JIT, JVM
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
Assembly Language Programming Part 2
TRANSLATORS AND IDEs Key Revision Points.
Code Generation Part I Chapter 9
LING 408/508: Programming for Linguists
Code Generation Part I Chapter 8 (1st ed. Ch.9)
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
Fundamentals of Computer Organisation & Architecture
COEN 252 Computer Forensics
Code Generation Part I Chapter 9
CMP 131 Introduction to Computer Programming
ICT Programming Lesson 1:
CMSC 491/691 Malware Analysis
Android Platform, Android App Basic Components
Disassembly תרגול 7 ניתוח קוד.
1.3.7 High- and low-level languages and their translators
Programming language translators
Reverse Engineering for CTFs
Presentation transcript:

EECS 354 Network Security Reverse Engineering

Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable

Anything is possible There is no computer system in existence that cannot be reverse engineered Most important limiting factors Complexity Time

Reversing by Language Ruby, javascript, HTML, etc Not compiled Python, Java, C#, VB.NET, etc Byte compiled Easier to decompile/inspect Many symbols still exist in bytecode C, C++ Compiled into machine code Much harder to decompile Still possible to reverse engineer with debugger and disassembler

Scalability of techniques Basic reversing techniques work for small code bases It’s possible to determine what assembly code does for a 100 line C program without too much difficulty Not used heavily by hackers When trying to hack an application, crashes and error messages are better hints

Windows Is it possible to reverse engineer Windows? How many lines of code does it have? How long would it take?

Wine’s reverse engineering The Wine project attempts to implement the windows API Project began in 1993, still unstable and incomplete Has over 1.4 million lines of code (written by 700 contributors) Does not cover all of Windows (core OS, windowing, etc) On the other hand, Samba (reverse engineering Windows file sharing) has been pretty successful

Why Reverse Engineering? Defense Security companies often reverse malware binaries Protocol reversing for botnet analysis Working with proprietary APIs or protocols Hacking Finding vulnerabilities is easier with the code

Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable

Preventing reverse engineering Obfuscation Translate code into something unreadable or unnatural Must trick a human reader without tricking the machine interpreter/loader Reverse engineering, besides in the most basic form, is combating software obfuscation

Obfuscation Techniques Renaming functions/variables Adding bogus code with no side-effects Remove whitespace Make strings/numbers hex values Using “dynamic” code Javascript: eval Java: GetName, GetAttribute Python: getattr, setattr Most of these are reversible Except function/variable names can’t be recovered

Obfuscation Techniques Packing Storing an executable as a string (or otherwise) within an executable Can make use of compression and encryption to hide contents Decompression or decryption code must be packed in the executable as well Complex packers exist for most languages

Javascript Obfuscation

eval(unescape('%3C%64%69%76%20% 73%74')) a = ‘t’; b = ‘er’; c = ‘a’; d = eval; e = ‘\”XSS\”’; d(c+'l'+b+a+'('+e+')');

Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable

What is byte code? Byte code is compiled code that cannot be executed by the processor Distinct from machine code Architecture independent Executed by a software interpreter: a VM, a JIT compiler, etc Byte code is often dynamic Symbols can be referenced at runtime This means the program structure still exists, can be rebuilt

Decompilers Decompilers reverse the steps taken by a compiler Opcode translation Abstract Syntax Tree construction Python Uncompyle2, decompyle, unpyc Java Jad, JD

Reversing Basics Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable

Executables Machine code is changed significantly from the original source code Variables have been allocated to registers or somewhere in memory Optimization steps have changed the program structure No way to decompile this back to the original source Machine instructions translate directly to assembly code Disassembly analysis can be effective

Reversing Executables We will be focusing on x86 32-bit LSB ELF executables Contains ELF header, program header, section table, and data May also contain a symbol table

Reversing Executables ELF Header contains program entry point, basic identifying information Program header describes memory segments (e.g. where in memory will segments be loaded? what parts of memory are r/w/x?) Used at program load time Section table describes section layout (e.g. where’s the.rodata?.text?.bss?) Used at link time

X86 Assembly mov add, sub shl, shr, sar, mul, div and, or, xor jmp, je, jne, jl, jg, jle, jge cmp, test call, push, pop, ret, nop 0x8(%esp), -0xc(%ebp)

Reversing Basics Basic tools: file strings strace (and ltrace) nm objdump or readelf tcpdump gdb You can reverse anything with a good debugger, but…

Reversing Frameworks For more advanced reversing, it may help to have more than just a debugger IDA Radare

ELF Obfuscation There are some additional techniques for obfuscating executable formats: Storing data in unusual sections:.ctors,.dtors,.init, etc “Corrupting” the ELF header Stripping the symbol table Checking ptrace to prevent debuggers Packing Code is unpacked dynamically during execution

Malware Examples

Demo... Source: