Langsung ke konten utama

Buffer Generator

Buffer Generator akan dibutuhkan saat kita ingin mengetahui byte ke berapa aplikasi mengalami crash saat melakukan buffer overflow exploitation dengan metode fuzzing.

Buat sebuah file dengan nama buftool.py dengan isi skrip sebagai berikut:


#!/usr/bin/python

#######################################################
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2, 1991 as published by
# the Free Software Foundation.
# 
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# 
# A copy of the GNU General Public License can be found at:
# [url="http://www.gnu.org/licenses/gpl.html"]http://www.gnu.org/licenses/gpl.html[/url]
# or you can write to:
# Free Software Foundation, Inc.
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307
# USA.
#
#######################################################

#
# buftool.py:  By Linuxchuck
#
# Inspired by genbuf.pl, which uses Pex::Text::PatternCreate and also by
#   pattern_offset.rb found in the Metasploit Framework 3 tools directory.
#
# This script combines the function of both scripts into one package.

import sys
import string

def usage():
    print "Usage: ", sys.argv[0], "  [string]"
    print "    is the size of the buffer to generate."
    print "   [string] is the optional string to search for in the buffer."
    print ""
    print "   If [string] is provided, the buffer will not be printed, only the location"
    print "     of where the string starts in the buffer.  This search is CASE SENSITIVE!"
    sys.exit()

try:
    dummy = int(sys.argv[1])
except:
    usage()

if len(sys.argv) > 3:
    usage

if len(sys.argv) == 3:
    search = "TRUE"
    searchstr = sys.argv[2]
else:
    search = "FALSE"

stop = int(sys.argv[1]) / 3 + 1
patend = int(sys.argv[1])
patrange = range(0,stop,1)
first = 65
second = 97
third = 0
item = ""

for i in patrange:
    reset_first = "FALSE"
    reset_second = "FALSE"
    if third == 10:
        third = 0
        second += 1
    if second == 123:
        first +=1
        reset_second = "TRUE"
    if first == 92:
        reset_first = "TRUE"
    item += chr(first)
    item += chr(second)
    item += str(third)
    third += 1
    if reset_first == "TRUE":
        first = 65
    if reset_second == "TRUE":
        second = 97

if search != "TRUE":
    sys.stdout.write(item[0:patend])
else:
    location = item.find(searchstr)
    if location == -1:
        print sys.argv[2] + " not found in buffer."
        sys.exit()
    print location


untuk menjalankan aplikasi tersebut di konsol, cukup dengan format ./buftool.py <jumlah karakter>

Komentar

Postingan populer dari blog ini

DNS Spoofing

DNS Spoofing adalah salah satu metode hacking Man In The Middle Attack (MITM). Hampir sama konsepnya dengan ARP Spoofing, tapi yang membedakan adalah Attacker akan memalsukan alamat IP dari sebuah domain. DNS adalah Domain Name Server, yaitu server yang digunakan untuk mengetahui IP Address suatu host lewat host name-nya. Dalam dunia internet, komputer berkomunikasi satu sama lain dengan mengenali IP Address-nya. Namun bagi manusia tidak mungkin menghafalkan IP address tersebut, manusia lebih mudah menghapalkan kata-kata seperti www.yahoo.com, www.google.com, atau www.facebook.com. DNS berfungsi untuk mengkonversi nama yang bisa terbaca oleh manusia ke dalam IP addresshost yang bersangkutan untuk dihubungi. Jadi ketika target melakukan request terhadap sebuah alamat domain dengan alamat IP A, dengan DNS Spoofing, oleh gateway request user tersebut akan di forward ke alamat IP palsu dari attacker. Oke, saatnya kita kita mencoba melakukan DNS Spoofing dengan menggunakan aplikasi

ARP Spoofing (Soft Way)

Jika artikel saya sebelumnya mencoba menjelaskan langkah-langkah melakukan ARP Spoofing dengan cara konvensional tanpa bantuan tools khusus (istilah lebay nya hard way ), kali ini saya akan mencoba lagi berbagi cara melakukan ARP Spoofing dengan menggunakan tool ARP Spoofing yaitu Ettercap. ARP Spoofing adalah sebuah teknik penyadapan oleh pihak ketiga yang dilakukan dalam sebuah jaringan LAN. Dengan metode tersebut,  attacker  dapat menyadap transmisi, modifikasi trafik, hingga menghentikan trafik komunikasi antar dua mesin yang terhubung dalam satu jaringan lokal (LAN).

Remote Shell Memanfaatkan Buffer Overflow Exploitation

Pada artikel Belajar Metode Fuzzing dengan SPIKE - Automasi Fuzzing , kita telah mengetahui bug  pada aplikasi vulnserver dengan mentode fuzzing. Salah satu bug pada aplikasi tersebut adalah ketika kita mengirimkan perintah TRUN dan diikuti karakter-karakter tertentu yang pada akhirnya mengakibatkan vulnserver mengalami crash atau access violation. Menurut Mati Aharoni (founder Backtrack), sebelum melakukan exploit terhadap bugs dari buffer overflow exploitation kita harus mempelajari bagaimana aplikasi tersebut mengalami crash dan memahaminya dengan lebih baik. Ada beberapa pertanyaan yang perlu dijawab: