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



Similar documents
Storm Worm & Botnet Analysis

Overview. Common Internet Threats. Spear Phishing / Whaling. Phishing Sites. Virus: Pentagon Attack. Viruses & Worms

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

Mobile Application Hacking for Android and iphone. 4-Day Hands-On Course. Syllabus

The Value of Physical Memory for Incident Response

Windows Operating Systems. Basic Security

ZeroAccess. James Wyke. SophosLabs UK

Hotpatching and the Rise of Third-Party Patches

Spyware Analysis. Security Event - April 28, 2004 Page 1

Reverse Engineering and Computer Security

Detecting Malware With Memory Forensics. Hal Pomeranz SANS Institute

CIT 480: Securing Computer Systems. Malware

Automating Linux Malware Analysis Using Limon Sandbox Monnappa K A monnappa22@gmail.com

Inside the Storm: Protocols and Encryption of the Storm Botnet

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

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

Hypervisor-Based, Hardware-Assisted System Monitoring

Network Incident Report

Information. Product update Recovery. Asset manager. Set console address Create recovery point. Client properties

ENEE 757 CMSC 818V. Prof. Tudor Dumitraș Assistant Professor, ECE University of Maryland, College Park

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

Quick Start Guide. Version R91. English

CSE509 System Security

Implementation and Implications of a Stealth Hard-Drive Backdoor

Fine-grained covert debugging using hypervisors and analysis via visualization

A Hypervisor IPS based on Hardware assisted Virtualization Technology

Online Payments Threats

Debugging Windows Applications with IDA WinDbg Plugin Copyright 2011 Hex-Rays SA

Virtualization System Vulnerability Discovery Framework. Speaker: Qinghao Tang Title:360 Marvel Team Leader

CS 356 Lecture 25 and 26 Operating System Security. Spring 2013

A+ Guide to Software: Managing, Maintaining, and Troubleshooting, 5e. Chapter 3 Installing Windows

Attacking Obfuscated Code with IDA Pro. Chris Eagle

USB Portable Storage Device: Security Problem Definition Summary

That Point of Sale is a PoS

Uroburos Highly complex espionage software with Russian roots

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Botnets Die Hard Owned and Operated

Ethical Hacking and Information Security. Foundation of Information Security. Detailed Module. Duration. Lecture with Hands On Session: 90 Hours

OS Security. Malware (Part 2) & Intrusion Detection and Prevention. Radboud University Nijmegen, The Netherlands. Winter 2015/2016

2. From a control perspective, the PRIMARY objective of classifying information assets is to:

LASTLINE WHITEPAPER. In-Depth Analysis of Malware

VISA SECURITY ALERT December 2015 KUHOOK POINT OF SALE MALWARE. Summary. Distribution and Installation

Operation Liberpy : Keyloggers and information theft in Latin America

Networks and Security Lab. Network Forensics

1 hours, 30 minutes, 38 seconds Heavy scan. All scanned network resources. Copyright 2001, FTP access obtained

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

Virtually Secure. a journey from analysis to remote root 0day on an industry leading SSL-VPN appliance

DRIVE-BY DOWNLOAD WHAT IS DRIVE-BY DOWNLOAD? A Typical Attack Scenario

Adi Hayon Tomer Teller

Inside Windows Rootkits

Real World and Vulnerability Protection, Performance and Remediation Report

CSE331: Introduction to Networks and Security. Lecture 32 Fall 2004

Certified Secure Computer User

Hardware Enabled Zero Day Protection

Malicious Programs. CEN 448 Security and Internet Protocols Chapter 19 Malicious Software

Redline Users Guide. Version 1.12

ERNW Newsletter 42 / December 2013

Radware Security Research. Reverse Engineering a Sophisticated DDoS Attack Bot. Author: Zeev Ravid

Security Evaluation CLX.Sentinel

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

Locking down a Hitachi ID Suite server

