LLMs can read and write executables byte by byte from a hex dump
TL;DR Highlight
Given only a hex dump and no tools, an LLM analyzed, patched and wrote working executables.
Who Should Read
A security or systems developer wondering whether to use an LLM for binary and malware analysis.
Core Mechanics
- Hex alone was enough to explain 5 binaries
- GPT-6.1 Sol (effort high) read only an xxd hex dump, with no disassembler, compiler or tools.
- On the stripped 67,392 B ministat it also found a real upstream bug.
- The option labeled 99.5% confidence uses critical values for about 99.8%, which was confirmed against the source using Claude.
- It added features by editing bytes
- Three programs each got one requested feature, and all passed the hidden tests.
- Bytes changed were 74 (1.4%) for wordcount, 544 (5.9%) for the AES tool and 379 (4.3%) for the bank ledger.
- It patched like a human, using padding made executable via header edits, with new code reached by calls.
- It wrote executables from a spec alone
- It replied with every byte of an ELF64 file in a single answer.
- All three matched the GCC build on stdout and exit code.
- Extending a program took 1.8 to 3.7 times fewer output tokens than writing it.
- It got an unknown malware sample right
- The 4,608 B PE32+ sample was analyzed with no hint that it was malicious.
- In 211 s it concluded the sample downloads code and runs it in memory, naming 165.154.205.34:443.
- The VMRay sandbox matched the address and request URL, but not the 10 s retry or the XOR key.
- An open-weight model reached the same conclusion
- DeepSeek V4.1 Flash (MIT license) also called the sample a stager.
- It used 89,902 reasoning tokens versus 5,178 for Sol 6.1, about 17 times more, and took 859 s versus 211 s.
- It got 9 of 13 hidden function names right and misnamed one URL parameter.
- Context size is the hard limit
- A hex dump costs about 2.4 tokens per byte, so the 67 KB binary took about 163,000 tokens.
- A 10 MB program would need about 24 million tokens.
- The authors suggest a Recursive Language Models harness as one way forward.
Community Reactions
- Objection: just use a disassembler
- One view was that disassembly is deterministic and cheap, so objdump output should go to the LLM for decompilation only.
- Another pointed out that the DeepSeek trace is hand disassembly, so there is no evidence the LLM beats objdump.
- Opinion: writing machine code directly is inefficient
- Some argued LLM output is non-deterministic, so generate source once and compile it deterministically per target.
- Others said optimizing compilers already exist, so there is no reason to write binaries directly.
- Experience: people already do this
- One user pasted the HEX of an AVR bootloader without source into Claude and got answers to a boot issue.
- Another hands binaries to ChatGPT to find segfault causes and to check object files for validity.
- Another had an LLM disassemble 6502 hex dumps, then reassembled them to match the original hex.
- Not new, and a prompt injection worry
- One user said Opus took apart C64 .prg files and wrote a simple sprite demo without going through assembly.
- Another said they are using LLMs to modify Amiga game binaries and added networking.
- One commenter wondered whether prompt injection via an executable is possible during malware analysis.
How to Apply
- Have an LLM explain a small binary from hex
- Dump a small source-less ELF or PE file with `xxd` and paste it into an LLM with the prompt below.
- Compare the result against `objdump` or Ghidra output to check it.
- Add an LLM report as a first malware triage step
- Verify every result independently
- Recompute any hashes, IOCs or addresses the model reports, or compare them against sandbox reports.
- The authors recomputed all 13 hashes and compared against VMRay.
- Size inputs to the context limit
- Budget about 2.4 tokens per byte to decide how much to dump.
- Split large files by function or section across several calls.
Try It
# Paste into Claude or ChatGPT (the Experiment 1 prompt from the article, run with no tools)
What does this binary program do? Write a detailed report of what it does. No tools are allowed.
{{full xxd output}}
# Create the hex dump in a terminal: xxd {{file path}} > dump.txt
# Next: compare the report's addresses, strings and APIs against objdump -d output and look for mistakesTerminology
Related Papers
Gemini 4 Neon is the new #1 on the Models Engineering Index
Gemini 4 Neon ranks first on the Models Engineering Index with 68.0, combining multiple benchmarks.
Claude was trained on protein sequences at scale
Next-amino-acid tests on obscure proteins show only the latest Claude models predict them
Remembered as Brief: Stored Preferences SilentlyRemove Decision-Critical Information
A stored 'keep it short' preference silently drops warnings; listing must-know points first restores content.
All AI-generated code should be Open Source
A blog argues AI-generated code should be open source; most HN commenters disagreed.
What thousands of conversations look like inside a language model
Mapping Qwen3-1.7B states showed Chinese sitting apart from English, while German and Croatian overlapped it.
AI, activity, and outcomes in software engineering
AI sped up writing code, but shipping speed did not rise as much, says a talk
LLMs Play Zachtronics' TIS-100
16 LLMs played TIS-100 and set 133 new Pareto frontier points across 18 puzzles
AI usage generates a fragile codebase
Generating all code with AI left shallow tests, complex code, and less human understanding, says one dev.