©2012 Check Point Software Technologies Ltd. Introduction to Reverse Engineering Inbar Raz Malware Research Lab Manager Information Security – Theory vs.

Slides:



Advertisements
Similar presentations
Smita Thaker 1 Polymorphic & Metamorphic Viruses Presented By : Smita Thaker Dated : Nov 18, 2003.
Advertisements

COMP 2003: Assembly Language and Digital Logic
SMT Solvers for Malware Unpacking 8 July Authors and thanks 2 Ian Blumenfeld Roberta Faux Paul Li Work overseen by Mark Raugas – Director CyberPoint.
Introduction to Information Security מרצים : Dr. Eran Tromer: Prof. Avishai Wool: מתרגלים : Itamar Gilad
C Programming and Assembly Language Janakiraman V – NITK Surathkal 2 nd August 2014.
Reversing Microsoft Patches to reveal Vulnerable code Harsimran Walia
Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions.
©2011 Check Point Software Technologies Ltd. [PROTECTED] — All rights reserved. Introduction to Reverse Engineering Inbar Raz Malware Research Lab Manager.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
1 Lecture 5: Procedures Assembly Language for Intel-Based Computers, 4th edition Kip R. Irvine.
Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages.
Reverse Engineering Ian Kayne For School of Computer Science, University of Birmingham 2 nd February 2009.
SRE  Introduction 1 Software Reverse Engineering (SRE)
0wning Antivirus Alex Wheeler Neel Mehta
Code Injection and Software Cracking’s Effect on Network Security Group 5 Jason Fritts Utsav Kanani Zener Bayudan ECE 4112 Fall 2007.
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.
Application Security Tom Chothia Computer Security, Lecture 14.
6.828: PC hardware and x86 Frans Kaashoek
Part 3: Advanced Dynamic Analysis Chapter 8: Debugging.
Hello ASM World: A Painless and Contextual Introduction to x86 Assembly rogueclown DerbyCon 3.0 September 28, 2013.
Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions.
Binary Auditing Geller Bedoya Michael Wozniak. Background  Binary auditing is a technique used to test the security and discover the inner workings of.
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
EECS 354 Network Security Reverse Engineering. Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable.
Introduction to Information Security מרצים : Dr. Eran Tromer: Prof. Avishai Wool: מתרגלים : Itamar Gilad
Carnegie Mellon Recitation: Bomb Lab 21 Sep 2015 Monil Shah, Shelton D’Souza.
RIVERSIDE RESEARCH INSTITUTE Deobfuscator: An Automated Approach to the Identification and Removal of Code Obfuscation Eric Laspe, Reverse Engineer Jason.
Today’s topics Procedures Procedures Passing values to/from procedures Passing values to/from procedures Saving registers Saving registers Documenting.
CNIT 127: Exploit Development Ch 3: Shellcode. Topics Protection rings Syscalls Shellcode nasm Assembler ld GNU Linker objdump to see contents of object.
1 ICS 51 Introductory Computer Organization Fall 2009.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Stack Usage with MS Visual Studio Without Stack Protection.
Introduction to Information Security מרצים : Dr. Eran Tromer: Prof. Avishai Wool: מתרגלים : Itamar Gilad
Lecture 11 Example Rootkit. Intel internship Intel CTG (Corporate Technology Group) –Advanced research & development –System integrity services using.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Lecture 10 Anti-debugger techniques. Anti-debuggers Making reverse-engineering and disassembly painful –Polymorphism –Encryption –Interrupt disabling.
DR. MIGUEL ÁNGEL OROS HERNÁNDEZ 2. Software de bajo nivel.
Week-14 (Lecture-1) Malicious software and antivirus: 1. Malware A user can be tricked or forced into downloading malware comes in many forms, Ex. viruses,
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Paradyn Project Safe and Efficient Instrumentation Andrew Bernat.
Reverse Engineering Contemporary Countermeasures By: Joshua Schwartz.
Introduction to Information Security
Malware malicious software which is specifically designed to disrupt, damage, or gain authorized access to a computer system Analysis detailed examination.
Assembly language.
Static and dynamic analysis of binaries
Live Phishing Attack Authentication Activity from a Foreign Address.
Data Transfers, Addressing, and Arithmetic
CS-401 Computer Architecture & Assembly Language Programming
Techniques, Tools, and Research Issues
Aaron Miller David Cohen Spring 2011
Introduction to Compilers Tim Teitelbaum
Assembly IA-32.
Computer Architecture and Assembly Language
Ramblr Making Reassembly Great Again
Practical Session 4.
Machine-Level Programming: Introduction
Multi-modules programming
Khaled Yakdan University of Bonn Fraunhofer FKIE
X86 Assembly Review.
RopSteg: Program Steganography with Return Oriented Programming
0wning Antivirus Alex Wheeler
CSC 497/583 Advanced Topics in Computer Security
ICS51 Introductory Computer Organization
Computer Architecture and System Programming Laboratory
Computer Architecture and System Programming Laboratory
Reverse Engineering for CTFs
Computer Architecture and System Programming Laboratory
Presentation transcript:

©2012 Check Point Software Technologies Ltd. Introduction to Reverse Engineering Inbar Raz Malware Research Lab Manager Information Security – Theory vs. Reality Tel Aviv University, , Winter Lecture 7

2 2©2012 Check Point Software Technologies Ltd. What is Reverse Engineering? Reverse engineering is the process of discovering the technological principles of a device, object, or system through analysis of its structure, function, and operation. aka: Reversing, RE, SRE

3 3©2012 Check Point Software Technologies Ltd. Why do it? Discover Trade Secrets Find Vulnerabilities Academic Research (Yeah, right…) Circumvent [Copy] Protection Analyse Protocols Pure Curiosity Patch Binary and Alter Behavior

4 4©2012 Check Point Software Technologies Ltd. Sounds awesome, right?

5 5©2012 Check Point Software Technologies Ltd. So where’s the catch?  Low-level is, well, low level… push ebp mov ebp, esp push ecx push ecx and dword ptr [ebp-4], push esi A mov esi, [ebp+8] D push edi E push esi F call ds:[ h] mov edi, eax xor edx, edx test edi, edi B jle h D movsx ecx, byte ptr [edx+esi] add [ebp-4], ecx mov [ebp-8], ecx rol dword ptr [ebp-4], A mov eax, ecx C imul eax, [ebp-4] mov [ebp-4], eax mov eax, [ebp-8] add [ebp-4], eax xor [ebp-4], ecx C inc edx D cmp edx, edi F jl Dh cmp dword ptr [ebp-4], jnz h push push 40230Ch E push 4022CCh push ds:[004023ACh] call ds:[ h] F xor eax, eax jmp Fh xor dword ptr [ebp+0Ch], 01337C0DEh A sub dword ptr [ebp+0Ch], 0BADC0DE5h mov eax, [ebp-4] not dword ptr [ebp+0Ch] xor eax, [ebp+0Ch] A neg eax C sbb eax, eax E inc eax F pop edi pop esi leave retn for (Serial = 0, i = 0; i < strlen(UserName); i++) { CurChar = (int) UserName[i]; Serial += CurChar; Serial = (((Serial > 31) && 1)); Serial = (((Serial * CurChar) + CurChar) ^ CurChar); } UserSerial = ~((UserSerial ^ 0x1337C0DE) - 0xBADC0DE5);

6 6©2012 Check Point Software Technologies Ltd. So where’s the catch?  Low-level is, well, low level…  Needle in a haystack –Average opcode size: 3 bytes –Average executable size: 500KB (on WinXP) –There are executables, libraries, drivers….

7 7©2012 Check Point Software Technologies Ltd. So where’s the catch?  Low-level is, well, low level…  Needle in a haystack  Sometimes, the code resists –Packers and compressors –Obfuscators

8 8©2012 Check Point Software Technologies Ltd. So where’s the catch?  Low-level is, well, low level…  Needle in a haystack  Sometimes, the code resists  Sometimes, the code fights back –Detect reversing tools –Detect VMs and emulators

9 9©2012 Check Point Software Technologies Ltd. A Battle of Wits  Author writes code  Reverser reverses it  Author creates an anti-reversing technique  Reverser bypasses it  And so on…

10 ©2012 Check Point Software Technologies Ltd. So what do you need in order to be a good reverser?

11 ©2012 Check Point Software Technologies Ltd. We’ll come back to this…

12 ©2012 Check Point Software Technologies Ltd. Tools of the Trade  Disassembler (Static code analysis)  Debugger (Dynamic code analysis)  Hex Editor  PE Analyzer  Resource Editor

13 ©2012 Check Point Software Technologies Ltd. Disassemblers

14 ©2012 Check Point Software Technologies Ltd. The old world: Sourcer

15 ©2012 Check Point Software Technologies Ltd. The old world: Sourcer

16 ©2012 Check Point Software Technologies Ltd. Old ages: Sourcer

17 ©2012 Check Point Software Technologies Ltd. Old ages: Sourcer

18 ©2012 Check Point Software Technologies Ltd. Welcome to Windows: W32DASM

19 ©2012 Check Point Software Technologies Ltd. The Holy Grail: IDA-Pro  Started as an Interactive Dis-Assembler, enabling user interaction with the disassembler’s decisions.  Slowly evolved into an automatic RE tool: –Built-in full-control script language –Library recognition (including user-generated) –Function prototype information –Display –Propagate throughout the code –Support for plug-ins –Support for Python scripting –Multi-architecture, cross-platform support –Full incorporation with built-in and external debuggers

