Packers Models. simple. malware. advanced. allocation. decryption. decompression. engine loading. integrity check. DRM Management



Similar documents
Packers. (5th April 2010) Ange Albertini Creative Commons Attribution 3.0

TitanMist: Your First Step to Reversing Nirvana TitanMist. mist.reversinglabs.com

Self Protection Techniques in Malware

Software Fingerprinting for Automated Malicious Code Analysis

Inside a killer IMBot. Wei Ming Khoo University of Cambridge 19 Nov 2010

Abysssec Research. 1) Advisory information. 2) Vulnerable version

Parasitics: The Next Generation. Vitaly Zaytsev Abhishek Karnik Joshua Phillips

Analysis of Win32.Scream

Fighting malware on your own

AntiRE en Masse. Investigating Ferrie s Documented AntiUnpacking. Kurt Baumgartner, VP Behavioral Threat Research PCTools ThreatFire

A Museum of API Obfuscation on Win32

1. General function and functionality of the malware

Introduction to Reverse Engineering

Attacking Obfuscated Code with IDA Pro. Chris Eagle

WLSI Windows Local Shellcode Injection. Cesar Cerrudo Argeniss (

Return-oriented programming without returns

esrever gnireenigne tfosorcim seiranib

How To Build Bitdefender Antivirus

INTRODUCTION TO MALWARE & MALWARE ANALYSIS

REpsych. : psycholigical warfare in reverse engineering. def con 2015 // domas

Hotpatching and the Rise of Third-Party Patches

Detecting the One Percent: Advanced Targeted Malware Detection

Bypassing Anti- Virus Scanners

Removing Sentinel SuperPro dongle from Applications and details on dongle way of cracking Shub-Nigurrath of ARTeam Version 1.

Systems Design & Programming Data Movement Instructions. Intel Assembly

Harnessing Intelligence from Malware Repositories

So You Want To Analyze Malware? Tools, Techniques, and Mindset

Lecture 26: Obfuscation

How To Hack The Steam Voip On Pc Orchesterian Moonstone 2.5 (Windows) On Pc/Robert Kruber (Windows 2) On Linux (Windows 3.5) On A Pc

Fine-grained covert debugging using hypervisors and analysis via visualization

64-Bit NASM Notes. Invoking 64-Bit NASM

Reverse Engineering and Computer Security

Introduction. Application Security. Reasons For Reverse Engineering. This lecture. Java Byte Code

A Tiny Guide to Programming in 32-bit x86 Assembly Language

Heap-based Buffer Overflow Vulnerability in Adobe Flash Player

Buffer Overflows. Security 2011

Off-by-One exploitation tutorial

Securing Secure Browsers

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

Reverse Engineering by Crayon: Game Changing Hypervisor and Visualization Analysis

Complete 8086 instruction set

Where s the FEEB? The Effectiveness of Instruction Set Randomization

Hide and seek - how targeted attacks hide behind clean applications Szappanos Gábor

Assembly Language: Function Calls" Jennifer Rexford!

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail

Analysis and Diversion of Duqu s Driver

Computer Virus Strategies and Detection Methods

Binary Code Extraction and Interface Identification for Security Applications

Computer Organization and Assembly Language

Applied evaluation methodology for anti-virus software. EICAR Conference 2009

IEEE Software Taggant System in Action. Igor Muttik, McAfee Labs Mark Kennedy, Symantec

Application-Specific Attacks: Leveraging the ActionScript Virtual Machine

Peeking into Pandora's Bochs { Instrumenting a Full System Emulator to Analyse Malicious Software

Data Hiding Techniques

Attacking x86 Windows Binaries by Jump Oriented Programming

Peeling The Layers Of Vawtrak

Introduction. Figure 1 Schema of DarunGrim2

for Malware Analysis Daniel Quist Lorie Liebrock New Mexico Tech Los Alamos National Laboratory

Analyzing a New Variant of BlackEnergy 3 Likely Insider-Based Execution

風 水. Heap Feng Shui in JavaScript. Alexander Sotirov.

Melde- und Analysestelle Informationssicherung MELANI Torpig/Mebroot Reverse Code Engineering (RCE)

Bypassing Windows Hardware-enforced Data Execution Prevention

Anti-RE Techniques in DRM Code

Title: Bugger The Debugger - Pre Interaction Debugger Code Execution

File Disinfection Framework (FDF) Striking back at polymorphic viruses

Diving into a Silverlight Exploit and Shellcode - Analysis and Techniques

Peeking into Pandora s Bochs. Instrumenting a Full System Emulator to Analyse Malicious Software

Identification and Removal of

Storm Worm & Botnet Analysis

Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc

EU FP6 LOBSTER. personal view on the future of ero-day Worm Containment. European Infrastructure for accurate network monitoring

x64 Cheat Sheet Fall 2015

Computer Organization and Architecture

Syscall Proxying - Simulating remote execution Maximiliano Caceres <maximiliano.caceres@corest.com> Copyright 2002 CORE SECURITY TECHNOLOGIES

Windows XP SP3 Registry Handling Buffer Overflow

The Plan Today... System Calls and API's Basics of OS design Virtual Machines

Overview of IA-32 assembly programming. Lars Ailo Bongo University of Tromsø

CAS : A FRAMEWORK OF ONLINE DETECTING ADVANCE MALWARE FAMILIES FOR CLOUD-BASED SECURITY

Spyware Forensic With Reversing and Static Analysis PK TWCERT/CC

NGBPA Next Generation BotNet Protocol Analysis

CS61: Systems Programing and Machine Organization

Abysssec Research. 1) Advisory information. 2) Vulnerable version

