Exploiting Tools
Metasploit
Kabuk Kodları
GDB
Kurulum
Parametreler
Talimatlar
İlginç komutlar içeren bu GEF çatalını isteğe bağlı olarak kullanabilirsiniz.
İpuçları
GDB aynı adresler
Hata ayıklama yaparken GDB, yürütüldüğünde kullanılan adreslerden biraz farklı adreslere sahip olacaktır. GDB'nin aynı adreslere sahip olmasını sağlamak için şunları yapabilirsiniz:
unset env LINES
unset env COLUMNS
set env _=<yol>
Binary'nin mutlak yolunu ekleyinAynı mutlak yolu kullanarak binary'yi sömürün
GDB'yi kullanırken ve binary'yi sömürürken
PWD
veOLDPWD
aynı olmalıdır
Çağrılan fonksiyonları bulmak için geri izleme
Statik olarak bağlanmış bir binary'e sahipseniz, tüm fonksiyonlar binary'ye ait olacaktır (harici kütüphanelere değil). Bu durumda, binary'nin örneğin kullanıcı girdisi istemek için izlediği akışı tanımlamak zor olacaktır.
Bu akışı kolayca tanımlayabilirsiniz gdb ile binary'yi çalıştırarak, giriş istendiğinde durdurun ve ardından CTRL+C ile durdurun ve bt
(geri izleme) komutunu kullanarak çağrılan fonksiyonları görebilirsiniz:
GDB sunucusu
gdbserver --multi 0.0.0.0:23947
(IDA'da Linux makinesindeki yürütülebilir dosyanın mutlak yolunu ve Windows makinesindeki yürütülebilir dosyanın mutlak yolunu doldurmanız gerekmektedir)
Ghidra
Yığın ofsetini bulma
Ghidra, **yerel değişkenlerin konumu hakkındaki bilgiler sayesinde bir tampon taşmasının ofsetini bulmak için çok yararlıdır.
Örneğin, aşağıdaki örnekte, local_bc
içinde bir tampon taşması, 0xbc
ofsetine ihtiyaç duyduğunuzu gösterir. Dahası, local_10
bir canary çerezi ise, local_bc
'den üzerine yazmak için 0xac
ofseti olduğunu gösterir.
RIP'nin kaydedildiği ilk 0x08'in RBP'ye ait olduğunu unutmayın.
qtool
Programda yürütülen her opcode'u alın.
GCC
gcc -fno-stack-protector -D_FORTIFY_SOURCE=0 -z norelro -z execstack 1.2.c -o 1.2 --> Korumalar olmadan derleme -o --> Çıktı -g --> Kodu kaydet (GDB görebilecek) echo 0 > /proc/sys/kernel/randomize_va_space --> Linux'ta ASLR'yi devre dışı bırakmak için
Shellcode derlemek için: nasm -f elf assembly.asm --> ".o" döndürür ld assembly.o -o shellcodeout --> Yürütülebilir
Objdump
-d --> Yürütülebilir bölümleri (derlenmiş bir shellcode'un opcode'larını görmek, ROP Gadgets bulmak, fonksiyon adresini bulmak...) -Mintel --> Intel sözdizimi -t --> Semboller tablosu -D --> Tümünü (statik değişkenin adresi) -s -j .dtors --> dtors bölümü -s -j .got --> got bölümü -D -s -j .plt --> plt bölümü çözümlenmiş -TR --> Yer değiştirmeler ojdump -t --dynamic-relo ./exec | grep puts --> GOT'ta değiştirilecek "puts" adresi objdump -D ./exec | grep "VAR_NAME" --> Statik bir değişkenin adresi (bunlar DATA bölümünde saklanır).
Core dumps
Programımı başlatmadan önce
ulimit -c unlimited
çalıştırınsudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
çalıştırınsudo gdb --core=\<path/core> --quiet
çalıştırın
Daha Fazla
ldd executable | grep libc.so.6 --> Adres (ASLR varsa, bu her seferinde değişir) for i in `seq 0 20`; do ldd <Ejecutable> | grep libc; done --> Adresin çok değişip değişmediğini görmek için döngü readelf -s /lib/i386-linux-gnu/libc.so.6 | grep system --> "system"ın ofseti strings -a -t x /lib/i386-linux-gnu/libc.so.6 | grep /bin/sh --> "/bin/sh"nin ofseti
strace executable --> Yürütülebilir tarafından çağrılan fonksiyonlar rabin2 -i ejecutable --> Tüm fonksiyonların adresi
Inmunity debugger
IDA
Uzaktan linux'ta hata ayıklama
IDA klasörü içinde, bir linux içinde bir ikili dosyayı hata ayıklamak için kullanılabilecek ikili dosyalar bulabilirsiniz. Bunun için linux_server
veya linux_server64
ikili dosyasını linux sunucuya taşıyın ve ikili dosyayı içeren klasörde çalıştırın:
Ardından, hata ayıklayıcıyı yapılandırın: Hata Ayıklayıcı (linux uzak) --> İşlem seçenekleri...:
Last updated