Polymorphic Virus Analysis Nicolas BRULEZ Senior Virus Researcher Websense Security Labs IMPROVISED TALK MMMKAY?!

Slides:



Advertisements
Similar presentations
Pokas x86 Emulator for Generic Unpacking By Amr Thabet
Advertisements

Saumya Debray The University of Arizona Tucson, AZ
A look at interrupts What are interrupts and why are they needed.
RIVERSIDE RESEARCH INSTITUTE Helikaon Linux Debugger: A Stealthy Custom Debugger For Linux Jason Raber, Team Lead - Reverse Engineer.
Chapter 5 Anti-Anti-Virus. Anti-Anti-Virus  All viruses self-replicate  Anti-anti-virus means it’s “openly hostile” to AV  Anti-anti-virus techniques?
Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
A look at interrupts What are interrupts and why are they needed.
Reverse Engineering Ian Kayne For School of Computer Science, University of Birmingham 2 nd February 2009.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
SRE  Introduction 1 Software Reverse Engineering (SRE)
Internet Explorer 11 Developer Tools, F12, Just Got Nicer (Again)
Code Injection and Software Cracking’s Effect on Network Security Group 5 Jason Fritts Utsav Kanani Zener Bayudan ECE 4112 Fall 2007.
Game Scripting By: Nicholas Haines. Aurora Neverwinter Toolset.
Software Analysis & Deobfuscation Engine. Page  2  Project Name: SADE  Project Members: Faiza Khalid, Komal Babar and Abdul Wahab  Project Supervisor.
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.
Debugging a Program … Using the PC/370 Emulator Interactively !
Part 3: Advanced Dynamic Analysis Chapter 8: Debugging.
Windows PE files Infections and Heuristic Detection Nicolas BRULEZ / Digital River PACSEC '04.
Game Scripting by: Nicholas Haines. What is Scripting? Interpreted Language Interpreted Language –As the game runs.
EECS 354 Network Security Reverse Engineering. Introduction Preventing Reverse Engineering Reversing High Level Languages Reversing an ELF Executable.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Executable Unpacking using Dynamic Binary Instrumentation Shubham Bansal (iN3O) Feb 2015 UndoPack 1.
Problem of the Day  Why are manhole covers round?
RIVERSIDE RESEARCH INSTITUTE Deobfuscator: An Automated Approach to the Identification and Removal of Code Obfuscation Eric Laspe, Reverse Engineer Jason.
Debugging and Profiling With some help from Software Carpentry resources.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Analyzing Malicious Code Nicolas Brulez Ryan Russell Disassembly with a time constraint Recon 2005.
Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions.
Evolutionary Security CS 610: Advanced Security Gabriel Daleson.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Introduction to Information Security מרצים : Dr. Eran Tromer: Prof. Avishai Wool: מתרגלים : Itamar Gilad
Introduction to InfoSec – Recitation 3 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (infosec15 at modprobe.net)
Lecture 10 Anti-debugger techniques. Anti-debuggers Making reverse-engineering and disassembly painful –Polymorphism –Encryption –Interrupt disabling.
Cosc 4765 Antivirus Approaches. In a Perfect world The best solution to viruses and worms to prevent infected the system –Generally considered impossible.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Reverse Engineering Contemporary Countermeasures By: Joshua Schwartz.
EET 2261 Unit 6 The Stack; Subroutines
Shellcode COSC 480 Presentation Alison Buben.
Malware malicious software which is specifically designed to disrupt, damage, or gain authorized access to a computer system Analysis detailed examination.
An introduction to Reverse engineering, the tools and assembly
Lab assignments Follow each lab walkthrough in textbook
CHAPTER NINE.
Application of Obfuscation Techniques on Android Applications
Static and dynamic analysis of binaries
Live Phishing Attack Authentication Activity from a Foreign Address.
Chapter 1. Basic Static Techniques
Presented by Xiaohui (Amy) Lin
Testing and Debugging.
Assembly Language Programming Part 3
Techniques, Tools, and Research Issues
R4H Reversing for Humans
Malware Incident Response  Dynamic Analysis - 2
Computer Science 210 Computer Organization
Attacking Obfuscated Code with IDA Pro
Hmmm Assembly Language
Computer Science 210 Computer Organization
Lab assignments Follow each lab walkthrough in textbook
Part 5: Anti-Reverse-Engineering
Security Flaws 2 Ian Kayne
Tonga Institute of Higher Education IT 141: Information Systems
CMSC 491/691 Malware Analysis
Tonga Institute of Higher Education IT 141: Information Systems
EET 2261 Unit 6 The Stack; Subroutines
Setup a VM to use for analyzing malware
COMP755 Advanced Operating Systems
Hmmm Assembly Language
Software Development Techniques
Presentation transcript:

