Voided.to voided.to

[Tutorials] AI in reverse engineering: 7 habits that actually save hours

Thread
#1
Most "AI for reversing" advice falls into two camps: paste a whole binary into a chatbot and hope, or dismiss it because it hallucinates. Both miss the useful middle. An LLM is a fast junior analyst who never gets tired — and never touches a debugger. Treat it like that and it earns its keep.
Quote:Scope: your own binaries, CTF tasks, and code you have source for. This is not a guide to cracking software you don't own. If a task starts with "bypass the license check on someone else's app", the model should not be your tool and this post is not your guide.

1. Give it a contract, not a vibe
"Explain this function" produces a paragraph of plausible nothing. Ask for a contract instead: inputs, outputs, types, side effects, calling convention. The model can't cheat its way through a specific question as easily as through a vague one.
 
Code:
Function: sub_1400012A0
Arch: x86-64, MSVC, PE, no symbols
Return:
1) one-sentence purpose
2) parameter types
3) return type
4) side effects (files, network, registry)
5) confidence + why

2. Pin the architecture and the compiler
The same instruction sequence means different things under SysV and Win64. Register usage, stack alignment, varargs, exception frames — all of it changes. Tell the model the target up front: x86-64, Windows, MSVC, release build. If you don't know, say so; it will hedge instead of inventing.

3. Feed decompiler output, keep raw asm for stubs
Decompiled C is the right input for logic: fewer tokens, fewer distractions. Raw assembly is better for tiny stubs — thunks, syscall wrappers, crypto primitives — where the decompiler lies. Do not mix both in one message; the model will average them into noise.

4. Ask for hypotheses with a test for each
Never ask "what's the bug" or "how do I fix it". Ask for three hypotheses and how to confirm each one in a debugger. You get a plan you can execute, not a confident guess.
 
Code:
Give 3 hypotheses for why the check at 0x401500 always fails.
For each: what to inspect (register/memory), expected value, and the fastest way to confirm.
Do not suggest a patch until a hypothesis is confirmed.

5. Use it as a naming engine
sub_401000, sub_401050, sub_4010A0 tell you nothing. Paste a batch of small functions and ask for descriptive names with a one-line reason. Then rename them in the database and keep the map in the chat. After 20-30 renames, the decompiler output starts reading like code.

6. Make it write the report
At the end of a session, ask for a Markdown table: function, purpose, inputs/outputs, suspicious behavior, confidence. Next time you open the project, you skip the "where was I" phase. This is the highest-ROI habit in the list.

7. Cross-check with a second model
Hallucinated API names and invented calling conventions are the main failure mode. A second model with a different training mix catches a surprising amount of it. Paste the same 20 lines and the first model's conclusions; ask the second one to disagree explicitly.

A prompt template that works
 
Code:
Role: reverse engineering assistant.
Binary: x86-64, Windows, MSVC, release, no symbols.
Task: analyze the function below.
Return:
1) one-sentence purpose
2) inputs/outputs and types
3) side effects
4) suspicious operations (crypto, anti-debug, network)
5) confidence: high/medium/low, with reasons
Rules: do not invent library names. Mark unknowns as UNKNOWN.
Ask for more context if the snippet is insufficient.

Where this fits in MadGPT
I build MadGPT, so weigh that when you read this part. It is a single workspace with 7 models and an Auto router: you can keep one thread and switch models for the cross-check step instead of copying context between tabs. The VS Code agent handles the source-level half — reading a repo, proposing a diff — and screenshots of disassembly can be dropped into the chat as image input. There is a free trial through the Telegram bot if you want to test the workflow on your own CTF task.

Links
If you test any of this on a CTF task, reply with the prompt that worked. I read the thread.
Quote:Reminder: own code, CTF, or a sandbox. An LLM will happily help you do something stupid faster; the scope is your responsibility.
Reply