Reverse engineering analysis of a stripped x86-64 ELF binary (keygenme3) that validates email/serial pairs. Using Ghidra decompilation, I extracted the serial validation algorithm, manually verified the logic, and implemented a working keygen in C. Full decompiled pseudocode, manual calculations, keygen source code, and testing results available on GitHub.
Binary tested: keygenme3 (ELF 64-bit LSB executable, x86-64, stripped). The serial is derived from two mathematical operations on email characters: sum of (char × 8) and sum of (char² - 188), formatted as 4-digit hex pairs.
Software license validation is a common anti-piracy mechanism. Understanding how these systems work is crucial for:
First, I examined the binary metadata:
$ file keygenme3
keygenme3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=84fc4344dc69402219a6f4cbfe4c04fa00961ff1,
for GNU/Linux 3.2.0, stripped
The "stripped" keyword meant no function names or debugging symbols—everything would have generic labels like FUN_00401234.
entry)FUN_00401234 → mainFUN_00401156 → serial_checkThe decompiled serial_check function revealed the validation logic:
bool serial_check(char *email, char *serial)
{
int iVar1;
size_t sVar2;
uint local_44; // Accumulator 1
uint local_40; // Accumulator 2
int local_3c; // Loop index
char local_38[24]; // Generated serial buffer
local_44 = 0;
local_40 = 0;
local_3c = 0;
while (true) {
sVar2 = strlen(email);
if (sVar2 <= (ulong)(long)local_3c) break;
local_44 = local_44 + (int)email[local_3c] * 8;
local_40 = (local_40 + (int)email[local_3c] * (int)email[local_3c]) - 0xbc;
local_3c = local_3c + 1;
}
sprintf(local_38, "%04x-%04x", local_44, local_40);
iVar1 = strcmp(serial, local_38);
return iVar1 == 0;
}
local_44: Sum of (character × 8) for each email characterlocal_40: Sum of (character² - 188) for each email characterlocal_38: Buffer holding the generated serial in format "%04x-%04x"I reimplemented the algorithm in C to generate valid serials for any email:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
printf("Usage: %s <email>\n", argv[0]);
return 1;
}
char *email = argv[1];
unsigned int local_44 = 0;
unsigned int local_40 = 0;
for (int i = 0; i < strlen(email); i++) {
local_44 += email[i] * 8;
local_40 += (email[i] * email[i]) - 0xbc;
}
printf("%04x-%04x\n", local_44, local_40);
return 0;
}
$ gcc cracker.c -o keygen
$ ./keygen pr0cracker
1f68-190d9
$ ./keygenme3
********************************
E-Mail address: pr0cracker
Serial number: 1f68-190d9
Correct serial! Software unlocked.
********************************
Decompilation tool used to analyze the stripped binary, extract validation algorithm, and generate C pseudocode
Implemented keygen based on extracted algorithm, compiled with GCC for validation testing
Reverse engineering analysis of stripped x86-64 ELF binary (keygenme3): successfully decompiled with Ghidra, extracted serial validation algorithm revealing two mathematical operations (sum of char × 8 and sum of char² - 188), manually verified calculations for email "pr0cracker" (serial: 1f68-190d9), and implemented working keygen in C. Algorithm uses no randomness or server validation—serials are deterministically derived from email alone. Complete decompiled code, manual calculations, keygen implementation, and testing results available on GitHub.