20 ©2012 Check Point Software Technologies Ltd. Debuggers באג בדיזיין –זין בדיבאג

21 ©2012 Check Point Software Technologies Ltd. First, there was DEBUG…

22 ©2012 Check Point Software Technologies Ltd. GUI and much more: Turbo Debugger

23 ©2012 Check Point Software Technologies Ltd. GUI and much more: Turbo Debugger

24 ©2012 Check Point Software Technologies Ltd. GUI and much more: Turbo Debugger

25 ©2012 Check Point Software Technologies Ltd. Next major step: Soft-ICE

26 ©2012 Check Point Software Technologies Ltd. And finally: OllyDbg

27 ©2012 Check Point Software Technologies Ltd. Other Tools

28 ©2012 Check Point Software Technologies Ltd. Hex-Editor

29 ©2012 Check Point Software Technologies Ltd. PE Analyzer

30 ©2012 Check Point Software Technologies Ltd. Resource Editor

31 ©2012 Check Point Software Technologies Ltd. Methodology

32 ©2012 Check Point Software Technologies Ltd. How we do it?  Finding the interesting part –System calls (User mode and Kernel mode API) –Strings and constants –Dynamic loading of libraries –Provocation –Zoom-in and Zoom-out  Better and quicker (and how not to get stuck) –Iterative passes over the code –Leave no stone unturned –Macros/Scripts/Plugins –BinDiffing (manual and with tools)

33 ©2012 Check Point Software Technologies Ltd. Let’s play with them tools…

34 ©2012 Check Point Software Technologies Ltd. 60 seconds on x86 registers  General purpose registers: 32bit/16bit/8bit  Index registers: 32bit/16bit  Segment registers: 16bit  Flags: 32bit/16bit

35 ©2012 Check Point Software Technologies Ltd. Exercise 1: Static Reversing

36 ©2012 Check Point Software Technologies Ltd. Exercise 1: Static Reversing  Target: a 2004 “Crack-Me”  Tools: IDA-Pro

37 ©2012 Check Point Software Technologies Ltd. Exercise 2: Dynamic Reversing

38 ©2012 Check Point Software Technologies Ltd. Exercise 2: Dynamic Reversing  Target: a 2004 “Crack-Me”  Tools: OllyDbg, IDA-Pro

39 ©2012 Check Point Software Technologies Ltd. Exercise 3: Simple Anti-Debugging

40 ©2012 Check Point Software Technologies Ltd. Exercise 3: Simple Anti Debugging  Target: a 2006 “Crack-Me”  Tools: OllyDbg

41 ©2012 Check Point Software Technologies Ltd. Reversing Malware  Malware is comprised of the following building blocks: –Infection Vector –Concealment –Operation –Communications  Check Point’s Anti-Malware Software Blade sits at the gateway  Therefore, communications interest us the most

42 ©2012 Check Point Software Technologies Ltd. Introducing: Spy Eye  A CrimeWare ToolKit, originating in Russia.  Used mostly for stealing financial information, but will settle for any other identity information and key logging…  Like any serious trojan, Spy Eye compresses its traffic and encrypts it –Compression is performed using a public library (LZO) –Encryption algorithm is proprietary

43 ©2012 Check Point Software Technologies Ltd. Act 1: Encryption

44 ©2012 Check Point Software Technologies Ltd. Act 2: Configuration Download

45 ©2012 Check Point Software Technologies Ltd. Act 3: Another Encryption

46 ©2012 Check Point Software Technologies Ltd. So what do you need in order to be a good reverser?

47 ©2012 Check Point Software Technologies Ltd. What makes a good reverser? Qualities Patient Curious Persistent Outside-the-Box Thinking Optional: Good lookin’ Knowledge Assembly Language Some High-Level programming Best: origin of binary Operating System Internals API Data Structures File Structures Good scripting skills Anti-Debugging Tricks

48 ©2012 Check Point Software Technologies Ltd. Outside-the-Box Thinking

49 ©2012 Check Point Software Technologies Ltd. And remember, kids: BinaryReverse Engineer + =?

50 ©2012 Check Point Software Technologies Ltd. Which means… F A I L

51 ©2012 Check Point Software Technologies Ltd. Questions?

52 ©2012 Check Point Software Technologies Ltd. Check your Opportunities We are looking for:  Excellent Computer Science/Software Engineering students for a variety of developing positions  Talented software developers  Security & Malware researchers To learn more about our openings please check our website:

53 ©2012 Check Point Software Technologies Ltd. Thank you!