
Cerca gadget ROP in binari ELF, PE, Mach-O e Raw su architetture x86, ARM, MIPS e RISC-V. Supporta la generazione automatica di catene ROP e la modalità console interattiva.
Questo strumento ti permette di cercare i tuoi gadget nei binari per facilitare lo sfruttamento ROP. ROPgadget supporta i formati ELF/PE/Mach-O/Raw su architetture x86, x64, ARM, ARM64, PowerPC, SPARC, MIPS, RISC-V 64 e RISC-V Compressed.
Il modo più semplice è installare ROPgadget da PyPi:
$ sudo apt install python3-pip
$ sudo -H python3 -m pip install ROPgadget
$ ROPgadget --help
In alternativa puoi installare ROPgadget dal sorgente. Devi prima installare Capstone.
Per l'installazione di Capstone su macchine nix:
$ sudo apt install python3-pip
$ sudo -H python3 -m pip install capstone
Capstone supporta multi-piattaforme (windows, ios, android, cygwin...). Per la cross-compilation, fare riferimento al file https://github.com/capstone-engine/capstone/blob/master/COMPILE.TXT.
Dopo aver installato Capstone, ROPgadget può essere usato come strumento standalone:
$ python3 ROPgadget.py --help
Oppure installato nella libreria Python site-packages, ed eseguito da $PATH.
$ sudo -H python3 setup.py install
$ ROPgadget --help
usage: ROPgadget.py [-h] [-v] [-c] [--binary <binary>] [--opcode <opcodes>]
[--string <string>] [--memstr <string>] [--depth <nbyte>]
[--only <key>] [--filter <key>] [--range <start-end>]
[--badbytes <byte>] [--rawArch <arch>] [--rawMode <mode>]
[--rawEndian <endian>] [--re <re>] [--offset <hexaddr>]
[--ropchain] [--thumb] [--console] [--norop] [--nojop]
[--callPreceded] [--nosys] [--multibr] [--all] [--noinstr]
[--dump] [--silent] [--align ALIGN] [--mipsrop <rtype>]
descrizione:
ROPgadget ti permette di cercare i tuoi gadget in un binario. Supporta
diversi formati di file e architetture e utilizza il disassemblatore Capstone
per il motore di ricerca.
formati supportati:
- ELF
- PE
- Mach-O
- Raw
architetture supportate:
- x86
- x86-64
- ARM
- ARM64
- MIPS
- PowerPC
- Sparc
- RISC-V 64
- RISC-V Compressed
argomenti opzionali:
-h, --help mostra questo messaggio di aiuto ed esci
-v, --version Mostra la versione di ROPgadget
-c, --checkUpdate Controlla se è disponibile una nuova versione
--binary <binary> Specifica il nome del file binario da analizzare
--opcode <opcodes> Cerca opcode nel segmento eseguibile
--string <string> Cerca stringa nel segmento leggibile
--memstr <string> Cerca ogni byte in tutti i segmenti leggibili
--depth <nbyte> Profondità per il motore di ricerca (default 10)
--only <key> Mostra solo istruzioni specifiche
--filter <key> Sopprime mnemonici specifici
--range <start-end> Cerca tra due indirizzi (0x...-0x...)
--badbytes <byte> Rifiuta byte specifici nell'indirizzo del gadget
--rawArch <arch> Specifica un'architettura per un file raw
x86|arm|arm64|sparc|mips|ppc|riscv
--rawMode <mode> Specifica una modalità per un file raw 32|64|arm|thumb
--rawEndian <endian> Specifica un endianness per un file raw little|big
--re <re> Espressione regolare
--offset <hexaddr> Specifica un offset per gli indirizzi dei gadget
--ropchain Abilita la generazione della catena ROP
--thumb Usa la modalità thumb per il motore di ricerca (solo ARM)
--console Usa una console interattiva per il motore di ricerca
--norop Disabilita il motore di ricerca ROP
--nojop Disabilita il motore di ricerca JOP
--callPreceded Mostra solo gadget preceduti da una chiamata
--nosys Disabilita il motore di ricerca SYS
--multibr Abilita gadget a rami multipli
--all Disabilita la rimozione dei gadget duplicati
--noinstr Disabilita la stampa delle istruzioni del gadget
--dump Emette i byte del gadget
--silent Disabilita la stampa dei gadget durante l'analisi
--align ALIGN Allinea gli indirizzi dei gadget (in byte)
--mipsrop <rtype> Ricerca di gadget utili per MIPS
stackfinder|system|tails|lia0|registers
esempi:
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --ropchain
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --depth 3
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --string "main"
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --string "m..n"
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --opcode c9c3
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --only "mov|ret"
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --only "mov|pop|xor|ret"
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --filter "xchg|add|sub|cmov.*"
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --norop --nosys
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --range 0x08041000-0x08042000
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --string main --range 0x080c9aaa-0x080c9aba
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --memstr "/bin/sh"
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --console
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-x86 --badbytes "00|01-1f|7f|42"
ROPgadget.py --binary ./test-suite-binaries/Linux_lib64.so --offset 0xdeadbeef00000000
ROPgadget.py --binary ./test-suite-binaries/elf-ARMv7-ls --depth 5
ROPgadget.py --binary ./test-suite-binaries/elf-ARM64-bash --depth 5
ROPgadget.py --binary ./test-suite-binaries/raw-x86.raw --rawArch=x86 --rawMode=32
ROPgadget.py --binary ./test-suite-binaries/elf-Linux-RISCV_64 --depth 8
Per favore, segnala bug, invia pull request, ecc. su GitHub all'indirizzo https://github.com/JonathanSalwan/ROPgadget
Vedi LICENSE_BSD.txt e l'intestazione della licenza su tutti i file sorgente.





