1 Code/DLL Injection ECE4112 – Internetwork Security Georgia Institute of Technology By Andrei Bersatti and Brandon Harrington.

Slides:



Advertisements
Similar presentations
Thank you to IT Training at Indiana University Computer Malware.
Advertisements

1 Computer and Internet Security JCCAA Presentation 03/14/2009 Yu-Min (Phillip) Hsieh Sr. System Administrator Information Technology Rice University.
By Hiranmayi Pai Neeraj Jain
Anti-Cheating Mechanisms for Computer Games Michael Rudolph Jason Cook.
Parameter Tampering. Attacking the Ecommerce Shopping Cart In the above image we see that a user who wants to purchase a Television visits an online Store.
Operating System Security : David Phillips A Study of Windows Rootkits.
RIVERSIDE RESEARCH INSTITUTE Helikaon Linux Debugger: A Stealthy Custom Debugger For Linux Jason Raber, Team Lead - Reverse Engineer.
Configuring Windows Vista Security Lesson 8. Skills Matrix Technology SkillObjective DomainObjective # Setting Up Users Configure and troubleshoot parental.
AVG 8.5 Product Line Welcome to a safe world …. | Page 2 Contents  Components Overview  Product Line Overview  AVG 8.0 Boxes.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
Web Defacement Anh Nguyen May 6 th, Organization Introduction How Hackers Deface Web Pages Solutions to Web Defacement Conclusions 2.
Building Your Own Firewall Chapter 10. Learning Objectives List and define the two categories of firewalls Explain why desktop firewalls are used Explain.
19.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 19: Security The Security Problem Authentication Program Threats.
Lesson 14-Desktop Protection. Overview Protect against malicious code. Use the Internet. Protect against physical tampering.
Malicious Attacks. Introduction Commonly referred to as: malicious software/ “malware”, computer viruses Designed to enter computers without the owner’s.
S EC (4.5): S ECURITY 1. F ORMS OF ATTACK There are numerous way that a computer system and its contents can be attacked via network connections. Many.
Buffer Overflow Attacks Figure (a) Situation when the main program is running. (b) After the procedure A has been called. (c) Buffer overflow shown.
Chapter 9 Security Malware Defenses. Malware Can be used for a form of blackmail. Example: Encrypts files on victim disk, then displays message.
Guide to Operating System Security Chapter 2 Viruses, Worms, and Malicious Software.
Chapter Nine Maintaining a Computer Part III: Malware.
Code Injection and Software Cracking’s Effect on Network Security Group 5 Jason Fritts Utsav Kanani Zener Bayudan ECE 4112 Fall 2007.
Internet safety Viruses A computer virus is a program or piece of code that is loaded onto your computer without your knowledge and runs against your.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Securing Windows 7 Lesson 10. Objectives Understand authentication and authorization Configure password policies Secure Windows 7 using the Action Center.
1 Chap 10 Malicious Software. 2 Viruses and ”Malicious Programs ” Computer “Viruses” and related programs have the ability to replicate themselves on.
By, Anish Shanmugasundaram Yashwanth Sainath Jammi.
Chapter 15: Security (Part 1). The Security Problem Security must consider external environment of the system, and protect the system resources Intruders.
How To Fix Common Computer Errors m.
Malware  Viruses  Virus  Worms  Trojan Horses  Spyware –Keystroke Loggers  Adware.
Survey “Intrusion Detection: Systems and Models” “A Stateful Intrusion Detection System for World-Wide Web Servers”
3-Protecting Systems Dr. John P. Abraham Professor UTPA.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
OSI and TCP/IP Models And Some Vulnerabilities AfNOG th May 2011 – 10 th June 2011 Tanzania By Marcus K. G. Adomey.
Attacking Applications: SQL Injection & Buffer Overflows.
1 Internet Browsing Vulnerabilities and Security ECE4112 Final Lab Ye Yan Frank Park Scott Kim Neil Joshi.
Chapter 13 Understanding E-Security. 2 OBJECTIVES What are security concerns (examples)? What are two types of threats (client/server) Virus – Computer.
Implementing a Port Knocking System in C Honors Thesis Defense by Matt Doyle.
A computer virus is a computer program that can replicate itself and spread from one computer to another. The term "virus" is also commonly, but erroneously.
CIS 450 – Network Security Chapter 7 – Buffer Overflow Attacks.
Distributed Denial of Service Attacks Shankar Saxena Veer Vivek Kaushik.
Understanding Computer Viruses: What They Can Do, Why People Write Them and How to Defend Against Them Computer Hardware and Software Maintenance.
Operating Systems Security
Module  Introduction Introduction  Techniques and tools used to commit computer crimes Techniques and tools used to commit computer crimes.
NetTech Solutions Protecting the Computer Lesson 10.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
Understand Malware LESSON Security Fundamentals.
Role Of Network IDS in Network Perimeter Defense.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 1.
Page 1 Viruses. Page 2 What Is a Virus A virus is basically a computer program that has been written to perform a specific set of tasks. Unfortunately,
Virus Infections By: Lindsay Bowser. Introduction b What is a “virus”? b Brief history of viruses b Different types of infections b How they spread b.
Securing a Host Computer BY STEPHEN GOSNER. Definition of a Host  Host  In networking, a host is any device that has an IP address.  Hosts include.
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,
© CGI Group Inc. User Guide Subversion client TortoiseSVN.
Common System Exploits Tom Chothia Computer Security, Lecture 17.
Protecting Memory What is there to protect in memory?
Chapter 7: Identifying Advanced Attacks
Protecting Memory What is there to protect in memory?
Backdoor Attacks.
Protecting Memory What is there to protect in memory?
SPRING DRAGON APT - A CASE STUDY OF TARGETED ATTACKS IN APAC COUNTRIES
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Chap 10 Malicious Software.
Security.
Security.
Chap 10 Malicious Software.
Operating System Concepts
Crisis and Aftermath Morris worm.
Test 3 review FTP & Cybersecurity
Following Malware Execution in IDA
Presentation transcript:

