콘텐츠로 건너뛰기

Dream Zoo

문제 설명

  • Description
    드림핵 공간에는 엄청난 동물원이 있어요.
    주어진 pcap 파일을 분석하여 동물원으로 가보세요!
    동물원에서 많은 동물들을 살펴보고 플래그를 찾으세요!
  • FYI
    플래그 형식은 DH{...} 입니다.

Solution

1. 첫패킷 보내는 부분 중 dns.qry.name에서 zip 파일 시그니처 확인

    50 4b 03 00 41 40 ..

    2. 두번째로 보내는 패킷 내용 중에서 OpenStego 툴을 이용하여 이미지 감추기 확인

    GET /syvaidya/openstego/releases/download/openstego-0.8.6/Setup-OpenStego-0.8.6.exe HTTP/1.1


    3. DNS 쿼리의 도메인 이름(dns.qry.name) 필드 추출한 결과를 extracted.txt 파일로 저장

    tshark -r zoo.pcap -Tfields -e dns.qry.name | awk ‘!a[$0]++’ > extracted.txt

    4. zip 파일 내용만 읽어오도록 parse.py 스크립트 작성 / 실행

    with open("extracted.txt", 'rb') as f:
        data = f.read()
    
    data = data.replace(b"\n", b"")
    data = data.replace(b".googie.com", b"")
    data = data.replace(b".", b"")
    data = data.strip()
    data = bytes.fromhex(data.decode('utf-8'))
    
    with open("extracted.zip", 'wb+') as file:
        file.write(data)
    

    5. extracted.zip 압축 해제시 10개의 png 이미지 파일과 1개의 hint.txt 텍스트파일 확인

    seo@seo:~/Documents/dreamhack/dream_zoo/bb$ unzip ../extracted.zip
    Archive:  ../extracted.zip
      inflating: cat.png
      inflating: chipmunk.png
      inflating: dog.png
      inflating: dog2.png
      inflating: hamster.png
      inflating: hint.txt
      inflating: monkey.png
      inflating: panda.png
      inflating: rabbit.png
      inflating: squirrel.png
      inflating: tiger.png

    6. hint.txt 파일 내용에서 하트가 있는 이미지에 스테가노그래피 기법이 적용되었다는 힌트 제공

    seo@seo:~/Documents/dreamhack/dream_zoo/bb$ cat hint.txt
    Animals that receive hearts are hiding something.

    7. 확인 결과, hamster.png, squirrel.png, dog.png 3개의 이미지에 추가된 하트 그림 확인

    8. Openstego 툴로 각 3개의 png 파일에서 데이터를 추출해보면, 아래의 숨겨진 파일 확인 가능

    • hamster.png: hint2.txt – ( cat’s hidden ) ( squirrel’s hidden ) ( dog’s hidden ) = FLAG 힌트 제공
    • squirrel.png: parrot.png – XOR 힌트 제공
    • dog.png: giraffe.png – “How many animals exist in the 1.zip file in total”

    9. Openstego 툴로 cat.png 파일에서 데이터를 추출해보면, XOR 암호화된 flag.txt 내용 확인

    seo@seo:~/Documents/dreamhack/dream_zoo/bb$ cat ../flag.txt
    JFu:l`>|c:bQj`}Q~:me=zQb=:e}Qj:z:ss

    이때 FLAG가 DH{인 것을 가정하면,

    >>> hex(ord('J') ^ ord('D'))
    '0xe'
    >>> hex(ord('F') ^ ord('H'))
    '0xe'
    >>> hex(ord('u') ^ ord('{'))
    '0xe'

    0xe와 XOR된 것을 확인,

    10. XOR 암호화된 flag.txt 파일 내용 중 문자 하나씩 0xe와 XOR해서 복호화된 FLAG 획득

    • solve.py
    with open("flag.txt", 'rb') as f:
        data = f.read()
    
    for i in range(len(data)):
        print(chr(data[i] ^ 0xe), end='')
    seo@seo:~/Documents/dreamhack/dream_zoo$ python3 solve.py
    DH{4bn0rm4l_dns_p4ck3t_l34ks_d4t4}

    FLAG

    DH{4bn0rm4l_dns_p4ck3t_l34ks_d4t4}

    태그:

    답글 남기기