Hmm? What’s wrong with using the same flag format again? Whisper it in my ear so they don’t hear.
Here’s partialrsa.txt:
1 | n: 103805634552377307340975059685101156977551733461056876355507089800229924640064014138267791875318149345634740763575673979991819014964446415505372251293888861031929442007781059010889724977253624216086442025183181157463661838779892334251775663309103173737456991687046799675461756638965663330282714035731741912263 |
So the flag description gives us a little hint that the challenge is about the reuse of the same flag format. This refers to the “squ1rrel{“ prefix that is used for the flag.
This is yet another standard RSA attack – specifically, a variant of Coppersmith known as the stereotyped message attack. Essentially, the idea is that we know the plaintext is something of the form “squ1rrel{XX…XX}”, where X’s represent unknown characters. Coppersmith’s attack allows us to decrypt it. I won’t explain it myself, for an actual explanation see here.
Since this is a very standard attack, we can simply search up a script for it here.
The last part we need to do is figure out the number of bytes between the curly braces of the flag. We can just brute force this :)
Here’s the sage script:
1 | from Crypto.Util.number import * |
squ1rrel{wow_i_was_betrayed_by_my_own_friend}