Skip to content

Binary Exploitation

Quick Start

  • For C and C++ programs: * Does the program use functions like that do not check user input gets, strcpy, or sprintf? * If so, possible buffer overflow vulnerability! * Does the program use printf or snprintf without using a format specifier? * If so, possible format string vulnerability!

About

Binary exploitation is the process of identifying and taking advantage of vulnerabilities in compiled code. They can be used to read or corrupt memory, crash a program, or gain administrative access to a machine. In CTFs, the source code is usually written in C and the binaries, or executables, are in Linux ELF format.

Examples

Example of a buffer overflow vulnerability:

char buffer[32];
gets(buffer);   // what if 32 or more bytes are entered?

Example of a format string vulnerability:

printf(argv[1]); // what happens if argv[1] = "%p %p %p %p"?

Sources

CTF 101 - Binary Exploitation

Trial of Bits - Exploiting Binaries 1