CIT 480: Securing Computer Systems. Malware

Attacking Host Intrusion Prevention Systems. Eugene Tsyrklevich

Sandy. The Malicious Exploit Analysis. Static Analysis and Dynamic exploit analysis. Garage4Hackers

High-speed image processing algorithms using MMX hardware

Adi Hayon Tomer Teller

Violating Database - Enforced Security Mechanisms

This is DEEPerent: Tracking App behaviors with (Nothing changed) phone for Evasive android malware

Code Injection From the Hypervisor: Removing the need for in-guest agents. Matt Conover & Tzi-cker Chiueh Core Research Group, Symantec Research Labs

Attacks on Virtual Machine Emulators

The Value of Physical Memory for Incident Response

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

W4118 Operating Systems. Junfeng Yang

How Compilers Work. by Walter Bright. Digital Mars

CHAPTER 6 TASK MANAGEMENT

Deep Dive into.net Malwares

Intel 8086 architecture

Transcription:

allocation allocation (VirtualAlloc / empty section) trapped start allocation (VirtualAlloc / empty section) (MANY layers,add/rol/xor) startup decompression engine loading (one layer,add/rol/xor) (Tea/RC4/operators) integrity check packer stub decompression optimisation relocation decompression DRM Management imports loading obfuscation main body imports loading packer engine (partial) (advanced algorithms) original code jump to entry point cleaning jump to entry point relocations, imports,... tampering simple original code original code extra threads (monitoring, page guard,...) Models anti-analysis anti-debugger anti-emulation malware advanced http://corkami.googlecode.com/files/packers_models.pdf

extension (extra packer code is executed) transformation (original code is rewritten) Compression algorithms aplib LZMA NRV FFCE lzab lznt deflate LZMAT BriefLZ JCALG1 compresser Different architecture Stack + RISC x86 proprietary virtualiser Countermeasures anti-debuggers anti-emulation integrity check anti-dump DRM Checksum/hashes ROL+XOR crc32 md5 sha1 adler md4 tiger whirlpool protecter crypter bundler Original File mutater http://corkami.googlecode.com/files/packers_features.pdf Encryption algorithms add/xor/rol RC4 PRNG (LCG) *Tea Blowfish DES AES IDEA ElGamal File Embedding dropping injection API hooking Different code reflowing synonyms Categories & Features

