Skip to content

Instantly share code, notes, and snippets.

@5teven1in
Created September 24, 2020 17:46
Show Gist options
  • Save 5teven1in/092417c956f643b770c2f78438a06b42 to your computer and use it in GitHub Desktop.
Save 5teven1in/092417c956f643b770c2f78438a06b42 to your computer and use it in GitHub Desktop.

Easy Keygen

Concept

  • basic reverse
  • static analysis
  • XOR encryption

Solution

Figure out the address of main function (0x00401000) by looking the xref of some certain strings ("Input Serial", "Input Name"...).

We can find the name is XORed by the key [16, 32, 48], and the key is repeatly padding to the length of name.

...
v6 = 16;
v7 = 32;
v8 = 48;
printf(aInputName);
scanf(aS, v9);
v3 = 0;
for ( i = 0; v3 < (int)strlen(v9); ++i )
{
if ( i >= 3 )
    i = 0;
sprintf(&Buffer, Format, &Buffer, v9[v3++] ^ *(&v6 + i));
}
...

Therrefore, do XOR operation with each element of [0x5B, 0x13, 0x49, 0x77, 0x13, 0x5E, 0x7D, 0x13] and [16, 32, 48] * 3 and get the flag K3yg3nm3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment