offensive-tools/rev/patchelf/SKILL.md
Auth/lab ref: ELF patching utility for changing interpreters, RPATH/RUNPATH, DT_NEEDED entries, and SONAME fields.
npx skillsauth add aeondave/malskill patchelfInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Patch existing ELF metadata without recompiling the target.
Use patchelf when you need to:
DT_NEEDED dependenciesSONAMEThis is especially useful in exploit labs, portable bundles, and offline ELF repair workflows.
# Set custom loader
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 ./prog
# Set custom RPATH
patchelf --set-rpath '$ORIGIN/libs' ./prog
# Replace one needed library with another
patchelf --replace-needed libold.so libnew.so ./prog
patchelf --set-interpreter /path/to/ld-linux.so.2 ./prog
Use when a binary must run with a matching loader for a bundled libc.
patchelf --set-rpath /opt/app/lib:/other/lib ./prog
patchelf --shrink-rpath ./prog
patchelf --shrink-rpath --allowed-rpath-prefixes /usr/lib:/opt/app/lib ./prog
patchelf --remove-needed libfoo.so.1 ./prog
patchelf --add-needed libbar.so.1 ./prog
patchelf --replace-needed libold.so.1 libnew.so.1 ./prog
patchelf --set-soname libcustom.so.1 ./libtarget.so
cp ./vuln ./vuln.patched
patchelf --set-interpreter ./ld-linux-x86-64.so.2 ./vuln.patched
patchelf --set-rpath '$ORIGIN' ./vuln.patched
Then verify with ldd, readelf, or by executing under a controlled directory.
readelf -l, readelf -d, and ldd.$ORIGIN-based RPATHs for portable bundles.No bundled scripts/, references/, or assets/.
Use upstream README for build/install variants and the complete option set.
development
Auth/lab ref: Unicorn Engine CPU-only emulation for shellcode, decryptors, custom VM handlers, instruction tracing, memory hooks, and register-level experiments.
development
Auth/lab ref: Renode board and SoC simulation for MCU/RTOS firmware, UART/GPIO/peripheral modeling, GDB remote debugging, REPL platforms, and RESC scripts.
development
Auth/lab ref: Qiling OS-layer binary emulation for PE/ELF/Mach-O/UEFI/shellcode with rootfs, syscall/API hooks, filesystem mapping, and runtime patching.
databases
Auth/lab ref: QEMU user-mode and full-system emulation for cross-arch binaries, firmware, kernels, disks, serial consoles, networking, and GDB stubs.