Created
April 9, 2022 21:08
-
-
Save 6f70/a361d2bc587152969f53b67eff278050 to your computer and use it in GitHub Desktop.
CTF writeup - Synergistic Hyperscale Interoperable Tokens (PlaidCTF 2022)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1/10] Produce a new secret token for 6535016376403176904 | |
8673357082917415256 | |
[2/10] Produce a new secret token for 2467768788370249308 | |
6321414967796127680 | |
[3/10] Produce a new secret token for 15027414725812929110 | |
11980021394058769251 | |
[4/10] Produce a new secret token for 10702703014918823634 | |
10162230340064657963 | |
[5/10] Produce a new secret token for 9183860382523110997 | |
9455870811549556796 | |
[6/10] Produce a new secret token for 8012324378975699066 | |
10956485569638790932 | |
[7/10] Produce a new secret token for 5586890336573343448 | |
4547398440643275083 | |
[8/10] Produce a new secret token for 13004947060634539310 | |
17761150032074348261 | |
[9/10] Produce a new secret token for 13679116250745902676 | |
18220244222682735531 | |
[10/10] Produce a new secret token for 15455050481726328053 | |
15334363509564988023 | |
Congrats! | |
PCTF{rust2wasm2rust2wasm2rust_15a0fc7fa673ae85} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
import subprocess | |
context.log_level = 'error' | |
def main(): | |
conn = remote('synergistic.chal.pwni.ng', 1337) | |
powargv = conn.recvline().decode().split() | |
assert powargv[0] == 'hashcash' | |
conn.send(subprocess.check_output(powargv)) | |
for _ in range(10): | |
challine = conn.recvline().decode().strip() | |
chal = challine.split()[-1] | |
token = subprocess.check_output( | |
('sage', 'solve.sage', chal) | |
).decode() | |
print(challine) | |
print(token) | |
conn.sendline(token.encode()) | |
print(conn.recv().decode().strip()) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
INIT = [ | |
0xDA17EDC974CBF88B05BA2B30F33009E3, | |
0x7C59A1115F898C02BDEF1E03F8A42971, | |
0x1D33F3FCE07374372CE572B38B540058, | |
0x029C91EB9CAB7C67405943E2C746EF8A, | |
0xF4BE5D2A92C9C93C012DA654BC29E00C, | |
0x94AEDB33A79ACDE64A901FC9B5E1F7EF, | |
0x2FC1C5CAD1DBB6754707916C3F4F882C, | |
0x7953163B864ECA9501E948B96DC61489, | |
0xA1CE9B3BE90D180288C7AF20A872B40F, | |
0xF08D70B3923D15702DEF3A950A3DF2EE, | |
] | |
COEFFS = [ | |
0xaadc352d973570941c4ef5256bf7691f, | |
0x3b8efd66d9ab488a4bda5e346cf43679, | |
0xba665904d9ce575bf63d4b112d6fd165, | |
0x92c103f01e7ddca6d313806dad60830a, | |
0x7bb0ffd1d80fb3212868836edee04734, | |
0x603ffacc774e09f2895dd3aa6089713e, | |
0x468f22365bd9e2ed0ded12b11aa38888, | |
0x6154bec0cd734930d005c98621b0a224, | |
0xf380c3e496070199646b9980e07fbde6, | |
0x654006a05ad681d0ec32ef2ca379f6ef, | |
] | |
def calc_token(inp): | |
mat = matrix( | |
Zmod(1 << 64), | |
[ | |
COEFFS, | |
] + [ | |
[0] * i + [1] + [0] * (9 - i) | |
for i in range(9) | |
] | |
) | |
vec = vector( | |
Zmod(1 << 64), | |
INIT[::-1] | |
) | |
return ((mat ^ inp) * vec)[0] | |
sys.stdout.write(str(calc_token(int(sys.argv[1])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment