CyberKit

Format String Vulnerability

Passing attacker-controlled text as a format string to printf-style calls.

What it is

A flaw where untrusted input is used directly as the format argument of a formatting function. Conversion specifiers in the input let an attacker read from or write to memory through the formatting machinery.

Why it matters

Format string bugs can leak memory and even perform writes, providing both an info leak and a corruption primitive in one. They are easy to introduce and easy to spot in code review once the pattern is known.

In practice

Logging user input with printf(user_input) instead of printf("%s", user_input), letting %x leak stack values and %n write to memory.

What to look for

  • printf style calls with input as the format.
  • %n or %x sequences in logs or input fields.
  • Compiler warnings about non literal format strings.

Common mistake

Ignoring the compiler warning. It points straight at the bug.

Practice it nearby

CyberKit has no tool for this term itself. These are the closest places to practice it.

In the field

Well-known tools where this shows up on the job. They are listed to show the landscape, not as a recommendation.

  • Nessus Commercial

    A vulnerability scanner that checks hosts for known flaws and missing patches.

  • Qualys VMDR Commercial

    A cloud platform that scans assets and ranks vulnerabilities for patching.

  • OpenVAS Open source

    An open source vulnerability scanner with a large set of checks.

  • Nuclei Open source

    Runs community templates that test for specific, newly published flaws.

Read next

Sources