Security-Oriented C Tutorial 0x13 - Pieces Of A Puzzle - Null Byte
Before we begin learning about another vulnerability, we are going to explore printf in a bit more detail. This will be quick little tutorial.
The Missing Link
One conversion specifier I have not told you about is %n. %n is a special little one because it does not do the same thing as all the others. If you take a look at man 3 printf, the description for %n is:
The number of characters written so far is stored into the integer indicated by the int * (or variant) pointer argument. No argument is converted.
Let's see an example.
Example Code
The %n conversion specifier writes to the address of a variable, like scanf. That's weird, why would you want this? Well, one reason could be for visual formatting, if the programmer required, say, indenting... I don't know, if you find out, you can tell us all!
Compiling and Running
As we can see, the %n conversion specifier does not print anything out but does a write instead.
The Width Modifier
The width modifier allows us to specify the minimum number of bytes to write and pads with spaces.
Example Code
By adding a number between the % and letter in the conversion specifier, just like adding a maximum length input for scanf, we can perform this operation.
Compiling and Running
Pretty neat but what's the point of learning this? We will see in the next tutorial.
Direct Parameter Access
The Direct Parameter Access allows us to manipulate which argument corresponds to which conversion specifier. To do this, we need to type the nth parameter followed by the dollar sign between the % and conversion specifier letter(s) like so: %n$d.
Example Code
Aaand results are...
Compiling and Running
Cool! Again, the point of this? We'll also find out in the next tutorial!
Conclusion
Make sure you guys thoroughly understand these concepts so that when I introduce the vulnerability, we can apply it. Stay tuned!
dtm.
Từ khóa » C 0x13
-
SYS_ERRNO (0x13) - Compiler User Guide - Keil
-
Hi Guys! If Constant 0x13 And 'c' Are Char Type What Will Be Printf ...
-
[PDF] C: Pointers And Arrays
-
Missing Flow Control Data (0x13) From Reading Device Data Stream
-
Virtual-Key Codes (Winuser.h) - Win32 Apps | Microsoft Docs
-
Crackme3 - GitHub
-
ARM Compiler Toolchain Developing Software For ARM Processors ...
-
4. Understanding The RTPS Packet Format - RTI Community
-
[SOLVED] Failed To Connect To ESP32: Timed Out Waiting For Packet ...
-
BUSINESS Kabelklemme CLIK C 1-6 0X13 MP Gelb PVC 3mm 4 ...
-
"C [+0x333e3] Tsi_EmergencyShutDown+0x13" When ...
-
0X13 To Decimal