Landscape Bundlers Virtualisers EntryPoint Patchers Commercial VMProtect Alexei Solodovnikov Vbox Oreans Code Virtualizer XProtector Themida Winlicence WareZ PseudoSigner Demos PECrypt32 Free FakeSigner AHT Entry Point Protector BJFNT mariopacker telock STonePE PEShrinker PEPaCK PEDiminisher RDG Tejon Crypter npack PenguinCrypt PE-Armor MZOoPE DragonArmour WWPack32 PackMan EXEFog NiceProtect PESpin Alex Protector CRYPToCRACk's PE Protector Krypton PolyEne Hacks [MSLRH] PolyCrypter PrivatePersonalPacker Escargot PolycryptPE Beria RLPack!ExePack Hmimys' Protector MicroJoiner KKryptor DingBoy PE-Lock PCGuard Anticrack Protector PELOCK NFO PeX YodaCrypter YodaProtector Berio EXEJoiner DOS ASProtect LaserLock Safedisc EXECryptor SecuROM ExeStealth Starforce Obsidium Tages ThinApp SecureEXE ZProtect Molebox ORiEN UltraProtect Enigma expressor Bartosz 'Bart' Wojcik NoobyProtect NTKrnl Ashkbiz 'y0da' Danehkar NorthStar NSAnti (Anti007) Pohernah Morphnah Morphine MaskPE PEBundle PECompact Games DRM Armadillo Bitsum RCryptor RPolycrypt RJoiner Malware Ange Albertini 2009-2010 http://code.google.com/p/corkami/source/browse/trunk/misc/graphs/packers_landscape.svg

detailed packers features compression (used on top of compression algorithms) section merging merge all sections (just one entry in the section table) imports imports are stored and loaded with a more compact import table format imports by hash exports are parsed until it matches a specific hash, instead of a GetP rocaddress call call optimisation turn relative operands of jumps and calls into absolute better compression resources compresses resources, avoiding critical ones (main icon, manifest,... ) protection token check presence check to allow the program to run: dongle, CD/DVD, key, file, network... fingerprinting token is specific to a hardware element: disk/os/cpu/mac/... demo mode inclusion of a demo binary/mode that is executed when token is absent or not enough privileged integrity check the contents are unmodified with checksum or hash anti-analysis overlap jumping after the first byte of an instruction illusion makes the analyst the something incorrect happened junk insertion of dummy code between relevant opcodes jumps insertion of jumps to makes analysis visually harder polymorphism different but equivalent code 2 packed files of the same source are different self generation packer stub generates polymorphic code on the fly same file executes differently virtualization virtualizes (part of) packer stub code harder analysis stack strings are built and decrypted before use, then discarded to avoid obvious references faking add fake code similar to known packers to fool identifcation thread use several parallel threads to make analysis harder timing comparing time between two points to detect unusual execution anti-debugging (and anti-tools, by extension) detect detect the presence of an attached debugger: IsDebuggerPresent prevent prevent a debugger to attach to the target itself or stay attached nuisance make debugger session difficult: BlockInput, slow down... thread spawn a monitoring thread to detect tampering, breakpoints,... artifacts detects a debugger by its artifact: window title, device driver, exports,... limitation prevent the use of a tool via a specific limitation exploit prevent the use of a tool via a specific vulnerability backdoor detect or crash a debugger via a specific backdoor self-debugging debug itself to prevent another debugger to be attached int1 block interruption 1 debuggers stop working fake add code of known packer to fool identification anti-dumping (prevent making a working executable from a memory image) tampering erase or corrupt specific file parts to prevent rebuilding (header, packer stub,... ) imports add obfuscation between imports calls and APIs (obfuscation, virtualization, stealing,... ) on the fly API address is resolved before each use to prevent complete dumping API hooking alter API behavior: redirect benign API to a critical one dump not working inlining copy locally the whole content of API code no more import calls relocate relocate API code in separate buffer calls don t lead to imported DLLs byte stealing move the first bytes of the original code elsewhere harder rebuilding and bypasses breakpoints page guard blocks of code are encrypted individually, and decrypted temporarily only upon execution flow flow opcodes are removed and emulated (or decrypted) by the packer during execution incorrect dump virtualization virtualizes (part of) original code, API start... dump not working without VM code anti-emulation opcodes using different opcodes sets (FPU, MMX, SSE) to block emulators undoc use of rare or undocumented opcodes to block non-exhaustive emulators API unusual APIs are called to block non-exhaustive emulators (anti-virus) loop extra loops are added to make time-constraint emulators give up bundlers drop original file is written to disk then executed injection original file is injected in existing process no new file on disk + higher privileges hooking file handling APIs are modified to make embedded files usable like external ones Ange Albertini, 2010, cc by 3.0 http://corkami.googlecode.com/files/packers_details.pdf source

