Kuna: Decompiler Development in the Age of Coding Agents
Posted by matt_d 4 days ago
Comments
Comment by mahaloz 4 days ago
Kuna is originally Ghidra ported to Rust, but it has changed quite a bit since. The results shown in the screenshot on the site are not a feature in Ghidra, which includes the Switch layout and some of the variable simplification. It's from Ghidra, previously talked about here [1].
> It would be cool to see agentic interpretation of function and variable names.
On DecBench, which I also created last week, you can see just that for Codex and Claude when given only assembly [2]. They dominate, but also have some significant recall problems.
> Why not train an LLM to be a decompiler instead of make one
Over the last two decades, this has been attempted _many_ times [3]. To date, there has been no successful project/paper that can compete with traditional decompilers on fundamental metrics. I speculate this is due to their inability to abstract the many-to-one mapping of optimization to code. This can change, but I desired to take a different approach.
If frontier labs continue to get better, they will become the de facto decompilation users. Why not get LLMs to help LLMs? Design a core decompiler that helps them more than others :).
[1]: https://www.youtube.com/watch?v=VP29biKLoSw
[2]: https://decbench.com/leaderboard/?dataset=sample-set
[3]: https://decompilation.wiki/fundamentals/neural-decompilation...
Comment by comandillos 4 days ago
Comment by mahaloz 3 days ago
Based on today's results, IDA Pro is ahead by 15 percentage points, which would mean, statistically, IDA Pro will recover perfect source code for 15% more functions than Ghidra on average.
Comment by Orphis 4 days ago
Comment by fishfasell 4 days ago
Comment by snoopen 4 days ago
Comment by ChickeNES 4 days ago
Comment by hackcasual 4 days ago
Comment by nneonneo 4 days ago
I also think that, for larger projects, it's still useful to have real decompilation support; for example, Il2CppDumper works in tandem with ghidra-wasm-plugin to enable decompilation of Unity Il2Cpp projects, which are often enormous (100MB wasm files are not uncommon) and for which the symbols + types are invaluable.
Comment by bpavuk 4 days ago
Comment by billypilgrim 4 days ago
Comment by saidnooneever 4 days ago
Comment by ur-whale 4 days ago
Especially given the fact that you have an infinite training set to train that LLM from (compilers can generate as much training data as you could possibly want).
Comment by Tepix 4 days ago
Comment by ur-whale 3 days ago
Maybe, but here I am suggesting an LLM specifically trained to do only machine code to high-level code reverse engineering.
I suspect this can be made both efficient and very reliable.
Especially given the fact that there is very often a path the verify if what the LLM produces is a valid answer (by testing if the high level code produced by the LLM, when compiled, behaves like the original machine code).
Comment by mahaloz 3 days ago
Comment by gopalraja 4 days ago
I read this less as “build a decompiler with an LLM instead of training one to decompile,” and more as a different loop: you still get an artifact you can measure and improve against IDA / Ghidra / angr. Training on infinite compiler data is powerful for the first path; this post is mostly about the second one (i think, but i could wrong).
Comment by Rexxar 4 days ago
Comment by ur-whale 3 days ago
I think using the word "deterministically" in the context of decompilation is not a particularly good idea.
The code generated by a compiler can be arbitrarily complex and arbitrarily varied even before you take into account willful attempts at obfuscation to protect against reverse-engineering (for example, try futzing with compiler optimization flags to see how much the ASM changes).
The "high-level code to assembly" operator is thus not even really a function (same high level code can generate infinite variation of functionally equivalent assembly code) and any attempt at producing an inverse of this operator ... this really does not strike me as an environment where the word "deterministic" seems appropriate.
Comment by mahaloz 3 days ago
A talk I did on this at Reverse Con (clipped to the important part): https://youtu.be/VP29biKLoSw?t=891
Many of these decompilers can infer what optimizations occurred by hints/patterns that are left behind.
This can be fundamentally different at times from LLMs, which have shown a degradation on unique architectures. I still believe the best approach will be a mixed method. Get 80% of the way there with traditional methods, and take the last 20% (which is the hardest) home with LLMs.
Comment by DobarDabar 4 days ago
Comment by gopalraja 4 days ago