LA CTF 2023 - crypto / one-more-time-pad

2023. 2. 13. 07:06·CTF/Solved
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
'CTF/Solved' 카테고리의 다른 글
  • 24@CTF '23 - oven
  • LA CTF 2023 - crypto / rolling in the mud
  • LA CTF 2023 - pwn/rut-roh-relro
  • LA CTF 2023 - pwn / rickroll
wyv3rn
wyv3rn
아저씨의 흔한 취미. wyv3rn#1249
  • wyv3rn
    think storage
    wyv3rn
  • 전체
    오늘
    어제
    • 분류 전체보기 (502)
      • To do list (7)
        • Doing (1)
        • Complete (6)
      • Diary (35)
      • Tips & theory (73)
      • Kernel Exploit (27)
        • Theory (15)
        • Exercise (5)
      • File Structure (6)
      • Wargame (313)
        • pwn.college (34)
        • Dreamhack (148)
        • pwnable.kr (15)
        • Lord of Sqlinjection (3)
        • Cryptohack (20)
        • Root me (27)
        • CodeEngn (4)
        • Exploit Education (22)
        • ROP Emporium (8)
        • H4C (10)
        • Hackerchool (22)
      • CTF (41)
        • Solved (39)
        • Unsolved (2)
      • Script (0)
      • RubiyaLap (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

    • PWN wargame 모음 (및 느낀점)
    • 비공개 글들에 대해.
    • 뭐라도 하나 얻어가시길...
  • 인기 글

  • 태그

    libc
    phoenix
    la ctf
    FSB
    x64
    dreamhack
    root
    _IO_FILE
    64bit
    BOF
    x86
    Me
    RTL
    pwntools
    docker
    Format String Bug
    vtable
    lob
    heap
    hackerschool
    Buffer Overflow
    tcache
    rop
    cryptohack
    ROOT ME
    exploit education
    CANARY
    32bit
    pwnable.kr
    root-me
  • 최근 댓글

  • 최근 글

  • 250x250
    반응형
  • hELLO· Designed By정상우.v4.10.3
wyv3rn
LA CTF 2023 - crypto / one-more-time-pad
상단으로

티스토리툴바