Skip to content

Commit

Permalink
Merge pull request #942 from acerjt/patch-4
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
carlospolop authored Sep 25, 2024
2 parents 9389000 + 49db41f commit 91ac4c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions binary-exploitation/format-strings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ printf("%4$x")

and read directly the forth.

Notice that the attacker controls the `pr`**`intf` parameter, which basically means that** his input is going to be in the stack when `printf` is called, which means that he could write specific memory addresses in the stack.
Notice that the attacker controls the `printf` **parameter, which basically means that** his input is going to be in the stack when `printf` is called, which means that he could write specific memory addresses in the stack.

{% hint style="danger" %}
An attacker controlling this input, will be able to **add arbitrary address in the stack and make `printf` access them**. In the next section it will be explained how to use this behaviour.
Expand Down Expand Up @@ -167,7 +167,7 @@ Arbitrary reads can be useful to:

## **Arbitrary Write**

The formatter **`$<num>%n`** **writes** the **number of written bytes** in the **indicated address** in the \<num> param in the stack. If an attacker can write as many char as he will with printf, he is going to be able to make **`$<num>%n`** write an arbitrary number in an arbitrary address.
The formatter **`%<num>$n`** **writes** the **number of written bytes** in the **indicated address** in the \<num> param in the stack. If an attacker can write as many char as he will with printf, he is going to be able to make **`%<num>$n`** write an arbitrary number in an arbitrary address.

Fortunately, to write the number 9999, it's not needed to add 9999 "A"s to the input, in order to so so it's possible to use the formatter **`%.<num-write>%<num>$n`** to write the number **`<num-write>`** in the **address pointed by the `num` position**.

Expand Down

0 comments on commit 91ac4c3

Please sign in to comment.