Challenge
1 |
|
This Challenge need you bypass the MAC check.
1 |
|
What you need to send is like MAC<|>COMMAND
And the MAC check is …
1 |
|
If you want server executes your command :
- cmd == ‘tag’
- The right MAC, encode by cmdline.
Let’s look at how MAC generate :
1 |
|
Here stop me at first, because of C.encrypt(xor(b, f(k0, i)))
, the index is considered.
So, is Cut & Paste fail … ?
Fortunately, I found that the point is in f(k0,i)
, i % (8 * N)
Index will reset if i > 8 * blocksize (2048 bytes).
Solved
Noted that in tag
function :
1 |
|
Although This funcion will print the MAC of followed command.
Command after tag will be split, and concat with ‘ ‘, but MAC check will not.
E.G.
1 |
|
This, devil space waste me half an hour QwQ.
Therefore, make the payload be carefully XD.
E.G.
Red one is what I wanted.
Blue one & Green one is all garbage
And I want the MAC of “ pwd” -> MAC( block(‘ pwd’ + padding) + block(length(4)+padding) )
block :
b’\x91\x04\xa61\xbb7\xe7\x07S(k*|~\xb0\xa8’
b’u-\xaeD\n\xe4\xdd\xad\xb2%\xe7\xad0HU\x9b’
———————— START ———————————-
Send : mac <|> tag aaaa....2048(total).....aaaaa pwd
-> block will like :
b’\xef\xb9\xaa\xe5\xe4}\xa4\x9e\xed\xdc\xa6\xc9b\xb8\xdb\x03’
b”\xff\xd4\xbbL!\xcc’\x82\x19\xdf\xd5\xacy\xbd\xa3\xa1”
…
b’\x94\xa9\xad{\xc1J(D7$\x06Q\x06\x0c\xff>’
b’\x91\x04\xa61\xbb7\xe7\x07S(k*|~\xb0\xa8’
b’\xf8\x93\xa7ag\xdc\xf1\xe3H;@\xa4/D}\xb2’
-> return MAC( block(a*16) * 128 + block(‘ pwd’ + padding) + block(length(2052)+padding) )
-> MAC : 296e6760be51d89e7003a67491664baf
Send : mac <|> tag aaaa....2048(total).....aaaaaecho
-> block :
b’\xef\xb9\xaa\xe5\xe4}\xa4\x9e\xed\xdc\xa6\xc9b\xb8\xdb\x03’
b”\xff\xd4\xbbL!\xcc’\x82\x19\xdf\xd5\xacy\xbd\xa3\xa1”
…
b’\x94\xa9\xad{\xc1J(D7$\x06Q\x06\x0c\xff>’
b’\xd4Fw\xca@\x9a\xe5\xd1\x077\xc2\rHz}\xbb’
b’\xf8\x93\xa7ag\xdc\xf1\xe3H;@\xa4/D}\xb2’
-> return MAC( block(a*16) * 128 + block(‘echo’ + padding) + block(length(2052)+padding) )
-> MAC : a14caecaef319d3668953429aaaeaed9
Send : mac <|> tag echo
-> block:
b’\xd4Fw\xca@\x9a\xe5\xd1\x077\xc2\rHz}\xbb’
b’u-\xaeD\n\xe4\xdd\xad\xb2%\xe7\xad0HU\x9b’
-> return MAC( block(‘echo’ + padding) + block(length(4)+padding) )
-> MAC : 83fd0846aafe9e30c710badab6b61a43
——————————- GET ALL ——————————-
XOR Three MAC,
296e6760be51d89e7003a67491664baf ^ a14caecaef319d3668953429aaaeaed9 ^ 83fd0846aafe9e30c710badab6b61a43
We then get a MAC of (“ pwd”)
-> bdfc1ecfb9edb98df8628878d7eff35
And then send back to server to execute the command, for example
bdfc1ecfb9edb98df8628878d7eff35<|> pwd
And again, be careful your devil space QwQ….
1 |
|
Then, send the command solved this challenge LoL.
1 |
|