1 Code/DLL Injection ECE4112 – Internetwork Security Georgia Institute of Technology By Andrei Bersatti and Brandon Harrington

2 Agenda Background: Processes and DLLs Code Injection Static Injection Dynamic Injection Trojans and Firewall Evasion Defenses

3 Processes and DLLs (1) What are processes? What are DLL files?  More on this later Processes are running tasks that are managed by the Operating System. Processes may load DLL files (Dynamic Link Libraries, in Windows). Dynamic Link Libraries are executable code that can only be executed when called by a process.

4 Processes and DLLs (2) At the Lab:  We will have a brief review of Processes.  Use Windows Task Managers to Observe Processes.  Use Sysinternals Process Explorer (view processes and.dll files loaded by processes).  Process Name, Process User, Process Description, Process ID, Process DLL’s.

5 Code Injection Code Injection: ‘Injecting’ code (putting executable code within) into another program. Two Kinds: Static Injection: Occurs prior to program execution. Dynamic Injection: Occurs on or after program execution. Original Program/Process + Injected Code = Malicious Program/Process

6 Code Injection – Static Injection (1) Occurs prior to execution of a program. Example: A program innocent.exe is modified so that prior to executing itself it executes code that has been injected to do some nasty thing. Then the program is delivered to the victim who thinks the program is innocent (a virus? A trojan? A technique!).

7 Code Injection – Static Injection (2) How is it done? Programs have a memory space. Not all of the memory space is used, some parts of the memory space (usually at the end) is full of NOOPs. This area is known as a “cave.” A cave can be overwritten without corrupting (other than by adding a desired functionality) the victim program.

8 Code Injection – Static Injection (3) In order to execute the code in the cave, the program has to be able to reach the code. How? Every program has an Entry Point. By changing the first instruction in the Entry Point into a JUMP to our added code, as soon as the program starts our code executes. At the end of our code we add any instructions overwritten by the JUMP and then enter a JUMP back to the 2 nd Instruction of the Entry Point. Program execution continues normally.

9 Code Injection – Static Injection (4) In the Lab: We will use OllyDbg (a debugger or decompiler) to modify the memory space of winmine.exe (Minesweeper) so that it displays a Message Box prior to executing. Need some basic ASM: JMP -> A jump to an address (to an instruction). PUSH -> Pushes a variable into the stack. CALL -> Calls a Function, our function, user32.MessageBoxA, will pop the stack and take those variables as parameters.

