https://dreamhack.io/wargame/challenges/19/
rev-basic-5 ๋ฌธ์ ๋ ์ด์ ๊น์ง์ rev-basic ๋ฌธ์ ๋ค๊ณผ ๋น์ทํ ์ ํ์ด๋ค.
if ์ ์ ์กฐ๊ฑด๋ฌธ์ ํ์ธํด๋ณด๋ฉด,
*(unsigned __int8 *)(a1 + i + 1) + *(unsigned __int8 *)(a1 + i) != byte_140003000[i]
๋ผ๊ณ ๋์ด ์๋๋ฐ,
์ด๋ฅผ ๋ณด๊ธฐ ํธํ๊ฒ ์ ๋ฆฌํ์๋ฉด,
a1[i+1] + a1[i] != byte_140003000[i]
์ด๋ค.
์ฆ,
a1[i+1] + a1[i] = byte_140003000[i]
์ด๋ผ๋ ์๋ฏธ ์ด๋ฏ๋ก
์ํ์ ์ผ๋ก ์๊ฐํ์ ๋, ์ดํญํ๋ฉด
a1[i] = byte_140003000[i] - a1[i+1]
๊ฐ ๋๋ค.
๊ทธ๋ผ byte_140003000 ์ ์ ์ฅ๋ ๋ฌธ์๋ค์ ํ์ธํด๋ณด์.
ADh, D8h, CBh, CBh, 9Dh,
97h, CBh, C4h, 92h, A1h,
D2h, D7h, D2h, D6h, A8h,
A5h, DCh, C7h, ADh, A3h,
A1h, 98h, 4Ch, 00h
์ด๋ ๊ฒ 24๊ฐ ์ฆ, 0x18 ๊ฐ ์ด๋ค.
์ด๋, ๋ง์ง๋ง ๋ฌธ์๊ฐ 0x00 ์ด๋ฏ๋ก
๋ค์์ ๋ถํฐ ํ๋์ฉ ๊ตฌํ ์ ์์ ๊ฒ์ผ๋ก ๋ณด์ธ๋ค.
C๋ก ์์ฑํด ๋ณด์๋ค.
#include<stdio.h>
int main(){
int byte[] = {
0xAD, 0xD8, 0xCB, 0xCB, 0x9D,
0x97, 0xCB, 0xC4, 0x92, 0xA1,
0xD2, 0xD7, 0xD2, 0xD6, 0xA8,
0xA5, 0xDC, 0xC7, 0xAD, 0xA3,
0xA1, 0x98, 0x4C, 0x0
};
int input[24];
int last = 0;
int i;
for (i=23 ; 0<=i ; i--){
last = byte[i] - last;
input[i] = last;
}
int j;
for (j=0 ; j <24 ; j++){
printf("%c", input[j]);
}
printf("\n");
return 0;
}
์ด๋ ๊ฒ ๊ตฌํ๋ฉด
FLAG ๋ All_l1fe_3nds_w1th_NULL
์ด๋ค.
':: DreamHack ๐ฉ > wargame - reverse' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ dreamhack ] - [ reversing | rev-basic-7] (0) | 2022.06.01 |
---|---|
[ dreamhack ] - [ reversing | rev-basic-6] (0) | 2022.05.31 |
[ dreamhack ] - [ reversing | rev-basic-4 ] (0) | 2022.05.30 |
reversing | [CodeEngn] Malware L07 (0) | 2022.05.30 |
[dreamhack] - [reversing | rev-basic-2] (0) | 2022.05.30 |
๋๊ธ