Skip to main content

Advanced Exploitation Techniques - Part 5



What You should know Best for Advancing Your  Hacking Skills



Tutorial 1 – Required Infrastructure

Welcome to the last module of this workshop. We have been discussing exploit development and more about tools and techniques, however, we haven’t gone through details where a beginner can setup the required virtual environment in order to complete this workshop with hands-on experience and where a newbie can learn more in their home environment.

So what should you know?

If you are a newbie here and don’t have much experience with the following topics then they should stand as a prerequisite for you to start gaining  expertise in exploit development and security research field.

    ● Metasploit Framework (mandatory)
    ● Kali Linux (not mandatory)
    ● Mona.py (mandatory)
    ● Assembly Language (mandatory)
    ● Basic TCP/IP Concepts
    ● Linux experience

Moreover you should be good enough in Windows in and outs, how to fix problems and know what happens in the background of applications and programs, which are used in exploit development.

For our newbies we are presenting how to setup a home environment for this workshop and if you have prior experience in assembly and how to setup home lab for ethical hacking or penetration testing work then this might not be mandatory for you to go through. However, considering all types of audiences from beginners we feel it’s worthwhile to cover this in one workshop so that you don’t need to worry and hit Google again and again.

The Home Lab

At the very beginning you need a virtualization tool that can help you build the Home Lab, it is recommended to use Virtual Box as it’s free and a good start for students and home users.

Download Link: https://www.virtualbox.org/wiki/Downloads

Select & download the binary, as per your operating system requirement, in my case I will be installing the VirtualBox-4.3.12-93733-OSX from the above download link as shown below.







Double click the icon as shown in above figure.


Continue to install by clicking the continue button.



 Begin installation by clicking the continue button.


 Select the installation location or customize the installation as shown above,however it is recommended to leave the settings as default and hit installation.


 Successful installation will show the below screen.


Virtual box installation is now complete.

Virtual Machines Setup, Windows XP

Our next step is setting up the Windows XP as a virtual machine so that you can install vulnerable applications and start testing.

Now, run the Virtual Box by simply clicking its icon from Applications and you will see it run quickly as shown below.



Click the new button on top left corner to setup new machine, type the name and select type of operating system and select the operating system version to install. Configure this as shown in below figure. Once this is complete you will be prompted to select the memory for this virtual machine.



 Configure the memory size, as you are installing Windows XP hence you do not need to waste your memory, for Windows XP 512MB of RAM size would be enough.



Configure Storage

Next step is to configure the hard drive, for Windows XP 10GB space would be enough and recommended.


 Select the hard drive type as VID (Virtual Box Disk Image) and continue.



 Allocate the space dynamically to save your MAC machine.




Configure the size and name of the virtual hard disk you have just configured and create the disk as shown below.




Your new virtual machine is now complete, once you create the hard disk it will complete the setup of virtual machine and you will see the below outcome as shown in the figure.




 Windows XP Installation is easy; you just need to attach the Image to the virtual CD drive, most of you have already gone through this phase many times but for newbies we have presented below.



In the storage Tree section select Empty CDROM as shown above and you will see the following option, click the CDROM button at the top right section as shown below to chose the Windows XP ISO image.



 Once configured successfully you will be good to install the Windows XP operating system into this Virtual Machine.





Now run the machine, sit back and install the Windows XP Operating System as you install it on the actual hardware as shown below. Once this installation is completed we will install the Vulnerable Application in Windows XP.




Without hiccups this would lead to successful installation of Windows XP operating system. However you need to ensure that your Network Card type is set as shown below in order to connect your Virtual Machine with your host operating system.




 Network Card type should be set to PCnet-FAST III type as shown in the below configuration.


 Vulnerable Software Installation

Download the following applications for installing in this Windows XP so that you can have vulnerable applications ready for your security research development. You can load this lab with all kind of vulnerabilities and other stuff you want but as a minimum we recommend the following applications for practicing.

PCManFTPD

http://www.exploit-db.com/exploits/27007/
http://www.exploit-db.com/exploits/27703/

Ability FTP Server

http://www.exploit-db.com/exploits/588/
http://www.exploit-db.com/exploits/618/

EasyFTP Server

http://www.exploit-db.com/exploits/14402/

Download and install these applications one by one or install all together and change the port number so that you can run them parallel and practice altogether.

Immunity Debugger

Now, get the Immunity Debugger and install it so that you can debug these applications as explained in this workshop in previous modules.

Since your XP installation is a fresh install, python is not available, hence Immunity Installation will prompt you to install Python at first.


