cd /news/ai-tools/reverse-engineer-a-stripped-binary-w… · home › topics › ai-tools › article
[ARTICLE · art-174775] src=reversedwithai.com ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

Reverse engineer a stripped binary with REA, step by step

A developer used REA's MCP tools in Claude Code, backed by Ghidra 12.1.4, to reverse engineer a self-built stripped x86-64 Linux ELF binary, recovering the license key DEMO-2CC99E78, the hash and XOR key, and an XOR-obfuscated update URL from the binary alone; the real program accepted the recovered key and the decoded URL matched what the program prints. The run began by decompiling the entry point to identify main at FUN_001010a0, then read 96 bytes at 0x103d80 to map a 24-byte-per-entry command dispatcher table linking check, version and unlock to their handlers. The analysis was completed without consulting the source, which the author published alongside the walkthrough as of 23 November 2026.

key takeaway

When Ghidra reports 'Could not recover jumptable' and 'Treating indirect jump as call' on a stripped binary, read the raw bytes with read_bytes instead of trusting the decompiler's pointer arithmetic: the table at 0x103d80 held 24-byte entries of name pointer, handler pointer and flag, yielding chec

by read11 min views2 publishedNov 23, 2026
Reverse engineer a stripped binary with REA, step by step
Image: Reversedwithai (auto-discovered)

A real run on my own stripped binary: REA with Ghidra finds main, the license check, the hash and XOR key, then I test the key. Mistakes and source included.

I built a small stripped Linux program with a license check, a hashed key and an XOR-obfuscated update URL, then used REA (with its Ghidra backend) to recover all three from the binary alone. The recovered key DEMO-2CC99E78 was accepted by the real program, and the decoded URL matched what the program prints.

As of 23 November 2026. I ran this with REA's MCP tools in Claude Code, backed by Ghidra 12.1.4, on an x86-64 Linux ELF. Everything below was output I saw, trimmed for length. I did not look at the source until the analysis was finished. If you have not set REA up yet, start with Getting started with REA and the REA tool page.

What was the target? #

I wrote a small C program for this and compiled it stripped with optimisation:

gcc -O2 -s -o target target.c
file target
target: ELF 64-bit LSB pie executable, x86-64, dynamically linked, stripped

It has four commands (check, unlock, info, version), a key check and an encrypted string. The full source is at the end of this guide so you can rebuild it. I moved it into a separate folder before opening anything in REA. It is my own code, so there was nothing to clear before analysing it.

The run followed three stages, shown below with the addresses I used.

How did I get a first look? #

I opened the file and asked for an overview.

open_binary  path=.../rea-run/target
-> {"format":"elf","kind":"executable","architecture":"x86_64"}

binary_overview
-> "procedure_count":45, "string_count":60
   .text 0x1010a0-0x101502 (1122 bytes)

Forty-five procedures sounds like a lot, but most are PLT thunks and startup code. .text is only 1,122 bytes. Then I listed procedures and strings. The imports told me the shape of the program before I read any code: strchr, snprintf and strcmp together suggest a key being split, formatted and compared. The strings had license: valid, license: invalid, unlock: premium features enabled, update server: %s and the command names check, version and unlock.

One odd string stood out, at 0x1020e2:

.*)`uu/*>;.?)t?";7*6?t34,;63>u,k

That is not a message anyone writes. I marked it as encrypted data to come back to.

How do I find main in a stripped binary? #

Decompile the entry point. The only useful thing it does is call __libc_start_main, and the first argument is main.

procedure_pseudo_code  procedure=entry
-> __libc_start_main(FUN_001010a0, param_2, &stack0x00000008, 0, 0, param_1, auStack_8);

So FUN_001010a0 is main. Its pseudocode loops four times, calling strcmp against a table that starts at 0x103d80, and ends with an indirect call. Ghidra added this warning:

WARNING: Could not recover jumptable at 0x00101184. Too many branches
WARNING: Treating indirect jump as call

That is not a jump table. It is a table of function pointers, a command dispatcher. I read the table with read_bytes instead of trusting the decompiler's pointer arithmetic:

read_bytes  address=0x103d80  length=96
-> 9c2010000000000050141000000000000100000000000000
   a22010000000000090141000000000000000000000000000
   a72010000000000e0121000000000000000000000000000
   af2010000000000010141000000000000100000000000000

Each entry is 24 bytes: a pointer to the command name, a pointer to the handler and an integer flag. Reading the little-endian values gave me check to 0x101450 with flag 1, a name at 0x1020a2 to 0x101490 with flag 0, version to 0x1012e0 with flag 0 and unlock to 0x101410 with flag 1. The flag matches the %s needs an argument string, so I named it "needs an argument".

Where is the license check? #

Both 0x101450 and 0x101410 print a verdict after calling FUN_00101300. procedure_callers confirmed that only those two call it:

procedure_callers  procedure=0x101300
-> ["0x101410","0x101450"]

FUN_00101300 is the key check. Its decompiled body, trimmed:

pcVar3 = strchr(param_1, 0x2d);               // '-'
if (pcVar3 == 0 || 0xd < (pcVar3 - param_1) - 3) return false;
... copy the part before the dash ...
uVar5 = 0x811c9dc5;
do {
  uVar1 = *p++;
  uVar5 = (uVar1 ^ uVar5) * 0x20003260 | (uVar1 ^ uVar5) * 0x1000193 >> 0x1b;
} while (*p != 0);
snprintf(local_48, 0x10, "%08X", uVar5 ^ 0xa5a5a5a5);
return strcmp(pcVar3 + 1, local_48) == 0;

In plain terms, the key is NAME-XXXXXXXX. The program hashes the name and compares the result, printed as eight uppercase hex digits, with the text after the dash. The length test allows 3 to 16 characters before the dash.

How did I recover the hash? #

0x811c9dc5 is the FNV-1 32-bit offset basis, and 0x1000193 is the FNV prime, so my first thought was FNV. But the line has two different multipliers joined by |, which looked wrong. I checked the arithmetic:

(0x1000193 << 5) & 0xffffffff  = 0x20003260
0x811c9dc5 ^ 0xa5a5a5a5        = 0x24b93860

The first value is the second multiplier shifted left by 5, and >> 0x1b is a shift right by 27. Together they are a 32-bit rotate left by 5 of x * 0x1000193. The decompiler had distributed the rotate across the multiplication. The second value is the empty-name constant 0x24b93860 that the decompiler printed in an if branch. That confirms the final XOR with 0xa5a5a5a5.

So the hash is: start at the FNV offset basis, then for each byte XOR it in, multiply by the FNV prime and rotate left 5, and finish with an XOR against 0xa5a5a5a5. I wrote that down literally in Python, using the decompiler's expression rather than my own simplification, so a mistake in my reading would show up in the test:

M = 0xFFFFFFFF
def h(name):
    v = 0x811c9dc5
    for c in name.encode():
        x = (c ^ v) & M
        v = ((x * 0x20003260) & M) | (((x * 0x1000193) & M) >> 0x1b)
    return v ^ 0xa5a5a5a5

How did I recover the XOR key? #

The function at 0x101490 prints update server: %s. Its loop starts with a constant and a XOR:

bVar2 = 0x32;
do {
  *pbVar3 = bVar2 ^ 0x5a;
  bVar2 = (&DAT_001020e1)[lVar4];
  ...
} while (bVar2 != 0);

The key is 0x5a. The blob starts one byte before DAT_001020e1, at 0x1020e0, with the first byte 0x32 held in a register. The strings list had put it at 0x1020e2, which is two bytes late, so I read the bytes myself:

read_bytes  address=0x1020e0  length=36
-> 322e2e2a296075752f2a3e3b2e3f29743f223b372a363f7433342c3b36333e752c6b00

XOR with 0x5a gives https://updates.example.invalid/v1.

How did I rename things? #

I named what I had proven, in one call, so the next decompile would read better:

set_addresses_names  names={
  "0x1010a0":"main", "0x101300":"check_key",
  "0x101410":"cmd_unlock", "0x101450":"cmd_check",
  "0x101490":"cmd_info", "0x1012e0":"cmd_version",
  "0x103d80":"command_table", "0x1020e0":"enc_url"}
-> all eight: true

REA renames only live in the session. They are discarded on close, so write down anything you want to keep.

Did the recovered key work? #

I generated a key for the name DEMO with the Python above and ran the real binary:

$ python3 solve.py DEMO
https://updates.example.invalid/v1
DEMO-2CC99E78
$ ./target check DEMO-2CC99E78
license: valid
$ ./target unlock DEMO-2CC99E78
unlock: premium features enabled
$ ./target check DEMO-00000000
license: invalid

I also tried more names. ALICE-E9DDA17F was valid. AB-33BBE073 had the correct hash but was rejected, and so was an 18-character name with a correct hash, which fits the 3 to 16 length rule I read in the decompiler. Then I closed the session with close_binary.

Where did the AI go wrong? #

These are the real mistakes and misleading outputs, including some of mine.

  • An empty "success". I calledbatch_decompile without its schema first. It returned{"items":[],"total":0,"succeeded":0,"failed":0} , which looks fine and decompiled nothing. I noticed because I had no code to read. Check counts, not just status.
  • A rejected call. My firstset_addresses_names call omitted thenames field and failed schema validation. The error said what was wrong and I fixed it on the second call.
  • The strings list was misaligned. The encrypted blob was reported at0x1020e2 , not0x1020e0 . The decompiler's0x32 literal andDAT_001020e1 gave it away. Decoding from the listed address would have produced garbage.
  • A missing string. The command name at0x1020a2 was not in the string list. I only saw it as a pointer in the table. Ghidra's string list covers defined strings only, and REA says so in its limitations.
  • Arguments disappeared. The decompiler showedFUN_00101300() with no arguments, andprintf("update server: %s\n") with no buffer. The values were in registers that the compiler passed straight through. The decompiled code alone suggests a check that takes no input.
  • The hash looked like two operations. The| between two multipliers was a rotate. I checked it numerically before using it.
  • The renaming spilled. After I named0x103d80 , the decompiler showed the handler field as&PTR_cmd_check_00103d88 . The namecmd_check appeared on a slot that holds all four handlers. The table has not been retyped, so the label misleads.

What did the decompiler lose compared with the source? #

After the run I read the source. The logic was right in every case. What the decompiler lost:

  • The rotl32 andmix_hash helpers were inlined intocheck_key , so my renames cover fewer functions than the source has.
  • decode_url was inlined intocmd_info , with the first byte peeled out of the loop.
  • The command_t struct was gone. It showed as a pointer array indexed bylVar3 * 3 and an int array indexed bylVar3 * 6 , which are the same 24-byte stride written two ways.
  • XOR_KEY became the literal0x5a , androtl32(..., 5) became shift constants.
  • Return types became undefined8 orbool , and handlers lost theirconst char *arg parameter.
  • The empty-name branch with the constant 0x24b93860 is dead code in the source, because the length check rejects names under 3 characters. The decompiler still printed it.
  • The memcpy was a byte loop with n & 0x3f . The& 0x3f is a compiler artefact and is harmless because the length is already at most 16.

Check it yourself #

  1. Set up REA with a Ghidra backend by following Getting started with REA .
  2. Save the source below as target.c and compile it withgcc -O2 -s -o target target.c . A different compiler version will give different addresses, so substitute your own.
  3. Move target.c out of the folder where you work. Do not give it to the agent.
  4. Ask your agent to open the binary with REA, find main from entry , find the function withstrchr andsnprintf , recover the hash and the XOR key, and produce a valid key. Tell it to show the address and decompiled code for each claim.
  5. Test any key it gives you with ./target check KEY . Do not accept the agent's word that it works.
  6. Compare with the source and list what was lost.
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>

#define XOR_KEY 0x5Au

/* "https://updates.example.invalid/v1" XOR 0x5A */
static const uint8_t enc_url[] = {
    0x32,0x2e,0x2e,0x2a,0x29,0x60,0x75,0x75,0x2f,0x2a,0x3e,0x3b,0x2e,0x3f,0x29,
    0x74,0x3f,0x22,0x3b,0x37,0x2a,0x36,0x3f,0x74,0x33,0x34,0x2c,0x3b,0x36,0x33,
    0x3e,0x75,0x2c,0x6b,0x00
};

typedef struct {
    const char *name;
    int (*handler)(const char *arg);
    int needs_arg;
} command_t;

static uint32_t rotl32(uint32_t v, int n) { return (v << n) | (v >> (32 - n)); }

static uint32_t mix_hash(const char *s) {
    uint32_t h = 0x811C9DC5u;
    for (; *s; s++) {
        h ^= (uint8_t)*s;
        h *= 0x01000193u;
        h = rotl32(h, 5);
    }
    return h ^ 0xA5A5A5A5u;
}

/* key format: NAME-XXXXXXXX where X = hex of mix_hash(NAME) */
static int check_key(const char *key) {
    const char *dash = strchr(key, '-');
    char name[32];
    if (!dash) return 0;
    size_t n = (size_t)(dash - key);
    if (n < 3 || n > 16) return 0;
    memcpy(name, key, n);
    name[n] = 0;
    char expect[16];
    snprintf(expect, sizeof expect, "%08X", mix_hash(name));
    return strcmp(dash + 1, expect) == 0;
}

static void decode_url(char *out) {
    size_t i = 0;
    for (; enc_url[i]; i++) out[i] = (char)(enc_url[i] ^ XOR_KEY);
    out[i] = 0;
}

static int cmd_check(const char *arg) {
    if (check_key(arg)) { puts("license: valid"); return 0; }
    puts("license: invalid");
    return 1;
}

static int cmd_info(const char *arg) {
    (void)arg;
    char url[64];
    decode_url(url);
    printf("update server: %s\n", url);
    return 0;
}

static int cmd_version(const char *arg) {
    (void)arg;
    puts("demo 1.4.2");
    return 0;
}

static int cmd_unlock(const char *arg) {
    if (!check_key(arg)) { puts("unlock: denied"); return 2; }
    puts("unlock: premium features enabled");
    return 0;
}

static const command_t commands[] = {
    { "check",   cmd_check,   1 },
    { "info",    cmd_info,    0 },
    { "version", cmd_version, 0 },
    { "unlock",  cmd_unlock,  1 },
};

int main(int argc, char **argv) {
    if (argc < 2) {
        fprintf(stderr, "usage: %s <command> [arg]\n", argv[0]);
        return 64;
    }
    for (size_t i = 0; i < sizeof commands / sizeof commands[0]; i++) {
        if (strcmp(argv[1], commands[i].name) == 0) {
            if (commands[i].needs_arg && argc < 3) {
                fprintf(stderr, "%s needs an argument\n", commands[i].name);
                return 64;
            }
            return commands[i].handler(argc > 2 ? argv[2] : "");
        }
    }
    fprintf(stderr, "unknown command: %s\n", argv[1]);
    return 64;
}
── more in #ai-tools 4 stories · sorted by recency
── more on @rea 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/reverse-engineer-a-s…] indexed:0 read:11min 2026-11-23 · —