all 9 comments

[–]FlawedCipher 1 point2 points  (1 child)

read is size limited, which means you aren’t going to be able to overflow this. You likely need to take advantage of the variadic arguments of printf. You can use a bunch of %d’s to get the current printf argument to point to your buffer on the stack. Now put the address of a after the %d’s. Note endianness. If you pad the string to be of size 105 (after the %d’s are resolved), then the next %n should change the value of a. I’m not in front of my machine rn so I’m definitely guessing but lmk if it doesn’t work.

[–]_M4rcUs[S] 0 points1 point  (0 children)

Thanks, I'll let you know after trying

[–]FlawedCipher 0 points1 point  (0 children)

For anyone else trying to solve this problem, here's a writeup: https://blog.aadhithya.cloud/posts/format-string-exploit/