Log date · Thu
Can LLMs reliably recover source code from binaries?
Recovered code is not automatically equivalent. A Java example shows why debug information and boundary tests matter.
Can LLMs reliably recover source from a binary?
Do not assume recovered code is the original source or behaves identically. In our own Java pricing example, a handwritten candidate matched four of five inputs but returned 1200 instead of 1000 at quantity 10. Removing debug information removed local variable names, while the threshold and arithmetic bytecode remained visible.
At 09:20 UTC on October 8, 2026, arXiv received v1 of “SoK: Are LLMs Reliable at Source Code Recovery?” (2610.11556), by Varun Kohli and five co-authors. Its abstract describes 45,000 samples, seven metrics and six dimensions, covering four standard and five embedded architectures, five optimization levels and symbol stripping. It also studies representation, context, model scale, iteration, review roles and same-language and cross-language recovery across four mature and two legacy languages. [1]
| Question | Result |
|---|---|
| How many inputs matched? | Four of five; 10 is a counterexample. |
| What changed without debug information? | The local-variable table disappeared; instructions remained. |
| Was an LLM tested? | No; this Java illustration is not a replication of the paper. |
Sample, builds and scope
We compiled the same self-written code with javac 17.0.19 using -g and -g:none, then inspected the class files with javap. We wrote the candidate ourselves and deliberately changed >= to >; no model or decompiler was involved. This is a small illustration of available information and validation, not evidence of the paper’s model success rates or recovery difficulty for native machine code or production apps.
public static int quote(int quantity) {
int unitPrice = 120;
int discount = quantity >= 10 ? 20 : 0;
return quantity * (unitPrice - discount);
}
static int candidate(int n) {
return n * (n > 10 ? 100 : 120);
}The two expressions look different while agreeing on most examples. Treat source similarity and behavioral correctness as separate questions: names, comments and original structure may be absent from the artifact, while a different expression may still implement the same rule. The paper likewise discusses code similarity and functional metrics separately. [2]
What debug information changes
The javac documentation says -g generates all debugging information and -g:none generates none; javap -c prints bytecode and -l prints line and local-variable tables. [3][4] Our -g build exposes quantity, unitPrice and discount in the table; the -g:none output has no such tables. Both versions retain the same instructions below.
3: iload_0
4: bipush 10
6: if_icmplt 14
9: bipush 20The comparison, constants and operations still provide clues to the rule. Removing debug information reduces some semantic hints, but this comparison did not rename methods, obfuscate names or measure analyst time. Your artifact may differ with compiler and build options, so inspect the file you actually ship.
Why boundary tests matter
The candidate changes only the comparison at the threshold. Testing 0, 1, 9 and 11 alone would show agreement; adding 10 exposes the defect. The following is captured output, identical for both builds.
quantity=0 original=0 candidate=0 MATCH
quantity=1 original=120 candidate=120 MATCH
quantity=9 original=1080 candidate=1080 MATCH
quantity=10 original=1000 candidate=1200 DIFFER
quantity=11 original=1100 candidate=1100 MATCHEven if every selected test passes, it establishes agreement only on those inputs. Cover boundaries, invalid inputs, exceptions, state transitions and platform differences; for functions with side effects, compare state and calls as well as return values. Record failures and candidates that do not compile instead of counting only successes.
If your team uses a model for an assessment, specify the build, context, prompt and number of attempts first, then check the result against an independent test set. Plausible names or explanations can be guesses. Retain reproducible inputs and outputs, and distinguish human edits from the model’s original result.
Recommendations by risk
These are engineering recommendations, not protection gains measured by our sample. Assess the impact of disclosure first, then decide which capabilities must run offline.
| Case | Recommendation |
|---|---|
| High-value rule can run online | Consider server-side execution, scoped access and monitoring. |
| Rule must run offline | Assume the client can be analyzed; assess cost and protect updates and licensing. |
| Shipping debug information | Inspect the final package; retain only needed diagnostics and store symbols securely. |
| Evaluating a new protection | Hold builds and tests constant; compare compatibility and recovery outcomes. |
Moving logic server-side adds latency, availability, authorization and cost considerations; an API can still reveal observable behavior. For offline designs, treat protection as an increase in analysis effort, not a guarantee of secrecy. After each change, retest the release build, including performance, errors and crash diagnosis.
Check your own build
Inspect a Java release artifact you own or are authorized to examine. Replace the path and class name below. Use javap’s classpath for a jar; for another platform, use its documented inspection tools. Save the build identifier and configuration so the next comparison is meaningful.
javap -c -l -private -classpath path/to/your-release.jar com.example.YourClassSelect functions representing core value and ask an independent team to assess comprehension or a reimplementation under recorded conditions. Compare behavior using isolated data and boundary cases withheld from the assessors. Do not casually send private source, credentials or customer data to an external model. Once the risk is understood, choose migration, reduced privileges or added protection, then repeat the assessment on the new release.
Your checklist
- Record the release build and its debug information settings.
- Select valuable functions and an independent test set.
- Cover thresholds, exceptions and state transitions.
- Record model inputs, attempt counts and original outputs.
- Choose server migration or offline protection by risk and retest.
Primary sources
- arXiv: SoK: Are LLMs Reliable at Source Code Recovery? A Taxonomy and Empirical Evaluation (2610.11556) · Source date 2026-10-08 · Checked 2026-10-12
- SoK paper v1: full text · Checked 2026-11-11
- Oracle: javac command · Checked 2026-11-11
- Oracle: javap command · Checked 2026-11-11