Contents. vii. Preface. P ART I THE HONEYNET 1 Chapter 1 The Beginning 3. Chapter 2 Honeypots 17. xix


Spam and All Things Salty: Spambot v2013

Installing, Uninstalling, and Upgrading Service Monitor

USB Portable Storage Device: Security Problem Definition Summary

UltraBac Documentation. UBDR Gold. Administrator Guide UBDR Gold v8.0

Operating System Installation Guidelines

Agenda. Taxonomy of Botnet Threats. Background. Summary. Background. Taxonomy. Trend Micro Inc. Presented by Tushar Ranka

Abstract. 1. Introduction. 2. Threat Model

Optimized Mal-Ops Hack ad networks like a boss

International Journal of Enterprise Computing and Business Systems ISSN (Online) :

The Citadel Banking Malware: Capabilities, Development History and Use in Cyber Crime

Cyber Security in Taiwan's Government Institutions: From APT To. Investigation Policies

Virtualization Technology

Trend Micro Incorporated Research Paper Adding Android and Mac OS X Malware to the APT Toolbox

Multifaceted Approach to Understanding the Botnet Phenomenon

Mass Pwnage 4 Dummies. Latest pen-testing tricks using Metasploit

Getting Ahead of Malware

Penetration Test Methodology on Information-Security Product Utilizing the Virtualization Technology

Operating System Security

Virtual Machine Security

CYBER ATTACKS EXPLAINED: THE MAN IN THE MIDDLE

FORBIDDEN - Ethical Hacking Workshop Duration

Avira Server Security. HowTo

Advancements in Botnet Attacks and Malware Distribution

2010 Carnegie Mellon University. Malware and Malicious Traffic

BOOTKITS: PAST, PRESENT & FUTURE Eugene Rodionov ESET, Canada Alexander Matrosov Intel, USA David Harley ESET North America, UK

Security Awareness For Website Administrators. State of Illinois Central Management Services Security and Compliance Solutions

Spy Eye and Carberp the new banker trojans offensive

Bypassing Local Windows Authentication to Defeat Full Disk Encryption. Ian Haken

PRACTICAL MALWARE ANALYSIS Kris Kendall

Security A to Z the most important terms

OS KERNEL MALWARE DETECTION USING KERNEL CRIME DATA MINING

Transcription:

Melde- und Analysestelle Informationssicherung MELANI Torpig/Mebroot Reverse Code Engineering (RCE) Andreas Greulich, MELANI Swiss Cyber Storm, 18 April 2009

Agenda Part 1: Introduction (~5 ) Infection machanism of a new drone Rendez-vous mechanism (DNS algorithms) Components of Mebroot/Torpig Part 2: Demo - how to get a copy of unpacked bootkit (~20 ) Usermode vs. Kernel (Ring0) debugging Kernel debugger setup using VMWare Static analysis to find breakpoint for dynamic analysis (using Interactive Disassembler IDA + HexRays decompiler) Dynamic analysis to get unpacked bootkit from an infected drone (using Windbg and VMWare) Melde- und Analysestelle Informationssicherung MELANI Torpig/Mebroot, Andreas Greulich, 18. April 2009 2

Domains For Drive-By Infection (Neosploit) http://www.zdnet.de/security/news/0,39029460,39197209,00.htm http://www.pcworld.com/article/151831/researcher_finds_evidence_of_massive_site_compromise.html http://www.aladdin.com/forms/airc-news-entries/form.aspx?cid=neosploit 3

Neosploit Drive-By, Step 1: Unpatched PC Accesses Compromised Website PC (clean) Hacked website (Neosploit) in Switzerland Obfuscated Javascript: Redirection DNS-name = f(date) Rendez-vous point for infection: 1 new name all 3 days Example: dtugidfir.com (Apr 18) 4

Step 2: Search For Vulnerabilities PC (clean) Obfuscated Javascripts: Check for vulnerabilities, Download and execute exploit dtugidfir.com One location, Somewhere in the world 5