10 Code Injection – Static Injection (5) Static Code Injection is not widely exploited by Trojans. Understanding how Static Code Injection works helps to understand Dynamic Code Injection. Static Code Injection is harder to detect since it may have occurred before the victim program arrived at a particular location.

11 Dynamic Code Injection Used by rootkits, trojans, viruses, spyware Inserting code into the program’s memory space. No signs of tampering in the executable file. Changes done on-the-fly while the process is running.

12 Dynamic Link Libraries (DLL) DLLs are shared libraries used across many programs.  Instead of including the shared code in every executable, common functions are stored in a separate file accessible by the programs. –Reduces executable size –Increases code re-use  Accessed by memory location –Import/Export Look-up table

13 API Hooking Closely related to functional overloading in programming Common practice in programming mainly for debugging purposes. Uses DLL injection to implant its hook DLL

14 API Hooking (continued) Malicious uses  Override functions in programs to intercept data  Maintain functionality but add “bad features”  Examples: –An encryption algorithm in a DLL could be overwritten to output the data before encrypted. –A send web data function could be overwritten to send duplicate data to another server.

15 Lab Procedures (Dynamic Injection) Inject DLLs into running processes using  APM  Aphex’s DLL Injector Use Process Explorer (PE) to show the new DLL loaded

16 Trojans and Firewall Evasion (1) What is the relevance of Code Injection to an Internetwork Security class? Trojans often use code/dll injection in an attempt to evade the Firewall and communicate with the Internet. Reverse Connection: Attacker’s computer does not contact you; your computer contacts the attacker’s computer! Access to data prior to encryption!

17 Trojans and Firewall Evasion (2) Static code injection scenario:  Install.exe was downloaded from Kazaa. (Assume Install.exe is your favorite videogame).  Install.exe is in reality MultiPlayerGame.exe wrapped with invisible Keylogger.exe.  MultiPlayerGame.exe was injected with code to connect to the Internet and deliver Keylog.txt to an attacker’s IP address.  Because you willingly ran a Multiplayer Game, you will tell your Firewall “Yes, allow MultiPlayerGame.exe to go outbound.”

18 Trojans and Firewall Evasion (3) But like we said before, while harder to detect, Static Code Injection is not commonly used by trojans. Dynamic Code/DLL Injection is far more common and far more dangerous! Dynamic Code/DLL Injection scenario: warningIamAtrojanServer.exe was somehow executed by some irresponsible person. This installed in the Run registry a program that runs upon startup for 1 second and injects a trojan.dll into iexplore.exe. Trojan was a Remote Administration Tool and because iexplore.exe has Firewall privileges, this RAT does too!

19 Trojans and Firewall Evasion (4) At the lab: We will install a firewall (Sygate Personal Firewall) We will test a firewall using Atelier Web Firewall Tester (tests Firewalls by trying to inject different processes that should already have privileges in the Firewall. Atelier claims that most firewalls fail these tests!!

20 Trojans and Firewall Evasion (5) Some Trojans that use injection:  Assassin 2.0 – Uses dynamic DLL injection for reverse connection.  Beast 2.0 – Uses dynamic DLL injection for reverse connection.  Nuclear Uploader – Uses dynamic DLL injection for reverse connection.  Flux – Uses dynamic code injection for reverse connection.  Institution 2004 – Claims to use DLL injection for reverse connection. Allows to remotely patch a process.

21 Trojans and Firewall Evasion (6) In the lab: We will play with Assassin 2.0; show the loaded.dll using Process Explorer. We will play with Institution 2004; show ability to patch processes remotely. We will play with Flux; show that it does indeed use Internet Explorer to evade the Firewall and yet no loaded.dll is detected. Tools: Process Explorer, Sygate Personal Firewall logs.

22 Protection How can you protect yourself from this attack? Anti-Hook  Essentially a firewall for DLL’s  Rule-based –Allow only “trusted” dll’s to be loaded by programs

23 Detection Static Injection  File Fingerprinting Dynamic Injection  Scan memory for rogue DLL currently loaded  Check import/export addresses of linked functions and compare with known addresses

24 Lab Procedures (Defenses) Use Advanced Process Manipulation (APM) to unload DLL injected into current processes Use TDS-3 to scan memory for rogue DLLs

25 Conclusions This is a common technique. Comparable to buffer overflows. If you know how the technique works, you can defend yourself against various malware that uses it