People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!
printf family function is called, it takes in a string with format specifiers (%x, for instance) and a variable amount of arguments depending on the format specifier. If an attacker can control the string, then they can trigger the format specifier functionality on unintended data. libinput is performing logging. While doing this logging, it is creating a format string dynamically by prepending a string with sprintf to be used later in another printf-like call. Because of this string concatenation for a format string with user controllable values, this created a fairly bad format string bug. This bug is explained at here.%s in the end of the string, almost everything caused a crash. Finally, FORTIFY_SOURCE=2 was set on the binary, disallowing the usage of the %N for writes. %s crash problem, direct parameter access in the format string could be used. Since this doesn't increase the pointer being used for the stack, this was a good solution to the problem. Additionally, direct parameter access cannot skip any values because of FORTIFY_SOURCE=2 being set. Because of this and the length constraint, the furthest byte that can be accessed is 27. %1$p%2$p...%27$p, which is parameterized access for all 27 bytes. Depending on the location of the field in the payload, this would leak the stack canary in the last few bytes. Damn, that's super awesome!