skills/binary-exploitation/format-strings/format-strings-template/SKILL.md
How to exploit format string vulnerabilities in C binaries. Use this skill whenever the user mentions format string vulnerabilities, printf vulnerabilities, GOT/PLT overwrites, or needs to exploit a binary with format string bugs. This skill automates finding the format string offset, crafting payloads, and overwriting GOT entries to redirect function calls (e.g., printf → system) for code execution.
npx skillsauth add abelrguezr/hacktricks-skills format-string-exploitationInstall 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.
A skill for exploiting format string vulnerabilities in C binaries using pwntools.
Use this skill when:
printf(user_input) without format specifiers)Configure the connection in scripts/format_string_exploit.py:
LOCAL = True for local testingREMOTETTCP = True for remote TCPREMOTESSH = True for SSH (e.g., OverTheWire)Run the exploit:
python scripts/format_string_exploit.py
Review the output - the script will:
Format string vulnerabilities occur when user input is passed directly to format functions like printf(), fprintf(), or sprintf() without a format string argument:
// VULNERABLE
char *input = get_user_input();
printf(input); // User can use %x, %s, %n to read/write memory
// SAFE
printf("%s", input); // Format string is controlled
%x or %p to read stack values%n to write addresses to memory| Variable | Description | Default |
|----------|-------------|----------|
| LOCAL | Run binary locally | True |
| REMOTETTCP | Connect via TCP | False |
| REMOTESSH | Connect via SSH | False |
| GDB | Attach GDB for debugging | False |
| LOCAL_BIN | Path to vulnerable binary | "./tyler" |
| PREFIX_PAYLOAD | Bytes to prepend to payload | b"" |
| SUFFIX_PAYLOAD | Bytes to append to payload | b"" |
| MAX_LENTGH | Maximum payload length | 999999 |
LOCAL = True
LOCAL_BIN = "./vulnerable_binary"
REMOTETTCP = True
# Update in connect_binary():
P = remote('10.10.10.10', 1338)
REMOTESSH = True
REMOTE_BIN = "./tyler"
# SSH credentials configured in connect_binary()
Some binaries require looping back to the vulnerability for a second exploitation. Uncomment in the script:
P_FINI_ARRAY = ELF_LOADED.symbols["__init_array_end"]
INIT_LOOP_ADDR = 0x8048614 # Address to return to
format_string.write(P_FINI_ARRAY, INIT_LOOP_ADDR)
get_formatstring_config()setarch -R)/bin/sh or similarscripts/format_string_exploit.py - Main exploitation scriptRun the script after configuring your connection settings. The script will automatically:
testing
How to perform a House of Lore (small bin attack) heap exploitation. Use this skill whenever the user mentions heap exploitation, small bin attacks, fake chunks, glibc heap vulnerabilities, or needs to insert fake chunks into small bins for arbitrary read/write. Trigger for CTF challenges involving heap corruption, glibc 2.31+ exploitation, or when the user needs to bypass malloc sanity checks using fake chunk linking.
testing
How to perform House of Force heap exploitation attacks. Use this skill whenever the user mentions heap exploitation, House of Force, top chunk manipulation, arbitrary memory allocation, malloc manipulation, or wants to allocate chunks at specific addresses. Also trigger for CTF challenges involving heap overflows, top chunk size overwrites, or when the user needs to calculate evil_size for heap attacks. Make sure to use this skill for any binary exploitation task involving glibc heap manipulation, even if they don't explicitly say "House of Force".
tools
How to perform House of Einherjar heap exploitation to allocate memory at arbitrary addresses. Use this skill whenever the user mentions heap exploitation, glibc heap attacks, arbitrary memory allocation, off-by-one overflow exploitation, tcache poisoning, fast bin attacks, or any CTF challenge involving heap manipulation. This is essential for binary exploitation tasks where you need to control malloc() return addresses.
testing
How to identify, analyze, and exploit heap overflow vulnerabilities in binary exploitation challenges and real-world scenarios. Use this skill whenever the user mentions heap overflows, memory corruption, heap grooming, tcache poisoning, fast-bin attacks, or any heap-related vulnerability in CTF challenges, binary analysis, or security research. This skill covers heap overflow fundamentals, exploitation techniques, heap grooming strategies, and real-world CVE analysis.