when trying to follow a tutorial on string exploits in C, I had the following questions which I do not seem to find an answer to.
- "If we were to pass the string AAAA%10$n, we would write the value 4 to the address 0x41414141!". This is an excerpt from a tutorial. But how come we write a 4? I do realize that AAAA in hex becomes 0x41414141 but then %10$n is written. What does this 10 mean, what does this dollar mean and where does the 4 come from?
- The final solution to an exploit for a wargame is given below. It however seems I can completely drop the %238x (what was the purpose of this anyway?) and here the end of the string is %10$hn. what does 'hn' here mean? The C reference documentation refers to 'hn' as "unsigned short *". Is this even a datatype?
$(python -c 'print "\x40\x99\x04\x08%238x%10$hn"')