전체 글

Reversing Advanced

[dreamhack] rev-basic-6

rev-basic-6__int64 __fastcall sub_140001000(__int64 a1){ int i; // [rsp+0h] [rbp-18h] for ( i = 0; (unsigned __int64)i if문을 보면 byte_140003020[] 과 byte_140003000[] 를 비교하는 것을 확인할 수 있다.byte_140003020[a1[i]] == byte_140003000[i] 조건을 만족해야한다. 요약하면 다음과 같이 설명할 수 있다.byte_140003020[] 중에서 byte_140003000[i]와 같은 값에 대한 인덱스를 구하고 a1[i]로 넣어주면 flag다. 인덱스 값을 맞춰주기 위해서 byte_140003020[] 과 byte_140003000[] 의 데이터를 확인..

Reversing Advanced

[dreamhack] rev-basic-5

rev-basic-5_int64 __fastcall sub_140001000(__int64 a1){ int i; // [rsp+0h] [rbp-18h] for ( i = 0; (unsigned __int64)i if문을 보면 인자로 받은 a1을 byte_140003000[i]와 비교한다.i가 -1 일 때, a1[i+1] + a1[i] = byte_140003000[i] 가 성립하는 경우에만 flag이다.byte_140003000[i]을 확인하고 a1[i+1] + a1[i] = byte_140003000[i] 라는 조건이 성립하는 flag를 구해보자. 다음은 byte_140003000[32]다..data:0000000140003000 ; unsigned __int8 byte_140003000[32].d..

Reversing Advanced

[dreamhack] rev-basic-4

rev-basic-4__int64 __fastcall sub_140001000(__int64 a1){ int i; // [rsp+0h] [rbp-18h] for ( i = 0; (unsigned __int64)i > 4)) != byte_140003000[i] ) return 0i64; } return 1i64;}if문 조건으로 a1에 대한 검증을 수행한다. 조건을 해석하면 다음과 같다.(16 * a1[i]) ^ (a1[i] >> 4) == byte_140003000[i]16*a1[i] 과 a1[i] >> 4 를 서로 OR 연산한 결과를 생성한다. 앞서 생성한 결과와 byte_140003000[i]가 동일한 경우의 a1[i]이 flag다. 즉, flag를 구하는 방법의 핵심은 16*a1[..