Home
Writeups Misc About
Null Or Never

Null or Never

The flag is padded with \x00 at the end to make the length of the flag overall becomes 100 bytes long. For each null byte appended, the value of the flag is multiplied by 256.

Hence, we can retrieve the flag using Coppersmith, however there is a twist. Even if the polynomial theoretically should output some result, none is returned by the small_roots function. The solution that works seems to reduce the x that is calculated to be the smallest x possible such that the result makes sense.

In the following implementation, and kudos to Angmar_ on Cryptohack, x is constructed as the difference between the flag with the lowest possible value and the actual flag.

Sage Implementation:

My script that fails to solve this, albeit mathematically sound, is just the simple polynomial (x * pad) ^ 3 - c = 0. Why it does not work is the work for the future me to figure out.