OLD WIN32 CODE FOR A MODERN, SUPER-STEALTH TROJAN



Similar documents
5 Steps to Advanced Threat Protection

PuttyRider. With great power comes great responsibility. # Pivoting from Windows to Linux in a penetration test. Adrian Furtunã, PhD adif2k8@gmail.

Attacking Host Intrusion Prevention Systems. Eugene Tsyrklevich

ITSC Training Courses Student IT Competence Programme SIIS1 Information Security

Host-based Intrusion Prevention System (HIPS)

Proxies. Chapter 4. Network & Security Gildas Avoine

Securing Secure Browsers

INSTANT MESSAGING SECURITY

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

Step-by-Step Configuration

What s Wrong with Information Security Today? You are looking in the wrong places for the wrong things.

Solution of Exercise Sheet 5

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

STANDARD ON CONTROLS AGAINST MALICIOUS CODE

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

FIREWALLS & NETWORK SECURITY with Intrusion Detection and VPNs, 2 nd ed. Chapter 5 Firewall Planning and Design

Architecture. The DMZ is a portion of a network that separates a purely internal network from an external network.

Release Notes for Websense Web Endpoint (32- and 64-bit OS)

Reverse Shells Enable Attackers To Operate From Your Network. Richard Hammer August 2006

Security Evaluation CLX.Sentinel

Online Payments Threats

K7 Mail Security FOR MICROSOFT EXCHANGE SERVERS. v.109

Inside-Out Attacks. Security Event April 28, 2004 Page 1. Responses to the following questions

Application Security Testing

Chapter 9 Firewalls and Intrusion Prevention Systems

CMPT 471 Networking II

Deep Discovery. Technical details

KASPERSKY FRAUD PREVENTION FOR ENDPOINTS

Storm Worm & Botnet Analysis

Desktop and Laptop Security Policy

Inside Windows Rootkits

Firewalls. Firewalls. Idea: separate local network from the Internet 2/24/15. Intranet DMZ. Trusted hosts and networks. Firewall.

ESET SMART SECURITY 9

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

How Reflection Software Facilitates PCI DSS Compliance

Course Description. Course Audience. Course Outline. Course Page - Page 1 of 12

Covert Operations: Kill Chain Actions using Security Analytics

PaperCut Payment Gateway Module - RBS WorldPay Quick Start Guide

PROTECTING DATA IN TRANSIT WITH ENCRYPTION IN M-FILES

Computer Viruses: How to Avoid Infection

Basic Computer Security Part 2

Lectures 9 Advanced Operating Systems Fundamental Security. Computer Systems Administration TE2003

Basic Setup Guide. Remote Administrator 4 NOD32 Antivirus 4 Business Edition Smart Security 4 Business Edition

Högskolan i Halmstad Sektionen för Informationsvetenskap, Data- Och Elektroteknik (IDÉ) Ola Lundh. Name (in block letters) :

ANTIVIRUS BEST PRACTICES

Advanced Endpoint Protection Overview

This report is a detailed analysis of the dropper and the payload of the HIMAN malware.

Steps for Basic Configuration

Firewalls, Tunnels, and Network Intrusion Detection

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

Evading Infrastructure Security Mohamed Bedewi Penetration Testing Consultant

Inside-Out Attacks. Covert Channel Attacks Inside-out Attacks Seite 1 GLÄRNISCHSTRASSE 7 POSTFACH 1671 CH-8640 RAPPERSWIL

HowTo. Firewall Avira Premium Security Suite

Smartphone Hacks and Attacks: A Demonstration of Current Threats to Mobile Devices

User Documentation Web Traffic Security. University of Stavanger

ESET SMART SECURITY 6

How Spyware and Anti-Spyware Work

What is Firewall? A system designed to prevent unauthorized access to or from a private network.

CS 356 Lecture 19 and 20 Firewalls and Intrusion Prevention. Spring 2013

Windows Client/Server Local Area Network (LAN) System Security Lab 2 Time allocation 3 hours

