r/learnprogramming • u/Curious-Tune-7127 • 1d ago
How does reverse engineering actually work, especially with AI?
Lately, I've been seeing a lot of videos about reverse engineering and people basically copying entire applications, recreating their features, or building almost identical alternatives.
It got me wondering, how does reverse engineering actually work?
How do people figure out how an app works internally, reproduce its features, and sometimes get surprisingly close to the original? And how are people using AI to make this process easier or faster?
Are they analysing the source code, inspecting network requests, decompiling applications, or using AI to figure everything out from scratch?
I'd love to understand the actual technical process behind this. If anyone has experience with reverse engineering or AI-assisted app development, I'd really appreciate some explanations and resources to get started!
22
u/desrtfx 1d ago
Honestly, what is called "Reverse Engineering" today is actually more of replicating the functionality and features and less real, actual reverse engineering, as in really disassembling and tracing the programs.
Real reverse engineering happens at Machine Code/Assembly level, by analyzing the binaries of the programs, by tracing network packets, by analyzing save files, data files, etc.
If the source code is available, there is no reverse engineering.
1
1
u/Kefrein-Alen57 20h ago
yeah there's a big difference between "i rebuilt this app from scratch" and actually pulling apart a binary to see how it ticks. real RE is a whole different beast, you're staring at assembly and hex dumps for weeks. most people saying they reverse engineered something just mean they copied the behavior lol
1
u/cascade_sparse 6h ago
Good news friend! The LLMs can stare at the hex dumps for weeks for you now! AND they can do it in a day
4
u/FerociouslyAcademic 1d ago
It’s a mix of stuff depending on what you’re going after. For a mobile app, you’d decompile the APK or IPA to peek at the code structure, then use a proxy tool to watch the network traffic between the app and its servers. That gives you the API endpoints, request formats, authentication flow, all the juicy bits. The UI you can often just rebuild by looking at the app itself.
AI speeds up the boring parts. Feed a decompiled function into a good model and it’ll explain what the obfuscated mess actually does, or generate a clean version of a method you’re trying to understand. You can also paste API response JSON and have it spit out the data models and a rough service layer. It’s not gonna magic the whole thing into existence but it cuts down the tedious reverse-and-rebuild cycle by a lot
2
u/SetAndRepeat 1d ago
A convincing clone can have completely different internals. Reproducing what an app does doesn't necessarily require recovering how its developers implemented it.
The approach depends on what you can access: * Web apps: inspect the page, delivered JavaScript and network requests. DevTools shows what gets sent to an API and what comes back, but that doesn't expose the server's source code. * Compiled native apps: tools like Ghidra disassemble machine code and produce a C-like representation. That helps reconstruct the logic but won't restore the exact original source. * Runtime analysis: use a debugger to inspect memory, follow execution and check what happens with different inputs
You form an explanation, test it against the actual program, and refine it when something doesn't match. AI can help explain unfamiliar code, suggest function names, write analysis scripts or implement replacement features. Its explanations still need checking, a plausible explanation isn't evidence of how the original works. For a practical start, compile a small C program you wrote, open it in Ghidra and compare the decompiled output with your source. Ghidra's official beginner guide and Chrome DevTools "Inspect network activity" tutorial are useful resources.
3
u/Frxdnt 1d ago
what AI does is a simpler version of RE by detecting patterns and since it has a ton of avaliable compute it can do it very easily, it's still very useful but has clear limitations (like the adobe stuff that's being hyped but ultimately it's nowhere near close to be a good product).
as someone said earlier, RE has nothing to do with analyzing the source code but trying to firgure out what the soirce code was based on the outcome.
To put it in simple terms: imagine you buy a cake and you want to figure out what the recipe was to make that cake just by looking at it and tasting it, then from that you determine the ingredients, mixing and cooking time to get the exact same cake. That's what RE is.
1
1
u/Maleficent-Rate-4631 1d ago
Find an open source game / application code- and then run AI through it to get the freatures you want extracted or modified
1
u/Conscious-Ball8373 18h ago
I came across one recently where someone knew which compiler had been used to produce a binary, gave the an LLM the compiler and the binary and said "Generate source code that reproduces this binary."
1
u/Curious_Song_1456 9h ago
A lot of those "I recreated this entire app with AI" videos are closer to rebuilding the user experience than actual reverse engineering, you can reproduce a UI, observe api requests and implement similar features without ever seeing the original backend, AI makes that process faster but figuring out how the original software actually works internally is a completely different challenge
0
u/the_duke_man 1d ago
Most people are using publicly available user documentation and tutorials to have AI distill the inputs, outputs, UI/UX, features and functionality.
No need to look under the hood when all you need to do is replicate the functionality. In some cases people build a better product or one that’s more focused on their needs because reverse engineering in this case focuses on the what, not so much the how.
-1
u/Watsons-Butler 1d ago
They could try decompiling and analyzing an app’s internal code, but it isn’t necessary. Like take photoshop as an example. You know you need functions for resizing, scaling, handling various file formats, etc. you just tell the agent you need those features and let the agent figure it out. As long as the result is good, you don’t need to worry about whether your clone app is wired exactly the same way, as long as it can do all the same things.
0
u/mxldevs 1d ago
Reverse engineering boils down to figuring out how some THING works and then replicating that functionality. But it doesn't end there: because you figured out how to replicate it, you can also figure out how to customize it to behave differently.
For software, it's literally just like reading a book and solving a puzzle: you get some executable that contains machine instructions. The computer knows how to read it, so you just need to figure out how the computer is reading it.
There are tools that will show you exactly all the instructions in some human readable form, and the instructions are also publicly documented so you just need to translate it in reverse into a higher level language that's easier to work with.
Some of these tools can even try to do that for you, and you just need to clean it up like renaming variables to make it easier to understand.
AI speeds up the process for you. Instead of going through the instructions yourself and figuring out how to write it, simply have the AI figure it out and write it.
0
u/HeavyDT 1d ago
The big thing A.I has changed in terms of reverse engineering in the coding world is the decompilation and recompilations processes. Which used to take a lot of "manpower" to do properly. Source code gets compiled to binary aka machine code. That process drastically alters the underlying code too due to optimizations and what not. So getting out exactly what was put in was a difficult problem for humans to figure out. There were automated tools before now that could do decompilation but what you would get out was no where close to the original and hard for people to understand.
Figuring out that original source code in a 1 to 1 fashion could be done but was a slog for humans to do. Like finding a needle in a haystack over and over. A.I can step in and figure out 1 to 1 (aka byte matching) source code in a fraction of the time it would take humans. No byte matching too if that's what you want. Either way we are talking weeks and months for A.I versus months and years for humans. It's a big time difference in how fast software can be reversed engineered now.
Once you have that source code the sky is the limit. It's like having the exact recipe for making grandma's apple pie or something similar. You can make as many as you want now or make alterations ect. The popular thing right now is using A.I not just to decompile but also to recompile games. So you decompile first and then use that source code to make alteration and recompile said game for more modern / different platforms than the original target.
0
u/hellosverre 1d ago
the AI part in practice is mostly speeding up the reading, not the finding. the loop is still: load the binary in ghidra or IDA, find the interesting spots (strings, imports, network calls), then run it under a debugger to confirm what it actually does at runtime.
a model is good at "here is a decompiled function, what does it do, give me better names". its bad at anything that depends on data it cant see: struct layouts, what a pointer really points to, whatever is encrypted until runtime.
so the thing worth learning is dynamic analysis. x64dbg or frida, set a breakpoint, look at real values. decompiler output looks very sure of itself and is subtly wrong all the time, and an LLM will explain the wrong version with a straight face.
also those "recreated the whole app" videos are almost always the apps network API and UI being rebuilt from captured traffic and screenshots, not the binary being decompiled and ported.
37
u/Digital-Chupacabra 1d ago
First off I would highly recommend watching some of Nathan Baggs's videos. He does reverse engineering and patching of video games and gets into a lot of technical detail without bogging it down.
If you have the source code you don't need to reverse engineer it.
Yes, and more. You can use a decompiler or a tool like ghidra to turn an application into readable code, it's not going to be what was originally written and it might not even be in the same language but it should be functionally close.
From there, you can do network and stack inspection, basically see how the application works, run the compiled code with a debugger so you can see what functions call what.
Using AI is largely having an AI do that for you, it can generally do it quicker. But if you look at the recently released Reverse engineered adobe products you can quickly see the limits of this.