Step 3: Execution Of Exploit + Reboot PC (about to be infected) Exploit executes, Wait random time (~20 minutes) Copy Bootkit into unpartitioned part of disk Overwrite Master Boot Record (MBR) Reboot 6

Step 4: Software Updates (Every Reboot) Infected Drone MBR xtjhvcjh.com MBR Command&Control (MBR CC) Encrypted and hashed! Every week 1024 new rendezvous points are generated, queried until reply with correct encryption is found (the order is random after the first few tries) Uses BIP protocol Drone reports version of bootkit and plugins (Torpig) Server sends updates for bootkit and plugins (initially there are no plugins installed) 7

Step 5: Configuration File, Webinjects, Stelaing Of Data Some E-banking site Webbrowser Infected Drone with Torpig plugins MBR Torpig yfesyrpa.com Configuration file Patterns of target banks 66.29.115.68 Webinjects and Dropbox for stolen data Listed as IP address In configuration file! 8

Overview Of Attacker Infrastructure 3 different DNS-algorithms, different encryption algorithms (but Only the MBR CC one is advanced) Configuration: visited All ~20 minutes yfesyrpa.com Configuration file Patterns of target banks Hacked webserver Hacked (Neosploit) webserver in Hacked Switzerland (Neosploit) webservers in Switzerland (Neosploit) in Switzerland Software updates: visited One time per reboot xtjhvcjh.com MBR Command&Control (MBR CC) Dropbox: As soon as User uses E-banking 66.29.115.68 Webinjects and Dropbox for stolen data Listed as IP address In configuration file! dtugidfir.com One location, Somewhere in the world Infection: visited one time 9

Obfuscated Javascript (Shortened), Layer 1 10

Obfuscated Javascript (Shortened), Layer 2 11

Obfuscated Javascript (Shortened), Layer 3 12

Encryption Algorithms Configuration file: XOR-11 (Torpig) okc 44749 phtc?ut1sp^?zx^?v?uzs?ut1sp^?zx^?v? pcex^?sp^?z?ut Subconfig: BASE64-XOR (Torpig) POST /3AEFBA86C8B89862/MGJmlWUXX1Q1HzTrf/4QUBAixtXBZbsCILtWHF1sIgHgB9OgIAfeIIUfFJ9+ rkeh4kdzjefcwxwhk6br6g/auhasbgwrbh/arl4go0p7def0zrnbdsobbvdaqdq6wyxqenjwluxxwkx AK1ELqmslESCScgE Advanced encryption algorithm in Mebroot (MAOS) 13

Components in Infected Drone MBR (3 sectors) Kernel-Mode: Stealth functions Updates User-Mode: API Hooking, Stealing of data API Stealth Torpig Plugin gc00 Bootkit (~250KB packed, ~500KB unpacked) Torpig Plugin gs00 Malware Operating System (MAOS) Inject into executables, Steal data, Webinjects Hidden TCP connections TCP-Stack KERNEL MODE USER MODE 14

Boot Procedure 0: Master Boot Record 60: Kernel patcher 61: Payload patcher 62: Original MBR MBR-code hooks INT13 patches OSLOADER to call kernel patcher scans and patches NTOSKRNL.EXE to call payload loader loads, decrypts and installs rootkit Disk partitions system32/ contains 2 or more encrypted drivers (currently 3) Main funcionality of malware (Anserin) Data area behind disk partitions (slack space), ~650 raw sectors: SYS driver (encrypted) Stealth functionality Used part of disk Torpig part for malware functions: hooks into programs, intercepts sessions, accesses configuration files. Can easily be replaced by other malware! Installs, Updates (at bootup) Mebroot part for stealth functions: own TCP stack, hides disk sectors, implements system calls, : Like an OS within Windows : Malware-OS (MAOS)? System calls into MAOS API (20 functions) 15

Bootkit Hidden Behind Partitions 16