_2: mov eax, _1 push dword ptr fs:[0] mov fs:[0], esp xor eax, eax mov [eax], ecx mov eax, <random1> lea ecx, [eax + <random2>] mov [ecx + 1], eax mov edx, [esp + 4] mov edx, [edx + c] mov byte ptr [edx], 0e9 add edx, 5 sub ecx, edx mov [edx - 4], ecx xor eax, eax retn mov eax, 12345678 pop dword ptr fs:[0] add esp, 4 PECOMPACT mov esi, <address> mov ebx, esi xchg eax, edi mov dl, 80 movsb mov dh, 80 call [ebx] jnb _2 jmp _1 MEW http://corkami.googlecode.com/files/packers_starts.pdf FSG xchg [_1], esp popad xchg eax, esp movsb mov dh, 80 call [ebx] jnb _1 xor ecx, ecx call [ebx] UPX (LZMA) pushad mov esi, <address> lea edi, [esi + <negative>] mov ebp, esp lea ebx, [esp - 3E80] xor eax, eax cmp esp, ebx jnz _1 inc esi inc esi push 0C478 add ebx, 4 push 534E push esi add ebx, 4 mov dword ptr [ebx], 20003 push esi sub esp, 7C mov edx, [esp + 90] pusha call _1 db 0E9h ; E9 EB045D45 CALL... _2: jmp _2 pop inc ebp ebp retn db 0EBh _3: pushad mov lea push call _3 pop esi, <address> edi, [esi + <negative>] edi or ebp, ffffffff ; * Not in UPX >3 jmp $ + 12 ; * ; * ; * ; * ; * mov inc mov al, [esi] esi [edi], al ebp mov esi, <address> ; EB54 JMP <garbage> push dword ptr [esi+34] jmp short _1 push dword ptr [esi+38] UPX Upack AsPack mov edi, [esi] mov esi, <address2> EntryPoints

start: pushad mov esi, [esp + 24] mov edi, [esp + 28] cld mov dl, 80 xor ebx, ebx copy_literal: movsb mov bl, 2 next: call getbit jnb short copy_literal xor ecx, ecx call getbit sub esi, eax rep movsb pop esi jmp next getbit: add dl, dl jnz skip mov dl, [esi] inc esi adc dl, dl skip: retn APLIB end: sub edi, [esp + 28] mov [esp + 1c], edi popad retn 0c Algorithms http://corkami.googlecode.com/files/packers_algos.pdf CRC32 crcloop: test eax, 1 jz no_xor shr eax, 1 xor eax, 0EDB88320h jmp loop no_xor: shr eax, 1 loop: loop crcloop start: mov ebp, esp add esp, -54 push esi mov [ebp - c], ecx $+84: add ecx, [ebp - 34] mov eax, 300 shl eax, cl add eax, 736 dec eax test eax, eax jb no_init inc eax mov [ebp - 2c], 0 init_buffer: mov edx, [ebp - 10] mov ecx, [ebp - 2c] mov [edx + ecx * 4], 400 inc [ebp - 2c] dec eax jnz init_buffer no_init: LZMA mov al, 1 pop edi pop esi pop ebx mov esp, ebp pop ebp retn 10