Binary Analyssi
First, examine the binary with IDA Pro. The main function performs the following operations:
int main() {
char input[24];
char encrypted_flag[] = "rxusoCqxw{yqK`{KZqag{r`i";
printf("please input flag");
scanf("%24s", input);
if(strlen(input) != 24) {
printf("error");
return 0;
}
for(int i = 0; i < 24; i++) {
input[i] ^= 0x14;
}
if(memcmp(input, encrypted_flag, 24) == 0) {
printf("good job");
} else {
printf("error");
}
return 0;
}
Key Observations
- The program expects a 24-character input
- Each character is XORed with 0x14
- The result is compared against a hardcoded encrypted string
Solution Script
To reverse the encryption and retrieve the flag:
encrypted = 'rxusoCqxw{yqK`{KZqag{r`i'
flag = ''.join([chr(ord(c) ^ 0x14) for c in encrypted])
print(flag)
This Python script performs the inverse XOR operation on each character of the encrypted string.