thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Advanced

Format String Vulnerability

Passing user input as the format argument to functions such as printf, allowing memory reads or writes.

Definition

Format specifiers like %x and %n in attacker-controlled format strings can leak stack data or write to memory. The fix is always using a constant format string, such as printf("%s", input), and enabling compiler warnings. Tracked as CWE-134.

Example

Using printf(user_input) instead of printf("%s", user_input).

Exam tip

Fix: never let input be the format string.

Related terms