728x90
반응형
1. intro
2. code 및 분석
2.1. code
from itertools import cycle
pt = b"Long ago, the four nations lived together in harmony ..."
key = cycle(b"lactf{??????????????}")
ct = ""
for i in range(len(pt)):
b = (pt[i] ^ next(key))
ct += f'{b:02x}'
print("ct =", ct)
#ct = 200e0d13461a055b4e592b0054543902462d1000042b045f1c407f18581b56194c150c13030f0a5110593606111c3e1f5e305e174571431e
2.2. 분석
xor으로 구성된 단순한 문제이다.
아래 ct와 같이 decrypt 된 flag가 있기에 xor의 특성을 이용해서 다시 한번 xor 해주면 된다.
3. exploit
ec = bytes.fromhex('200e0d13461a055b4e592b0054543902462d1000042b045f1c407f18581b56194c150c13030f0a5110593606111c3e1f5e305e174571431e')
pt = b"Long ago, the four nations lived together in harmony ..."
dc = ''
for i in range(len(pt)):
dc += chr(pt[i]^ec[i])
print(dc)
┌[wyv3rn🐲]-(~)
└> python chall.py
ct = 200e0d13461a5850131f4b575a1f59504a4d1f511c18080c1a155b5356495a5b1f4b50585a4b575a4d5d050f431c0709525051461f111111
lactf{b4by_h1t_m3_0ne_m0r3_t1m3}lactf{b4by_h1t_m3_0ne_m0
728x90
반응형
'CTF > Solved' 카테고리의 다른 글
24@CTF '23 - oven (0) | 2023.04.17 |
---|---|
LA CTF 2023 - crypto / rolling in the mud (0) | 2023.02.13 |
LA CTF 2023 - pwn/rut-roh-relro (0) | 2023.02.13 |
LA CTF 2023 - pwn / rickroll (0) | 2023.02.13 |
LA CTF 2023 - pwn/bot (0) | 2023.02.13 |