Firewall Architectures of E-Commerce

Brazosport College VPN Connection Installation and Setup Instructions. Draft 2 March 24, 2005

Gateway Security at Stateful Inspection/Application Proxy

How to make the s you Send with Outlook and Exchange Appear to Originate from Different Addresses

QUANTIFY INSTALLATION GUIDE

Tunnels and Redirectors

Web Plus Security Features and Recommendations

Best Practices for Deploying Behavior Monitoring and Device Control

Enterprise Cybersecurity: Building an Effective Defense

Eugene Tsyrklevich. Ozone HIPS: Unbreakable Windows

Network Defense Tools

Inspection of Encrypted HTTPS Traffic

Spy Eye and Carberp the new banker trojans offensive

Firewalls, Tunnels, and Network Intrusion Detection. Firewalls

Detecting the One Percent: Advanced Targeted Malware Detection

Symantec Endpoint Protection 11.0 Network Threat Protection (Firewall) Overview and Best Practices White Paper

Section 12 MUST BE COMPLETED BY: 4/22

How To Block Unauthorized Internet Access through Proxies

Debug Failed to connect to server!

WEB SECURITY. Oriana Kondakciu Software Engineering 4C03 Project

FOR MAC. Quick Start Guide. Click here to download the most recent version of this document

Network Configuration Settings

Alert (TA14-212A) Backoff Point-of-Sale Malware

NAC Guest. Lab Exercises

Security Technology: Firewalls and VPNs

GoToMyPC Corporate Advanced Firewall Support Features

Making the difference between read to output, and read to copy GOING BEYOND BASIC FILE AUDITING FOR DATA PROTECTION

Top Ten Cyber Threats

Title: Bugger The Debugger - Pre Interaction Debugger Code Execution

Detecting Malware With Memory Forensics. Hal Pomeranz SANS Institute

Click Studios. Passwordstate. Installation Instructions

6WRUP:DWFK. Policies for Dedicated IIS Web Servers Group. V2.1 policy module to restrict ALL network access

BUILDING A SECURITY OPERATION CENTER (SOC) ACI-BIT Vancouver, BC. Los Angeles World Airports

Network Security. Tampere Seminar 23rd October Overview Switch Security Firewalls Conclusion

Transcription:

OLD WIN32 CODE FOR A MODERN, SUPER-STEALTH TROJAN BLACKHAT EUROPE 2004 Eric DETOISIEN Team Rstack Eyal DOTAN Tegam International

Agenda Introduction Communication model Code injection API Hooking Final demo Future evolutions Prevention Conclusion BlackHat Europe 2004 2

Introduction Today there are reliable (?) methods for securing public part of the information system from outside threats (hardening, defense in depth, authentication, crypto, ) But the weakest link in information security is still the endpoint a.k.a the workstations. Even if sysadmins can trust their users, how can they trust the programs they are running? BlackHat Europe 2004 3

Introduction Trojan horses are more and more widespread, they are very interesting to target the end-user. But most Trojan horses are easily detectable and thus are inefficient in a corporate environment behind firewalls, proxies, and desktop security software. BlackHat Europe 2004 4

Introduction In this presentation, we will show that it is perfectly possible to implement a super-stealth Trojan horse using Win32 techniques that have been around for over 10 years now. We will also discuss prevention methods and discuss about the existence of such stealth programs. We ll assume the following protections : User privileges, Desktop Firewall, Edge Firewall, authentication-enabled Proxy BlackHat Europe 2004 5

Communication Model Communication capability is the first thing that trojan needs The Trojan horse communicates with the outside world via HTTP protocol. It regularly checks for instructions on a Web server maintained by the attacker. Edge firewalls see HTTP requests initiated from inside the network, but they cannot tell the difference between this and a regular Web trafic from a browser BlackHat Europe 2004 6

Communication Model BlackHat Europe 2004 7

