In my previous blog post, I covered the development of a buffer overflow exploit for a simple vulnerable program with overflow protections disabled. In this post, I will demonstrate bypassing DEP/NX using return oriented programming.
A stack buffer overflow occurs when a program writes more data to the stack than what is allocated to the buffer. This results in the extra data overwriting possibly important data in stack and causing the program to crash or to execute arbitrary code by possibly overwriting the instruction pointer and hence being able to redirect the execution flow of the program.
I used Evan’s debugger to demonstrate the buffer overflow on Kali Linux.
The Metasploitable virtual machine is an intentionally vulnerable version of Ubuntu Linux designed for testing security tools and demonstrating common vulnerabilities. Version 2 of this virtual machine is available for download and ships with even more vulnerabilities than the original image. This virtual machine is compatible with VMWare, VirtualBox, and other common virtualization platforms. By default, Metasploitable’s network interfaces are bound to the NAT and Host-only network adapters, and the image should never be exposed to a hostile network.
As this VM has many vulnerabilities in common with version 1, I will only be covering the newer vulnerabilities on the system. For a comprehensive walkthrough on version 1 of the VM you can check out my previous blog post here.
Metasploitable is an Ubuntu 8.04 server install on a VMWare 6.5 image with a number of vulnerable packages included, which can be run on most virtualization software.
You can grab your copy at Vulnhub – Metasploitable
I used Kali Linux for attacking and VirtualBox for virtualization.
Offensive Security, PWK and OSCP – A Review
PWK and OSCP
Penetration Testing with Kali Linux (PWK) is Offensive Security’s starter course for newer folk in the field of computer security. Although it’s advertised as an entry-level course, it’s recommended to be acquainted with Linux, TCP/IP, Networking and be familiar with at least one scripting language (Python/Ruby) and one high level programming language (C/C++).
The Offensive Security Certified Professional certification is an optional certification provided upon clearing the OSCP challenge available when you register for the PWK course.
You can check out more information about the course here.