Polymorphic Virus Analysis Nicolas BRULEZ Senior Virus Researcher Websense Security Labs IMPROVISED TALK MMMKAY?!

Case Study: W32.BAYAN FEATURES: ● The virus is Polymorphic and very infectious. ● EPO : Entry Point Obscuring - the entry point address in the header is not modified, the virus injects code in the real entry point and hops around a few times, before it jumps to the virus entry point. ● Obfuscated layers, using junk instructions, and different decryption operations (simple ones tho). ● The junks code actually abuses a bug in VMWARE 5, so the virus actually crashed in the VM at the time of the analysis

The Encryption Layers ● The virus has Anti Vmware instructions inside his encryption layers. VERW reg : Exception! Does not crash on a real computer (only infection happens :-) Tracing the layers inside a VM was a pain because of their size and the fact that the number of layers is actually unknown when you start reversing it. ● Bypassing the layers. Look for a pattern! In most packers/viruses, there is always some sort of pattern you can use to identify loops boundaries. Pattern in the layers: cmp reg32,reg32 followed by a JB I used ollyscript to automate the layer tracing and anti VM code removal.

The Encryption Layers

The Encryption Layers: OllyScript ● We can control the debugger and automate debugging sessions ● Very useful to script unpackers ● So I wrote a dodgy Virus Tracer Remove Anti VM Locate end of layers Put breakpoints and resume execution ● Stop condition Most viruses use a call followed by a pop to calculate a delta address (Shellcodes and Packers use that too) So I assumed I would eventually find one of those right after the decryption and it worked :-)

DEMO Lame Polymorphic Layers Tracer

The Encryption Layers ● Process Dump: We can dump the process when we are at the virus entry point Static Analysis with IDA is now possible We can also debug our new dump and start directly from the virus code. No need to go through all the layers anymore ● Delta Based Code: Viruses usually use Delta Offsets. Code can be executed anywhere in memory. Harder to understand statically.

Static Analysis ● In order to read the code easily in IDA, you can load the file manually and substract the delta offset from the imagebase, in order to get a nice disassembly that you can interact with, without spending your time using an IDC script, structures or whatsoever. ● Just select Manual Load, and do something like 0xImagebase – 0xdelta in IDA, and the file is loaded nicely and gets a lot easier to analyse. ● Next slides don't use that technique, the code was loaded normaly. not enough time to redo them : Complain to Hugo ;-)

Get delta offset

Fix Removed Chunks

Home GetProcAddress

Anti Debugging: Exception

Anti Debugging: PEB.IsDebugged

Anti Debugging: MeltICE

Infection

Polymorphic Engine Reverse Engineering ● Polymorphic engines use: A Pseudo Random Number Generator Assembly instructions helping code generation (stosb etc) Loops to generate more than one layer A lot or pseudo randomness ● Helpful: Intel Opcodes doc to identify which instruction is generated by the polymorphic engine (im getting old :-/ ) Makes things easier and quicker

Poly Generator

Poly Engine

Questions Questions ? Thank you ! (Don't forget this was an improvised talk made in 20 minutes to replace someone who canceled)