Description
My friend sent me this file. He told that if I manage to reverse it, I’ll have access to all his devices. My misfortune that I don’t know anything about reversing :/
Attachment: rev60.zip
Exploit
1 | stream = fopen(".password", "r"); |
1 | v4 = 4846; |
After decompiled by IDA pro, what the program does is really clear. It reads a string of 15 characters from file .password
and check whether the following condition is satisfied.
(str[0] + V[0])%4919 | ... | (str[14] + V[14])%4919 <= 0, |
To satisfied the condition, just make every (str[i] + V[i]) = 4919
. By the way, during the competition, when I saw the numbers 48xx
and 4919
, I was able to guess that the flag is the difference between two numbers. I have written a script to compute the flag.
1 | ary = [4846, 4832, 4796, 4849, 4846, 4843, 4850, 4824, 4852, 4847, 4818, 4852, 4844, 4822, 4794] |
Flag:
IW{FILE_CHeCKa}
Note
Learned: How GCC optimize division and modulo operation. Reference. Maybe I will read Hacker’s Delight someday.