Anti-AIClone

Log date · Fri

Can BinMirror infer behavior from obfuscated code?

Observable behavior can guide a copy, but finite tests cannot prove equivalence. We compare two candidates at a boundary.

Can local logic be copied from behavior?

Yes. Observable inputs and outputs can guide another implementation even when the original code is difficult to read. But a finite set of observations cannot establish equivalence everywhere. In our small experiment, two candidates matched all five observed inputs; on three held-out inputs one matched zero and the other matched all three.

Results at a glance
QuestionFinding
Did observations distinguish the candidates?Both scored 5/5 on inputs 0–4.
What happened beyond that range?On 5–7, A scored 0/3 and B 3/3.
What does that show?Coverage determines which mistakes the observations can exclude.

This question motivated BinMirror. At 00:02 UTC on 2026-08-21, Kangchen Zhu, Shangwen Wang and co-authors submitted v1 of their paper. It uses execution traces and interaction snapshots to guide program synthesis and validates candidates against runtime observations. The abstract reports evaluation on 1.5 million synthetically obfuscated binaries and a 74.5% unit-test Pass@1 under extreme obfuscation. [1]

What we actually ran

We wrote a C pricing program: add 10 per item, then subtract 20 at five items. We compiled it with Apple clang 21 and used Python 3.9.1 to call the executable and compare two handwritten candidates. Clang’s compilation pipeline includes optimization, machine-code generation and linking. [2] This is an illustration with other tools, not a BinMirror run, a reproduction of the paper, or a measurement of real obfuscation strength.

The calculation in our sample.
printf("%d\n", 100 + 10 * n - (n >= 5 ? 20 : 0));

Candidate A assumes a constant per-item increment; B includes the five-item threshold. We wrote both for the comparison; neither was synthesized automatically. We observed only inputs zero through four first, then reserved five through seven for a separate check. This makes the divergence at the boundary visible after an apparently perfect match.

Verbatim experiment output.
observed
0: binary=100 A=100 B=100
1: binary=110 A=110 B=110
2: binary=120 A=120 B=120
3: binary=130 A=130 B=130
4: binary=140 A=140 B=140
matches: A=5/5 B=5/5
held-out
5: binary=130 A=150 B=130
6: binary=140 A=160 B=140
7: binary=150 A=170 B=150
matches: A=0/3 B=3/3

From observations to a specification

The outputs from zero through four fit two different rules. Those observations alone do not reveal whether a threshold exists. The first held-out input, five, triggers the discount and makes A overstate the result by 20. B matches these eight inputs, but that only establishes agreement on those eight calls, not for every input, error case or state change. A test case checks a particular response for a particular set of inputs. [3]

The paper’s dynamic traces and interaction snapshots contain more information than our input/output table. Its reported number comes from the authors’ synthetic-binary evaluation; it is not a whole-app cloning rate. [1] For defenders, the useful question is whether a local computation can be called and observed repeatedly, not just whether its implementation looks hard to read. Server state, accounts, network errors and time introduce additional dimensions that need their own model.

For your own release build, list input ranges, thresholds, errors and side effects, then prepare checks independent of the examples used during development. Record the environment and starting state: if a price depends on account tier, the same quantity can yield different results for different accounts. Passing a few normal paths does not cover those boundaries.

Recommendations by case

These are engineering recommendations, not benefits measured by our experiment. Start with the value of the exposed behavior and the product constraints, then decide which calculations belong on a trusted server.

Choose by case
CaseRecommendation
High-value online pricing or authorizationCompute or verify on the server and monitor unusual calls.
An algorithm that must work offlineAssume behavior is observable; limit client-held data and privileges and assess exposure.
Public APIRate-limit by account and business context, and monitor anomalies without blocking normal use.
An obfuscated releaseCheck readability, functionality and runtime cost; do not equate obfuscation with clone prevention.

A server also needs authorization and abuse controls: moving a calculation does not mean its interface reveals no behavior. For offline use, plan for revocation, updates and data minimization so that exposure of one client has a bounded impact. Tie the assessment to a specific build so later changes can be compared for both risk and compatibility.

Run a check on your own app

Choose a feature you are authorized to test and fix the account, data and time in a test environment. Record ordinary inputs first, then reserve boundary, error and different-state cases separately. Run both groups with your team’s test command, replacing the paths and names below, and save the output with the build identifier.

Command template; provide these test classes in your own project.
python -m unittest tests.test_pricing.ObservedCases
python -m unittest tests.test_pricing.HeldOutCases

For a quantity discount, cover the value before the threshold, the threshold itself and the next value. Also check missing input, an unauthorized account and state after failure. Record where expected results came from so another engineer can distinguish a product-rule change from a defect. For online interfaces, use approved low-rate checks and test accounts to avoid affecting real users.

Your checklist

  • List inputs, outputs and state for valuable local functions.
  • Reserve independent boundary, error and account-state tests.
  • Compute or verify sensitive online decisions on a server.
  • Set appropriate API rate limits and monitor unusual calls.
  • Record the build and repeat checks after rule or protection changes.

Primary sources

All sources and reproduction status ↗