知Yizhi Daily
← Back to this edition

AI

Experiments Show Large Models Can Read and Write Executable Files Byte by Byte

Edition 2026-11-22 · 08:00 Beijing time

A study called Machine Code Programming tested general-purpose large models directly reasoning about executable file bytes without compilers, assemblers, disassemblers, or execution environments. The models identified four binary programs, added features through byte patches, generated ELF64 files according to specifications, and determined in a real malicious sample that it downloaded and executed machine code in memory.

The research background notes that hand-writing machine code is rare. The usual process is to write source code, have a compiler and linker generate bytes, and then use disassemblers and decompilers to work backward. x86-64 instructions have variable lengths, jumps use relative byte distances, and errors in file-header fields can also prevent a program from loading.

The experiments used gpt-6.1-sol with a high-reasoning setting, run through Codex CLI; hex dumps were pasted into prompts at about 2.4 tokens per byte. Researchers asked the model to identify three self-written programs and one real FreeBSD ministat binary solely from bytes. All four programs were correctly identified.

In the hardest ministat case, the program was built with -O3, statically linked with musl, stripped of symbols and its own text, and the final three strings were hidden. The model still found the decoding loop, recovered the options list, described all eight options, and discovered a real defect solely from the bytes: an option labeled with 99.5% confidence used a critical value of about 99.8%. Researchers later confirmed the issue in the original source code using Claude.

The patching experiments required the model to provide an edit list of the same length as the original bytes, with hidden tests checking old functionality, new functionality, and long-input handling; all three patches passed. Without an assembler or compiler, the model could also output complete ELF64 bytes, including file headers, based on written specifications; all three files ran successfully and matched reference results. Extending a program used 1.8 to 3.7 times fewer output tokens than writing one from scratch.

In the real-sample analysis, the model was presented with a 4608-byte PE32+ file whose only visible import was Sleep, while other API calls were hidden behind name hashes and strings were constructed on the stack. In 211 seconds, the model determined that the sample would download machine code and run it in memory, and the report noted hard-coded server information.

Original sources

Hacker News ↗
Back to this editionOpen interactive reader