[HTB] Bombs Landed

2021. 3. 24. 04:550x02 Reverse Engineer/0x03. Etc

728x90

분석

 

매개변수가 3개 이상일 때 

eax와 ecx를 비교하는 부분을 강제 패치하게 되면 
Input 값에 X를 입력할 수 있게 되고, 그 이후에 CALL C3을 만나서 RET 처리 된다.

매개변수가 4개 이상일 때

마찬가지로 eax, ecx 비교하는 부분을 강제 패치하게 되면 
가상 공간을 할당하고, 특정 오프셋 값들을 XOR로 복호화 하는 작업을 하게 된다. 그 이후 복호화 된 부분을 CALL 하게 된다.

복호화 코드

XOR = 0x63
try:
    with open('./BombsLanded','rb') as f:
        data = f.read()


    offset = {
        'start':'0x11A0',
        'end' : '0x1336'
    }

    bytes_read = bytearray(data)[int(offset['start'],16):int(offset['end'],16)]
    
    print(bytes_read)

    
    write_byte = bytearray(bytes_read)
    
    
    for i in range(0,len(write_byte)):
        write_byte[i] ^= XOR
    with open('./result.bin','wb') as f:
        f.write(write_byte)
        
except FileNotFoundError as e:
    print(e)

 

복호화 된 부분 분석 

 

l33t 입력

LOAD section :
printf == 0x80486B0
memset == 0x8048750
__isoc99_scanf == 0x8048760


unsigned char data[17] = "\0"; 로 유추가능 
strlen == 0x8048720

 
exit == 0x8048700

 

 

이까지 진행하고 답이 안나와서 디버깅을 진행. 

0x8048B35부터 0x8048B64까지가 핵심

디버깅이 최고다 :) 

'0x02 Reverse Engineer > 0x03. Etc' 카테고리의 다른 글

어셈 복습 Decimal to Binary  (0) 2021.07.07
Credential leak from Chrome browser [MacOS Version]  (0) 2021.06.27
CRACKME constant ver 01 write up  (0) 2020.07.04
CRACKME constant ver 01  (0) 2020.07.04
lyl -3부  (0) 2020.04.30