• Build Your Own FTP Fuzzer

    Fuzz testing or fuzzing is a software testing technique that provides invalid, unexpected, or random data to the inputs of a program. If the program fails (for example, by crashing or failing built-in code assertions), the defects can be noted.

    Fuzz testing is often used in large software development projects that employ black box testing. These projects usually have a budget to develop test tools, and fuzz testing is one of the techniques which offers a high benefit to cost ratio.

    However, fuzz testing is not a substitute for exhaustive testing or formal methods: it can only provide a random sample of the system's behavior, and in many cases passing a fuzz test may only demonstrate that a piece of software handles exceptions without crashing, rather than behaving correctly. Thus, fuzz testing can only be regarded as a bug-finding tool rather than an assurance of quality.

    The purpose of this post is designed to get you those, who are new to reverse engineering, up and running with sample code. Below is an example of a very basic FTP Fuzzing program written in Python. The sample code can be used to begin building your own Fuzzer.

    Before we get started, here are some suggestions:
    * Have a basic programming background (ideally Python, or Perl)
    * Have a reverse engineering lab (use VMWare for this)
    * Have a basic understanding of buffer overflows (Google will help)

    Again, the code below is designed to be a basic example of how to get started. Ideally, you would make enhancements to this code in order to allow for fuzzing multiple hosts, randomizing input, logging, etc.

    Download the sample code


    #!/usr/bin/python

    #########################################
    #########################################
    ## ##
    ## Basic FTP Fuzzer ##
    ## ##
    ## ##
    ## FOR EDUCATIONAL PURPOSES ONLY! ##
    ## ##
    ## Jeremiah Talamantes ##
    ## labs@redteamsecure.com ##
    ## http://www.redteamsecure.com/labs ##
    ## ##
    #########################################
    #########################################

    import socket

    buffer=["A"]
    counter=2
    while len(buffer) <= 30:
    buffer.append("A"*counter)
    counter=counter+100
    commands=["MKD", "GET", "STOR"]

    for command in commands:
    for string in buffer:
    print "Sending the "+command+" command with "+ str(len(string))+" bytes."
    s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    # change IP to your liking
    connect=s.connect(('192.168.9.97',21))
    s.recv(1024)
    s.send('USER ftp\r\n')
    s.recv(1024)
    s.send('PASS ftp\r\n')
    s.recv(1024)
    s.send(command+' '+string+'\r\n')
    s.recv(1024)
    s.send('QUIT ftp \r\n')
    s.close()


  • Contact Us

    Please contact RedTeam Security regarding your next information security project!

    Contact us
  • Ethical Hacking

    We save your business reputation and money by simulating real-world hacker attempts in order to identify security vulnerabilities before they are exploited.

    Contact us
  • Experienced Consultants

    RedTeam consultants are highly-skilled, experienced and certified experts. Our certifications include: CISSP, CEH, CHFI, CCISO, CASS, CEPT and others.

    Contact us