Kernel Debugging (WinDbg) Two Physical Systems! Kernel Debugger (WinDbg) Serial Interface or Firewire Debuggee (infected drone) Serial Interface or Firewire 17

Kernel Debugging (WinDbg) Using VMWare http://silverstr.ufies.org/lotr0/windbg-vmware.html HOST Kernel Debugger (WinDbg) VMWARE (GUEST) Debuggee (infected drone) Named Pipe Serial Interface or Firewire 18

Encrypted Bootkit: Unpacker With Spaghetti-Code Obfuscation Unpacker Compressed and encrypted rootkit (~250KB) 19

Bootkit After Decryption (~500KB) Deobfusctaion is possible using a kernel debugger (WinDbg) Shown in Demo Bootkit hooks IRP_MJ_READ and IRP_MJ_WRITE (disk read and write) for stealth purposes (original MBR). Newer versions hook pointers all IRP_MJ_* pointers and add dummy handlers to avoid detection by anomalies in pointer table. CDROM.SYS dispatch table is hooked as well. Values in CLASSPNP.SYS Pointers are updated. Newer versions add a watchdog thread to avoid restoring the original pointers (Virus Bulletin, June 2008, pp 8-10) 20

Additional Obfuscation: State Machines state = 39; LABEL_2: result = STATUS_INSUFFICIENT_RESOURCES; while ( state <= 60 ) if ( state > 38 ) goto INIT39; if ( state == 14 ) fix22or19 = (fix96 ^ 115) + 3; if ( (*baseaddr_ * *baseaddr_ & 3) == 2 *baseaddr_ == 0 ) fix22or19 = fix96 ^ 115; state = fix22or19; fix71 = fix96 ^ 39; result = STATUS_ADDRESS_ALREADY_ASSOCIATED; } else if ( state == 19 ) pool = ExAllocatePoolWithTag(poolType, size_, ' kdd');... goto LABEL_2; }... INIT39: // initial state (state==39) fix14or22 = 14; if ( (baseaddr 2) + (baseaddr^2)!= 0 & baseaddr==0 (size 2) + (size^2)!= 0 & size_ == 0 ) fix14or22 = 22; state = fix14or22; result = STATUS_INVALID_PARAMETER; fix96 = 96; } } 21

It Can Be Really Hard state = 28; resstate = (unsigned int *)state; if ( state > 27 ) break; if ( state!= 7 )// STATE 7 goto INIT_28; 22

Commands Used in Mebroot Protocol INFO (client to server): send secondary key used by Torpig/Anserin BASE64-XOR-encryption PLUG (client to server): send information about installed plugins (currently the Torpig/Anserin modules) INST (server to client): install or update plugins Other unknown commands (found in binary, not seen in actual traffic): DUPL UNST (deinstalls Torpig/Anserin and/or Mebroot) DUMP Bootkit contains an uninstallation function 23

Sinowal Domains for Main Configuration Used by Torpig in order to get the main configuration file; it comes in a daily changing and a weekly changing version backup for fix servers: <Start Tag=1 RawData=1D:01 IntValue=285/> <Timestamp Tag=2 Value=1223460061 Date='Wed Oct 8 12:01:01 2008'/> <PollInterval Tag=10 Seconds=600/> <TmpFile1 Tag=5 Filename='$_2341234.TMP'/> <TmpFile2 Tag=6 Filename='$_2341233.TMP'/> <Host1 Tag=19 Hostname='fonzi.info'/> <IP1 Tag=21 IP='190.183.63.81'/> <HostList1 Tag=34 entries=3> fibido.com givuifib.com nirkaza.com </HostList1> <HostList2 Tag=31 entries=2> firkan.com kctfdiij.com </HostList2> <TargetHostPatterns1 Tag=25 entries=11> *bank1.com *barnsley-bs.co.uk *cimbanque.com Server for Sub-Configuration Fix servers for main configuration Main patterns (level 1) 24

Questions? 25