보안을 그리다, 훈이

[Forensics] N0Named Wargame 누가 진짜일까?(70p) Write Up 본문

Security/Wargame

[Forensics] N0Named Wargame 누가 진짜일까?(70p) Write Up

HooNeee 2022. 1. 26. 18:07

 

N0Named Wargame Forensics 분야 누가 진짜일까?(70p) 문제에 대한 Write Up입니다.

 

[N0Named] Challenge 누가 진짜일까?

 

HELL.zip 파일을 다운로드하고 압축을 풀어보면 두 개의 bmp 파일이 나타난다.

 

CERBERUS.bmp(left) / HEELTAKER.bmp(right)

 

언뜻 보기엔 같은 이미지로 보이지만 분명 무언가 다른 부분이 존재할 것이다.

 

먼저, 각각 파일의 hex 값을 추출하여 txt 파일로 저장해둔 후 서로 다른 hex 값을 찾아 출력하는 소스코드를 Python3로 구현하였다.

 

# compare_Hex.py

a1 = list(map(''.join, zip(
    *[iter(open('/nonamed/Digital Forensics/누가 진짜일까?/HELL/Hex_CERBERUS.txt', 'r').read().replace('\n', ''))]*2)))
a2 = list(map(''.join, zip(
    *[iter(open('/nonamed/Digital Forensics/누가 진짜일까?/HELL/Hex_HEELTAKER.txt', 'r').read().replace('\n', ''))]*2)))

res = ''
for i in range(len(a2)):
    if a1[i] != a2[i]:
        res += a2[i]
        
print((bytearray.fromhex(res).decode()))

 

compare_Hex.py 실행 결과.

 

Get the Flag!

 

정상적으로 플래그가 출력되었다.

 

Flag : NND{Diff3R#NT_are_7H3Y}

 

 

굳이 일일이 소스코드를 구현하지 않고도 diffcmp 명령으로 간단히 비교할 수 있다.

 

# 복수의 Binary Files가 동일한지 확인

# 두 개
diff [file1] [file2]

# 세 개
diff3 [file1] [file2] [file3]

 

# 두 개의 파일을 비교하여 다른 byte들을 모두 출력.
# compare_Hex.py와 유사.

cmp -l -b [file1] [file2]

 

Comments