CTF/misc

[ACECTF] Double Vision (steganography)

zkvlkat /ᐠ。ꞈ。ᐟ\ 2025. 3. 7. 23:41

 

Description:
You've stumbled upon a ZIP file named double_vision.zip. Inside, you find two PNG images labeled 1.png and 2.png. While the images appear nearly identical, something unusual is hidden between them. Can you uncover the secret and retrieve the flag?

당신은 double_vision.zip이라는 ZIP 파일을 발견했습니다. 그 안에는 1.png와 2.png라는 이름의 두 개의 PNG 이미지가 있습니다. 이미지들은 거의 동일해 보이지만, 그들 사이에 숨겨진 뭔가 이상한 것이 있습니다. 비밀을 밝혀내고 플래그를 찾아낼 수 있나요?

 

우리는 2개의 PNG 파일이 포함된 ZIP 파일을 받았습니다. 이 두 이미지를 XOR 연산을 수행하면 오른쪽 상단 모서리에 점-점-대시가 거의 보입니다. 이를 모스 부호로 해독하면 쉽게 플래그를 얻을 수 있습니다.

라고 한다.

 

pip install Pillow

 

from PIL import Image

def xor_images(image1_path, image2_path, output_path):
    # 이미지 열기
    image1 = Image.open(image1_path)
    image2 = Image.open(image2_path)

    # 이미지 크기 확인
    if image1.size != image2.size:
        print("이미지 크기가 다릅니다.")
        return

    # XOR 연산 결과를 저장할 이미지 생성
    output_image = Image.new('RGB', image1.size)

    # 픽셀별 XOR 연산
    pixels1 = image1.load()
    pixels2 = image2.load()
    output_pixels = output_image.load()

    for x in range(image1.size[0]):
        for y in range(image1.size[1]):
            r1, g1, b1 = pixels1[x, y]
            r2, g2, b2 = pixels2[x, y]
            output_pixels[x, y] = (r1 ^ r2, g1 ^ g2, b1 ^ b2)

    # 결과 이미지 저장
    output_image.save(output_path)

# 이미지 경로 지정
image1_path = 'image1.png'
image2_path = 'image2.png'
output_path = 'output.png'

# 함수 호출
xor_images(image1_path, image2_path, output_path)

로 output.png를 이미지를 열면 새까만 화면이 나온다.

그리고 우측 상단에 이렇게 모스부호가 있다.

해커의 통찰력은 대단해야 한다는 것을 보여주는 문제 같다.

reference

https://hackmd.io/@f4n-n3r0/HyqelR091l?utm_source=preview-mode&utm_medium=rec#Double-Vision

'CTF > misc' 카테고리의 다른 글

[LITCTF]misc 풀이 모음  (0) 2025.04.04
[ACECTF] Whispering Waves (steganography)  (0) 2025.03.09
[ACECTF] HeaderHijack (steganography)  (0) 2025.03.07
[ACECTF] Tab&Spaces (steganography)  (0) 2025.03.07
[ACECTF] For The Fans (osint)  (1) 2025.03.07