Communication Model This communication mechanism is basic and still quite efficient. HTTP Covert Channel isn t new in the security world (HTTPTunnel, Setiri, webdownloader, ) but trojans with this function aren t widely diffused (why?) In a Windows environment the simplest way is to use WININET.DLL BlackHat Europe 2004 8

Communication Model DEMO [ Simple trojan based on WININET.DLL for HTTP communication] BlackHat Europe 2004 9

Communication Model HTTPTrojanBasic skills HTTP communication IE Proxy configuration detection HTTPTrojanBasic drawbacks Detected by Personal Firewall Blocked by proxy authentification Not stealthy Survival instinct very low BlackHat Europe 2004 10

Code Injection Code injection mechanism Code injection is a technique that has been known for about 10 years: "Load Your 32-bit DLL into Another Process's Address Space Using INJLIB" - Jeffrey Richter (May 1994). Direct code injection (no DLL, pure thread injection). Harder to code but more stealther Most importantly: no particular rights are required. All processes that belong to the same user can be injected. BlackHat Europe 2004 11

APIs for code injection: Code Injection OpenProcess : get handle on target process VirtualAllocEx : memory allocation in target process WriteProcessMemory : inject (write) code into allocated memory CreateRemoteThread : execute code from target process BlackHat Europe 2004 12

Code Injection Benefits for a Trojan horse Bypassing desktop firewalls by injecting authorized applications. Even behavior monitoring software can be fooled by such manipulation. Allows the Trojan to easily hook APIs in injected processes, for other purposes (which we ll see in the next section). BlackHat Europe 2004 13

Code Injection BlackHat Europe 2004 14

Code Injection BlackHat Europe 2004 15

Code Injection DEMO [ Previous simple trojan but now it s injected in process] BlackHat Europe 2004 16

Code Injection HTTPTrojanInjected skills HTTP communication IE Proxy configuration detection Personal Firewall bypass Stealthy HTTPTrojanInjected drawbacks Blocked by proxy authentification Survival instinct very low BlackHat Europe 2004 17

Code Injection Use in existing malicious programs Today there are several malicious programs that use injection techniques (not necessarily for the same goals described above) : BackStealth (proof of concept) Optix, Beast and other Trojan horses Keylogger BlackHat Europe 2004 18

Code Injection Taking code injection farther «Inject and die»: once the Trojan injected its code, it can terminate and disappear from Windows task manager and process list. Survival of the injected thread: once the Trojan horse dies, it depends on the survival of injected processes. Solution: injecting all user processes at a regular interval. BlackHat Europe 2004 19

Code Injection DEMO [Multi-Injection Proof of Concept] BlackHat Europe 2004 20

New skills Code Injection Very good survival instinct Control of all processes «Still here» drawbacks Blocked by proxy authentification BlackHat Europe 2004 21

How does it work? API Hooking API hooking has also been known for 10 years: "Peering Inside the PE: A Tour of the Win32 Portable Executable File Format" - Matt Pietrek (March 1994) Most popular method: IAT (Import Address Table) hooking. BlackHat Europe 2004 22

API Hooking Doesn t work well for Trojan horses: 1. Not all APIs are IAT-hook friendly! Some APIs call other APIs directly, without using the IAT (LoadLibrary & GetProcAddress) 2. When the Trojan horse is injected, the program may have already obtained the API s address, before the Trojan could hook GetProcAddress. Best method we know of: JMP redirection BlackHat Europe 2004 23

API Hooking BlackHat Europe 2004 24

API Hooking BlackHat Europe 2004 25

API Hooking BlackHat Europe 2004 26

API Hooking BlackHat Europe 2004 27