Accept the license agreement, and click next to continue the installation setup.


Accept the license agreement, and click next to continue the installation setup.




Leave the destination directory with the provided default settings and continue with your installation.



 Done, you are now finished with the installation of Immunity Debugger, click the icon on your desktop to run the Immunity first time.



The Lovely “Mona.py”

We are finished with Immunity Debugger installation, now its time to plugin this debugger with Mona.py plugin that we explained in previous module. You can download this plugin from below link. Once download is finished, simply place this Mona.py plugin file into the Immunity Installation folder and then Py Commands directory as shown below.

Mona.py download link:
http://redmine.corelan.be/projects/mona/repository/changes/mona.py?rev= master


To ensure Mona.py is working, simply run Immunity Debugger and run the [!mona] command as shown in the following figure. To run the command, type the command to run in the bottom text box and hit enter.


That’s all, however you might be thinking that we haven’t covered Metasploit Framework installation and how to get it ready! You can make it easily, download the Kali Linux copy and install the Virtual Machine as we did for XP. If any one has any issue in doing that please post on forum and we will help.



Basic Concepts

We have been talking about registers and assembly. Its worthwhile to present something here, which gives you a background of what they are and why they are important to understand.


 Registers

In the field of exploit development key registers are basically Pointer registers called EIP, ESP and EBP registers where “E” stands for extended.

Instruction Pointer stores the offset address of the next instruction to be executed and this is your EIP.

Base Pointer helps in referencing the parameter variables passed to a subroutine and this is your EBP.

And then you have a stack pointer, which is basically a data structure, in which you can push and pop data into and from it, respectively. Unlike a FIFO (first in, first out) however, the popped data from a stack are the elements that you pushed last. Because of this, a stack is also termed LIFO (last in, first out) or FILO (first in, last out). This is your ESP.

To gain in depth knowledge and more understanding on stack and how you can smash it, we recommend you go through the Smash The Stack article available on http://insecure.org/stf/smashstack.html





Popular posts from this blog

Haking On Demand_WireShark - Part 5

Detect/Analyze Scanning Traffic Using Wireshark “Wireshark”, the world’s most popular Network Protocol Analyzer is a multipurpose tool. It can be used as a Packet Sniffer, Network Analyser, Protocol Analyser & Forensic tool. Through this article my focus is on how to use Wireshark to detect/analyze any scanning & suspect traffic. Let’s start with Scanning first. As a thief studies surroundings before stealing something from a target, similarly attackers or hackers also perform foot printing and scanning before the actual attack. In this phase, they want to collect all possible information about the target so that they can plan their attack accordingly. If we talk about scanning here they want to collect details like: • Which IP addresses are in use? • Which port/services are active on those IPs? • Which platform (Operating System) is in use? • What are the vulnerabilities & other similar kinds of information. • Now moving to some popular scan methods and ho

Bypassing Web Application Firewall Part - 2

WAF Bypassing with SQL Injection HTTP Parameter Pollution & Encoding Techniques HTTP Parameter Pollution is an attack where we have the ability to override or add HTTP GET/POST parameters by injecting string delimiters. HPP can be distinguished in two categories, client-side and server-side, and the exploitation of HPP can result in the following outcomes:  •Override existing hardcoded HTTP parameters  •Modify the application behaviors   •Access and potentially exploit uncontrollable variables  • Bypass input validation checkpoints and WAF rules HTTP Parameter Pollution – HPP   WAFs, which is the topic of interest, many times perform query string parsing before applying the filters to this string. This may result in the execution of a payload that an HTTP request can carry. Some WAFs analyze only one parameter from the string of the request, most of the times the first or the last, which may result in a bypass of the WAF filters, and execution of the payload in the server.  Let’s e

Bypassing Web Application Firewall Part - 4

Securing WAF and Conclusion DOM Based XSS DOM based XSS is another type of XSS that is also used widely, and we didn’t discuss it in module 3. The DOM, or Document Object Model, is the structural format used to represent documents in a browser. The DOM enables dynamic scripts such as JavaScript to reference components of the document such as a form field or a session cookie, and it is also a security feature that limits scripts on different domains from obtaining cookies for other domains. Now, the XSS attacks based on this is when the payload that we inject is executed as a result of modifying the DOM environment in the victim’s browser, so that the code runs in an unexpected way. By this we mean that in contrast with the other two attacks, here the page that the victim sees does not change, but the injected code is executed differently because of the modifications that have been done in the DOM environment, that we said earlier. In the other XSS attacks, we saw the injected code was