Log date · Thu
Can AI understand obfuscated code? CodeSteer and limits
Obfuscation changes code clues but cannot guarantee AI cannot understand it. We compare names, strings and behavior in a small sample.
Can AI understand obfuscated code?
Obfuscation changes surface clues, but cannot guarantee that AI cannot understand a program. In our JavaScript comparison, two variable names disappeared from the transformed file while the DEMO-PLAN string remained. Outputs matched for three inputs, and the file grew from 240 to 1,342 bytes. Inspect the actual artifact instead of inferring the result from an option name.
The CodeSteer paper studies model understanding of obfuscated code and proposes attention steering at inference. [1] Our small example uses another tool to illustrate the issue; it is neither a replication of the paper nor a run or evaluation of an LLM.
| Question | Finding |
|---|---|
| Names retained? | basePrice and itemPrice did not match in the transformed file. |
| String retained? | DEMO-PLAN still matched exactly. |
| Runtime behavior? | Outputs matched for three inputs. |
| File size? | 240 bytes became 1,342 bytes. |
What the paper proposes
At 05:16 UTC on August 20, 2026, Xiaokai Rong, Aashish Yadavally and Tien N. Nguyen submitted v1 of “Post-Hoc Attention Steering of Large Language Models for Robust Code Understanding under Obfuscation” to arXiv. [1] Its abstract reports a substantial drop in model performance on obfuscated code, suggesting reliance on superficial lexical clues.
The authors propose directing attention toward backward slices for output prediction and control-flow paths for execution reasoning. The abstract reports improvements across models and datasets, often approaching accuracy on unobfuscated programs, and describes a buffer overflow detection case study; it gives no numerical results. A backward slice follows statements and data that may influence a result, while a control-flow path describes branches execution can take. Both direct attention toward program relationships rather than relying on names alone.
Those are results for the tasks studied, not a guarantee about every transformation or model. Base a protection decision on a specific build, analysis goal and repeatable checks; avoid claiming that AI cannot understand the code.
Our sample and results
We wrote a quote function: negative quantities return invalid; otherwise it adds 120 to quantity times 17 and attaches a marker. We ran the original with Node.js 20.19.5, then generated and ran a second file with javascript-obfuscator 5.8.1. We fixed the seed at 42; the tool documents a nonzero seed for repeatable random results. [2]
function quote(quantity) {
const basePrice = 120;
const itemPrice = 17;
if (quantity < 0) return 'invalid';
return 'DEMO-PLAN:' + (basePrice + quantity * itemPrice);
}Each run produced the following results for -1, 0 and 3. The name check is only an exact text match: absence of a match does not mean the computation or its dependencies have disappeared. Matching three outputs covers only those inputs and does not replace a full test suite.
-1 => invalid
0 => DEMO-PLAN:120
3 => DEMO-PLAN:171sample.js | basePrice | present
sample.js | itemPrice | present
sample.js | DEMO-PLAN | present
obfuscated.js | basePrice | absent
obfuscated.js | itemPrice | absent
obfuscated.js | DEMO-PLAN | presentThe marker still matched directly even with the string array enabled and its threshold set to 1. A string-array option is not a promise of secrecy. We did not measure reading time, analysis effort or model accuracy. The size increase belongs to this small file and configuration and should not be extrapolated to an entire app.
Recommendations by case
These are engineering recommendations, not measured protection gains. First decide which outcomes must be trusted, then distinguish what a client can decide from what a service can verify.
| Question | Finding |
|---|---|
| Public interface logic | Obfuscation can reduce obvious clues; test compatibility and size. |
| Sensitive decisions such as price or entitlement | Where online access is possible, verify on the server and present the result in the client. |
| Logic that must work offline | Define the local trust boundary and assess tampering and expiry risks. |
| Describing results publicly | State test conditions; avoid claims that AI cannot understand the code. |
Online and offline designs have tradeoffs. Server verification requires connectivity, availability and access control; offline licensing needs expiry and revocation-delay policies. Even when using obfuscation, protect release credentials, limit server privileges and retain diagnostic information for the corresponding build.
Check your own build
We built a small sample and ran the original and obfuscated files. For your project, substitute your own paths and build commands and keep a backup of the artifact first. The Node command line can run a program entry point. [3] Fix dependencies, inputs, tool version and settings when comparing builds, or changes in the environment can confound the result.
javascript-obfuscator path/to/your-app/sample.js --output path/to/your-app/obfuscated.js --seed 42 --compact true --string-array true --string-array-threshold 1
node path/to/your-app/sample.js
node path/to/your-app/obfuscated.js
grep -F "DEMO-PLAN" path/to/your-app/obfuscated.jsPrepare normal, boundary and error inputs for critical paths and compare outputs and side effects in the original and release builds. Inspect the shipped files for names, strings, resources and mapping files; a search with no match does not prove other analysis cannot find the information. Record package size, startup time and functional test results instead of looking only at protection settings.
To evaluate a model, use samples you are authorized to share and ask verifiable questions under the same model version, prompt and input conditions. Save expected answers, outputs and error categories. Restrict disclosure of sensitive code and repeat the test periodically; one answer cannot represent future models or every analyst.
Your checklist
- Inventory critical logic and its trust boundaries.
- Build repeatable comparisons with fixed versions and settings.
- Test release artifacts with normal, boundary and error inputs.
- Inspect shipped names, strings and resources.
- Assess server verification and offline tradeoffs for sensitive decisions.
- Record model evaluation conditions and avoid absolute claims.
Primary sources
- arXiv: Post-Hoc Attention Steering of Large Language Models for Robust Code Understanding under Obfuscation · Source date 2026-08-20 · Checked 2026-10-12
- javascript-obfuscator documentation · Checked 2026-11-11
- Node.js command-line API · Checked 2026-11-11