ROPgadget Documentation

repository·master·Indexed 26 days ago

https://github.com/jonathansalwan/ropgadget

A tool for searching for gadgets in binaries to facilitate Return-Oriented Programming (ROP) exploitation. Supports ELF, PE, Mach-O, and Raw file formats across architectures including x86, x64, ARM, ARM64, MIPS, PowerPC, Sparc, and RISC-V.

Tokens
1.3K
Snippets
3
Records
6
Agent score
39%

What's inside ROPgadget

  1. Install ROPgadget from source

    master

    To install from source, you must first install the capstone engine. After installing Capstone, you can either run ROPgadget as a standalone script or install it into your Python site-packages to be available in your $PATH.

    # Install Capstone first
    $ sudo apt install python3-pip
    $ sudo -H python3 -m pip install capstone
    
    # Option 1: Run as standalone
    $ python3 ROPgadget.py --help
    
    # Option 2: Install into site-packages
    $ sudo -H python3 setup.py install
    $ ROPgadget --help
  2. Reference: ROPgadget CLI arguments

    master

    ROPgadget provides various flags to control the search engine, filter results, and handle different file formats and architectures. Use --help for the full list.

    --binary <binary>     Specify a binary filename to analyze
    --opcode <opcodes>    Search opcode in executable segment
    --string <string>     Search string in readable segment
    --memstr <string>     Search each byte in all readable segment
    --depth <nbyte>       Depth for search engine (default 10)
    --only <key>          Only show specific instructions
    --filter <key>        Suppress specific mnemonics
    --range <start-end>   Search between two addresses (0x...-0x...)
    --badbytes <byte>     Rejects specific bytes in the gadget's address
    --rawArch <arch>      Specify an arch for a raw file (x86|arm|arm64|sparc|mips|ppc|riscv)
    --rawMode <mode>      Specify a mode for a raw file (32|64|arm|thumb)
    --rawEndian <endian> Specify an endianness for a raw file (little|big)
    --re <re>             Regular expression
    --offset <hexaddr>    Specify an offset for gadget addresses
    --ropchain            Enable the ROP chain generation
    --thumb               Use the thumb mode for the search engine (ARM only)
    --console             Use an interactive console for search engine
    --norop               Disable ROP search engine
    --nojop               Disable JOP search engine
    --callPreceded        Only show gadgets which are call-preceded
    --nosys               Disable SYS search engine
    --multibr             Enable multiple branch gadgets
    --all                 Disables the removal of duplicate gadgets
    --noinstr             Disable the gadget instructions console printing
    --dump                Outputs the gadget bytes
    --silent              Disables printing of gadgets during analysis
    --align ALIGN         Align gadgets addresses (in bytes)
    --mipsrop <rtype>     MIPS useful gadgets finder (stackfinder|system|tails|lia0|registers)