API Hooking int WINAPI SendHook(SOCKET s, const char FAR * buf, int len, int flags) { DWORD ZoneTampon; int Result; // Pre-processing... } // Call original API _asm { push flags push len push buf push s call ZoneTampon mov Result, eax } // Post-processing... return (Result); BlackHat Europe 2004 28

API hooking: What for? API Hooking Identifying communication applications: hooking socket APIs such as «connect». Intercepting the CreateProcess API -- making thread survival more efficient, more aggressive. Every time a process is created, the Trojan horse injects it. BlackHat Europe 2004 29

API Hooking Rootkit-like features: hiding files and registry keys to hide the Trojan s most visible items: registry keys for execution at startup, as well as the Trojan s binary itself. All in user mode, and without local administration privileges! API hooking allows the Trojan to log local TCP/IP trafic in user mode and without Admin privileges. BlackHat Europe 2004 30

API Hooking Here are some actions a Trojan horse can perform : Spy e-mail, proxy and socks passwords (send hook) Spy incoming and outgoing e-mail messages (recv & send hooks) Spy Web authentication data & forms (recv & send hooks) Intercept and deny / simulate anti-virus processes connecting to their signature update servers (specific, depends on which anti-virus is to be aimed). BlackHat Europe 2004 31

API Hooking Malware and API hooking today Some malicious programs have implemented API hooking as of today (rootkit like Hacker Defender or Vanquish) Taking API hooking farther No DLL injection (same as for thread injection) Hooking essential APIs: Winsock APIs, but also LoadLibraryW. BlackHat Europe 2004 32

Final Demo CASPER THE FRIENDLY TROJAN He really wants to be your friend BlackHat Europe 2004 33

Injection & API Hooking Future Evolutions Try to inject code without CreateRemoteThread Include a length-disassembler engine for API Hooking BlackHat Europe 2004 34

Bypassing anti-viruses Future Evolutions This kind of Trojan horses is made for aimed attacks, not for mass distribution. Still, the Trojan horse can escape detection in case it becomes known, by implementing an auto-update feature that keeps changing the Trojan horse s binary. BlackHat Europe 2004 35

Bypassing anti-viruses Future Evolutions This kind of auto-update feature is very common for legitimate software. Why not expect to see autoupdating malware? BlackHat Europe 2004 36

Future Evolutions Different communication protocols For our proof-of-concept Trojan horse, we ve used HTTP protocol. Other protocols may be used as well: DNS, FTP or SMTP for example. BlackHat Europe 2004 37

Sniffing encrypted traffic Future Evolutions When the navigator communicates via HTTPS, data sent via the «send» function is encrypted. By intercepting higher-level APIs, we can see the data before it is encrypted. This depends on the Web browser used. Internet Explorer uses high-level WININET APIs, which allows the Trojan to intercept data before it is encrypted. BlackHat Europe 2004 38

Remote control Future Evolutions This kind of Trojan horse would be even more efficient if it had real-time remote control (just like VNC). The problem left to resolve is the inversed client-server communication we re using -- too heavy for this kind of operations and the HTTP tunneling. BlackHat Europe 2004 39

Prevention Hence, prevention is better than cure. Protection can be achieved by these steps : 1. Don t let come unknow code to the user 2. Educate user to avoid click everywhere symptom 3. Securing the users workstations from untrusted code. BlackHat Europe 2004 40

Prevention HTTP, FTP and SMTP filters can help, to keep users away from unauthorized executable code. Educating and training users to keep away from untrusted code. Specific anti-injection techniques (i.e hooking CreateRemoteThread). But this is not the end of the story There are other more indirect ways of injecting code into other processes. BlackHat Europe 2004 41

Conclusion In Windows, whenever a malicious program is executed, its possibilites are almost unlimited. Question: since most of the techniques shown in this presentation already exist, how come we don t see many Trojan horses using them? Possible answer: The fact that the Win32 API has only recently been unified (i.e. thread injection didn t exist in Windows 9x, and API hooking was quite different from Windows 9x to NT systems). BlackHat Europe 2004 42

Conclusion Q&A THANK YOU Eric DETOISIEN http://www.rstack.org http://valgasu.rstack.org valgasu@rstack.org Eyal DOTAN Tegam International http://www.viguard.com edotan@viguard.info http://valgasu.rstack.org/casper/ BlackHat Europe 2004 43