Can you see me ? - Cookie Arena

2025. 11. 22. 00:27·

Đề bài


Giải

Bài này cho mình một file png như sau

Mình sẽ kiểm tra file ảnh này

$ pngcheck s3cr3t.png 
s3cr3t.png:  invalid chunk name "" (00 4e 00 47)
ERROR: s3cr3t.png

Thấy nó bị hỏng do có một chunk lạ

Mình sẽ mở HxD lên để xem

Đầu tiên thì mình thấy một chuỗi là: y0u_c4n_n0t_cr4ck_th1s_f1l3_w1th_th3_d3f4ut_w0rdl1st_0n_k4l1

Chắc là passwd để sau unzip hoặc làm gì đó

Ở đây mình sẽ đi đến chỗ bị hỏng kia

Nhận thấy đây là magic bytes cho một ảnh png khác nhưng bị xen lẫn số 00 vào giữa, khá giống với một bài trên picoCTF, mình sẽ trích ra file khác đặt là secret_1.png

Làm một con script đơn giản để sửa ảnh

inp = "secret_1.png"
out = "fixed.png"

with open(inp, "rb") as f:
    data = f.read()

res = bytearray()

i = 0
while i < len(data):
    res.extend(data[i:i+1])
    i += 2

with open(out, "wb") as f:
    f.write(res)

print("Done")

Vậy là mình thu được ảnh sau

Ảnh có rất nhiều chấm trắng nhỏ bên trong, mình cũng không rõ là mã morse hay gì nhưng cứ làm vài bước kiểm tra cơ bản xem sao

$ pngcheck fixed.png
OK: fixed.png (250x250, 24-bit RGB, non-interlaced, static, 98.1%).

File ảnh hoàn toàn ổn, không bị hỏng đâu

Đến đây thì mình sử dụng AperiSolve để check tiếp thì thấy kênh màu Blue khá bất ổn

Vậy nên mình sẽ lấy thử giá trị từ kênh Blue ra xem sao

#!/usr/bin/env python3
from PIL import Image
import sys
import os

def main():
    if len(sys.argv) < 2:
        print(f"Usage: {sys.argv[0]} input.png [out_blue.bin] [out_zip.zip]")
        sys.exit(1)

    in_path = sys.argv[1]
    out_blue = sys.argv[2] if len(sys.argv) >= 3 else "blue_bytes.bin"

    img = Image.open(in_path).convert("RGB")
    w, h = img.size
    pix = img.load()

    blue_bytes = bytearray()

    for y in range(h):
        for x in range(w):
            r, g, b = pix[x, y]
            blue_bytes.append(b)

    with open(out_blue, "wb") as f:
        f.write(blue_bytes)
    print(f"[+] Dumped {len(blue_bytes)} blue-channel bytes -> {out_blue}")

if __name__ == "__main__":
    main()

Vậy là mình đã trích được kênh màu Blue ra, mình sẽ mở HxD xem thử

Tiếp tục thấy nó bị chèn byte 00 vào giữa, tận dụng script cũ luôn

Vậy là đã sửa xong, thử kiểm tra file

$ file blue_bytes_fixed.bin 
blue_bytes_fixed.bin: Zip archive data, at least v1.0 to extract, compression method=store

Vậy là file zip đã hoàn toàn bình thường, unzip thôi

$ unzip blue_bytes_fixed.zip 
Archive:  blue_bytes_fixed.zip
warning [blue_bytes_fixed.zip]:  31030 extra bytes at beginning or within zipfile
  (attempting to process anyway)
[blue_bytes_fixed.zip] flag.txt password:

Ở đây nó hỏi mình passwd, khả năng là chuỗi mình nhận được lúc ban đầu

$ unzip blue_bytes_fixed.zip 
Archive:  blue_bytes_fixed.zip
warning [blue_bytes_fixed.zip]:  31030 extra bytes at beginning or within zipfile
  (attempting to process anyway)
[blue_bytes_fixed.zip] flag.txt password: 
 extracting: flag.txt

Giải nén thành công


Flag

Flag: EHC{b1n4ry_1s_f4nt4st1c}

'WriteUp > Steganography' 카테고리의 다른 글

0x0 - Cookie Arena  (0) 2025.11.22
Here with your eyes - Cookie Arena  (0) 2025.11.22
Disco - Cookie Arena  (0) 2025.11.22
Split - Cookie Arena  (0) 2025.11.21
'WriteUp/Steganography' Other posts in category
  • 0x0 - Cookie Arena
  • Here with your eyes - Cookie Arena
  • Disco - Cookie Arena
  • Split - Cookie Arena
longhd
longhd
Longhd's Blog
  • longhd
    Ha Duy Long - InfosecPTIT
    longhd
  • Total
    Today
    Yesterday
  • About me

    • Hello I'm Duy Long 👋🏻
    • View all categories (117) N
      • Certificates (4)
      • CTF (3)
      • WriteUp (94) N
        • Forensics (44) N
        • Steganography (5)
        • RE (9)
        • OSINT (8)
        • Web (17)
        • MISC (6)
        • Crypto (3)
        • Pwn (2)
      • Love Story (0)
      • Labs (15)
        • Information Gathering (10)
        • Vulnerability Scanning (2)
        • Introduction to Web Applica.. (1)
        • Common Web Application Atta.. (1)
        • SQL Injection Attacks (1)
  • Blog Menu

    • Home
    • Tag
    • GuestBook
  • Popular Posts

  • Tags

    CHH
    Forensics
    PTITCTF2025
    misc
    OSINT
    htb
    Re
    POCCTF2025
    picoCTF
    THM
    writeup
    Web
    EnigmaXplore3.0
    BuckeyeCTF2025
    SunshineCTF2025
    V1tCTF2025
    Steganography
    Dreamhack
    CTF
    CSCV2025
  • Recent Comments

  • Recent Posts

  • hELLO· Designed ByLong.v4.10.4
longhd
Can you see me ? - Cookie Arena
Go to Top

티스토리툴바