Jersey CTF III 2023 - tracer

unknown

  • [? solves / ? points]

Analysis

Solve

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# for ( i = 0; i <= 304; ++i )
# {
# for ( j = 0; j <= 0x26; ++j )
# flag[j] = key[j] ^ sbox[(unsigned __int8)flag[j]];
# }

flag = bytes.fromhex('''
FC 55 A8 C7 F5 52 07 B4 25 B0 65 CC 9C 5F C8 90
4B 1B 01 05 80 A3 06 D4 47 94 50 32 F9 04 52 58
88 31 A5 BD 82 D9 8E 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
''')
flag = [i for i in flag]

key = bytes.fromhex('''
9A 81 14 C3 E0 CA C0 09 B8 C8 27 7A 5F D7 B1 ED
9A 73 1A 8F 8C 04 92 8E EA 7C 5A BD B1 B4 72 1B
2F 3A 76 C6 C9 02 EA 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
''')

sbox = bytes.fromhex('''
66 40 3A 55 92 34 EF AA 33 AF 4F B7 0C C9 B8 A4
E4 EE FE EC 08 BD DA F1 91 DF 01 AE 75 5A 43 05
F2 64 8B BC 61 A3 B6 C8 57 ED 94 98 03 8E AB 7D
51 F7 65 CA 76 C5 50 D2 BE CD 1F 1C 26 97 D7 89
19 C6 21 99 31 95 67 60 A8 10 7A 5C 53 0B 7C 30
32 B2 12 29 CE E2 2E 7B 37 15 56 A1 2D 47 D1 88
A5 2A 9B 5D F5 71 85 90 62 E6 D9 D8 11 0D 63 D3
07 1A E3 70 24 F4 DC 4B 93 81 6E 8D F9 FD E0 A0
73 DB 59 4E 17 87 96 42 BB CF BA 2B EA 44 6A 1D
9D 4D 79 B9 BF 5F E9 F0 41 3C 28 6C AC FA 02 1B
E1 B0 54 FB 84 D0 22 6F 13 F6 8C DD 52 68 D5 D4
58 83 C2 EB E7 6D 18 E5 CC 00 9E FF CB 5B 78 C7
2C C1 B1 FC 3F AD 9A A7 B4 5E F3 8F DE C3 14 E8
2F 0F 8A 3D 36 49 48 C0 D6 23 04 7F 7E 3B 16 69
25 0A A9 09 6B 77 F8 B5 45 A6 1E 06 20 0E 39 38
4A 74 B3 4C 27 3E C4 72 86 80 A2 9C 9F 46 82 35
''')

for i in range(0, 305):
for j in range(0, 39):
flag[j] = key[j] ^ sbox[flag[j]]

print(flag)
flag = bytes(flag)
print(flag)