EVOPEDIA

← all systems · see it in The System

Weird machine

The unintended computer inside a target: a computational artifact where additional code execution can happen outside the program's original specification (src:wp:weird-machine), programmable by the attacker through crafted inputs (src:bratus-2011-weird-machines); formally, the device that arises when the intended machine's emulated transitions operate on weird states (src:dullien-2017-weird-machines). Walked as the phenomenon (the machines shown in memory corruption, metadata, page faults, microarchitecture and protocols) and as the theory behind language-theoretic security that names it, with the defences it led to.

Properties published scienceour proposal

Sourced fields, and our own readings.

aliasesWeird machine (exploitation as programming the target's unintended computation)
born atkind: 1996-2000 (Aleph One's stack smash, Solar Designer's return-into-libc 1997, Newsham's chaining May 2000); term 2009
born precisiona few years
boundaryInside: the weird states of a target (states with no meaning in the intended machine), the transitions that carry them (borrowed code, allocator and format-string automata, loader and unwinder automata, fault handling, microarchitectural side effects), the primitives distilled from them (weird instructions, gadgets, weird registers and gates), and the exploit as a program for them; and the theory that describes all this (the intended machine and its emulator, weird states, the language-theoretic reading of inputs). Outside: the intended machine and the program that emulates it (sys:software, sys:finite-state-machine), the parser that should recognise input (sys:parser), the person who programs the machine (sys:threat-actor) or studies it (sys:human), the CPU and OS it runs on, and the defences (mitigations, verified parsers).
nested levelA computational model inside computer systems (rung 12), found at every layer of the computing stack from the processor's microarchitecture to protocols and browsers (src:bangert-2013-page-fault); its theory is part of computer security (sys:computer-security) and of language-theoretic security.
scaletechnological

Measures (15) published science

characteristic clock: weird gate execution rate (TSX gates, 1M iterations)about 1.69-2.38 million executions a second (TSX_AND 1,692,047; TSX_ASSIGN 2,380,952); TSX_XOR 60,020 executions per second
weird gate accuracy (TSX gates, 1M iterations)97.9% (TSX_OR) to 99.2% (TSX_XOR); 98.5% (TSX_AND, TSX_ASSIGN) percent correct
SHA-1 on microarchitectural weird circuits: time per runabout 26; 10 of 10 runs correct minutes
pings needed to decrypt and run the hidden payload6 on average (100 experiments; each trigger evaluated 10 times) pings
readout threshold for a weird registerabout 100 (shorter = logic 1, in cache) CPU cycles
page-fault weird machine: instructions per Game of Life cell31 movdbz instructions
page-fault weird machine: TSS slots usable (graph colouring)16 task-register values
relocation types: defined by the ABI, used by gcc, used by Cobbler37 / 13 / 3 relocation types
Dullien's emulation bound: extra interactions for a non-bit-flipping attacker to match a one-bit-flip attacker10,000 (the toy server holds at most 5,000 password-secret pairs) interactions
CFI bypass: binaries with powerful attacks under fully-precise static CFI5 of 6 binaries
CVEs related to XML against JSON850 (216 XXE) against 96, at the time of writing (2017) CVE entries
Daedalus PDF red team: defects found0 in the generated parser, 5 in its hand-written wrapper (4 stack exhaustion on deeply nested input, 1 unchecked offset); competing tools 'tens of defects'; over 70 billion documents parsed in 7 days
static-analysis weaknesses in generated parsers1 (Daedalus) against 42 (Apache Daffodil and Kaitai Struct together) warnings or weaknesses
EverParse: TLS message datatypes implemented293 (TLS 1.0-1.3 and extensions) datatypes
PDF parsers compared for differentials31 (with configurations and utilities); ontology over 15 parsers

Open contentions (5) open contention

Where sources or readings disagree. Both stay on the map.

Cross-scale patterns seen here (18) our proposal

Shapes that recur when the same kind of problem is solved at different scales, and how each shows in Weird machine. Each links to every other system that shows it.

Valence: what it trades, and with whom (12) published science

Each exchange with a neighbour, read from both sides: who gains, who pays, and what carries it.

Partners and parts published science

Built from / builds (5)

Sits inside / holds (3)

expressed by (19)

floor filled by (18)

represents (2)

Kinds (10)

Notes published science

Layers

The ways it takes in its world, where they meet, and how it acts back, each from L1 (where it meets the world) up.

a weird machine as language-theoretic security describes it: crafted input and the target's own states, through the input-handling code and the weird states it reaches, up to the exploit as a program and the security property it breaks (reader's view)

  1. L1: The target and what reaches it: crafted input and the target's memory, code and hardware state, the whole composed environment
  2. L2: The intended machine and its emulator: the program specialises the CPU to an (implicit) finite-state machine; its input handling is meant to recognise valid input
  3. L3: Weird states: states with no meaning in the intended machine, entered by a bug, a fault or a feature
  4. L4: Weird instructions: primitives distilled from the target's own code and automata, driven by input as opcodes
  5. L5: The weird machine: emulated transitions acting on weird states; state space and power unknown in advance
  6. L6: The exploit: a program for the weird machine, and a constructive proof that it exists
  7. L7: The security property broken and the trust assumption shown false

the boardroom (shared floors)

  1. L5: The weird machine itself: the emulated transitions acting on weird states, with an unknown state space, unknown computational power and an emergent instruction set
  2. L6: The exploit as a program for the weird machine: setup, instantiation and programming; a constructive proof that the machine exists
  3. L7: What the computation does to the target: the security property of the intended machine violated (a secret out, a shell, a trust decision subverted); the aim is the programmer's

way in: Borrowed code: the target's own transitions and code snippets

  1. L1: The target's code in memory: the program's own routines and its libraries
  2. L2: Short instruction sequences found by static analysis, including sequences the assembler never placed
  3. L3: Gadgets: sequences chained into blocks that do one job each
  4. L4: Weird instructions: distilled, isolatable primitives (weird MOV, aa4bmo, 4-bytes-write-anything-anywhere)

way in: Crafted input: the attacker's bytes, the weird machine's instruction stream

  1. L1: Crafted input delivered to the target: the exploit expressed as input
  2. L2: The target's input-handling routines, meant to act together as a recognizer for valid input
  3. L3: Past the recognizer: a bug or feature that lets crafted clauses reach the artifacts inside (memory corruption, %n)
  4. L4: Input as opcodes: every further input executes an emulated transition on the weird state

way in: Faults: corrupted bits that move the machine into a weird state

  1. L1: Memory cells and their bits; registers the attacker may not reach
  2. L2: Sources of corruption: human error in the program, hardware faults (Rowhammer), transcription errors
  3. L3: The attacker model: a chosen bit flipped at an arbitrary or fixed program point
  4. L4: The first weird state, q_init: a state with no meaning in the intended machine

way in: Metadata: ELF relocations and DWARF unwinding data read as instructions

  1. L1: ABI metadata in the executable: relocation entries, symbol tables, DWARF exception data
  2. L2: Read by the runtime loader (RTLD) and the exception unwinder, each an automaton interpreting its section
  3. L3: Entries as operations: three relocation types (COPY, SYM, RELATIVE); DWARF bytecode
  4. L4: Well-formed metadata compiled from a Turing-complete language (Brainfuck, via Cobbler)

way in: Microarchitectural state: caches, branch predictors, transactional memory, read as time

  1. L1: Timing variations in executing instructions that meet side effects
  2. L2: Microarchitectural components: caches, prefetchers, branch predictors, buffers; not directly accessible to programs
  3. L3: Weird registers: one bit held in a component's state (a cached or flushed line; a trained branch)
  4. L4: Weird gates and circuits: AND, OR, XOR built from mistrained speculation and transaction races

way in: The analysts' channel: exploits and attack papers read as evidence about the target

  1. L1: Attack papers and exploits from the practitioner community
  2. L2: Read by peers and checked like proofs, studied for their tricks
  3. L3: The mechanism described: the target's artifacts that make it programmable, as elementary instructions
  4. L4: Formal accounts: the intended machine, weird states, the weird machine defined; weird machines as insecure compilation

way in: Traps: page tables, descriptor tables and the fault-handling logic

  1. L1: Cross-referencing, cross-mapped memory tables, all entries well-formed
  2. L2: The MMU and interrupt handling: hard-wired fault logic that reads and writes memory
  3. L3: Page faults and double faults as steps; the stack-pointer decrement as arithmetic
  4. L4: One instruction: move, branch if zero or decrement (movdbz), which can build subtract-and-branch-if-negative

way out: Back to sane: re-entering a sane or transitory state ends the weird machine

  1. L1: The program emulates the intended machine again
  2. L5: Sane and transitory states are the weird machine's terminating states

way out: Concealed payload: a hidden computation releases its payload on a trigger

  1. L1: The host acted on: the reverse shell runs
  2. L4: The payload decrypted and executed (a reverse shell)
  3. L7: Malware passive and invisible until it receives a trigger

way out: Hand-off to the CPU: the instruction pointer taken, leaving the weird machine for native code

  1. L1: Control transferred to code of the attacker's choosing
  2. L6: The attacker chooses to leave weird-machine programming

way out: Published: the exploit or construction written up as a constructive proof for others

  1. L1: Released code and papers (the movdbz compiler on GitHub)
  2. L6: The attack as a constructive proof that the execution model exists

way out: Security property violated: output the intended machine would never give

  1. L1: The secret (or a shell, or a write) delivered to the attacker's side
  2. L5: The weird machine's output alphabet, which may differ from the intended machine's
  3. L7: A security property of the intended machine violated

where weird machines have been shown, from the processor's hidden state up the software stack (placement reading)

  1. L1: Microarchitecture: caches and branch predictors computing in timing (microarchitectural weird machines)
  2. L2: Memory management and trap handling: the page-fault weird machine
  3. L3: Instruction-level code reuse: return-oriented programming from libc's sequences
  4. L4: The loader and the unwinder: ELF relocation metadata and DWARF bytecode
  5. L5: Library automata: the allocator's free lists, printf's format-string automaton
  6. L6: Protocol state: TLS session cache, renegotiation and certificate steps (preprint)
  7. L7: Applications: browser rendering engines (DOM, CSS) as weird machines

Sources (31) published science

Weird machine (Wikipedia, via Wikimedia Enterprise snapshot 2026-11-01)
Dullien, T. (2017) Weird machines, exploitability, and provable unexploitability. IEEE Transactions on Emerging Topics in Computing. doi:10.1109/tetc.2017.2785299 (behind its links)
Bratus, S., Hermerschmidt, L., Hallberg, S. M., Locasto, M. E., Momot, F. D., Patterson, M. L. and Shubina, A. (2017) Curing the vulnerable parser: design patterns for secure input handling. ;login: 42(1) (behind its links)
Benjamin, T. S., Eitel, J. A., Elwell, J., Evtyushkin, D., Ghosh, A. and Sapello, A. (2024) Computing with time: microarchitectural weird machines. Communications of the ACM (research highlight of the ASPLOS 2021 paper). doi:10.1145/3610722 (behind its links)
Bratus S, Locasto ME, Patterson ML, Sassaman L, Shubina A. Exploit Programming: From Buffer Overflows to 'Weird Machines' and Theory of Computation. ;login: 36(6), December 2011 (behind its links)
Bangert, J., Bratus, S., Shapiro, R. and Smith, S. W. (2013) The page-fault weird machine: lessons in instruction-less computation. USENIX WOOT 2013 (behind its links)
Shapiro, R., Bratus, S. and Smith, S. W. (2013) 'Weird machines' in ELF: a spotlight on the underappreciated metadata. USENIX WOOT 2013 (sections: abstract, 1, relocation metadata, Cobbler implementation, conclusion) (behind its links)
Carlini, N., Barresi, A., Payer, M., Wagner, D. and Gross, T. R. (2015) Control-flow bending: on the effectiveness of control-flow integrity. 24th USENIX Security Symposium (sections: abstract, 6.1-6.2) (behind its links)
Diatchki, I. S. et al. (2024) Daedalus: safer document parsing. Proceedings of the ACM on Programming Languages (PLDI). doi:10.1145/3656410 (behind its links)
Ramananandro, T., Delignat-Lavaud, A., Fournet, C., Swamy, N., Chajed, T., Kobeissi, N. and Protzenko, J. (2019) EverParse: verified secure zero-copy parsers for authenticated message formats. 28th USENIX Security Symposium (sections: abstract, introduction) (behind its links)
Lam, D., Li, L. W. and Anderson, C. (2024) PDF investigation with parser differentials and ontology. IEEE Transactions on Information Forensics and Security. doi:10.1109/tifs.2024.3445733 (sections: abstract, introduction, parser selection) (behind its links)
Shacham H. The geometry of innocent flesh on the bone: return-into-libc without function calls (on the x86). ACM CCS 2007. doi:10.1145/1315245.1315313 (behind its links)
Abela, R. and Vella, M. (2021) Casting exploit analysis as a weird machine reconstruction problem. arXiv:2109.13100 (sections: abstract, I-II) (behind its links)
Paykin, J., Mertens, E., Tullsen, M., Maurer, L., Razet, B., Bakst, A. and Moore, S. (2019) Weird machines as insecure compilation. arXiv:1911.00157 (sections: abstract, I, II, III.C); PDF text extraction with two columns interleaved (damaged in places) (behind its links)
Sassaman, L., Patterson, M. L., Bratus, S. and Shubina, A. (2011) The halting problems of network stack insecurity. ;login: 36(6) (sections: opening) (behind its links)
Levy, M. and Maldonado, F. (2024) Attack surface measurement: a weird machines perspective. EICC 2024. doi:10.1145/3655693.3655705 (behind its links)
Howard, Pincus & Wing 2005, Measuring Relative Attack Surfaces (in Computer Security in the 21st Century, Springer), doi:10.1007/0-387-24006-3_8 (behind its links)
Oakley, J. and Bratus, S. (2011) Exploiting the hard-working DWARF: trojan and exploit techniques with no native executable code. USENIX WOOT 2011 (sections: abstract, introduction) (behind its links)
Collins, M., Cumberland, J., Dunn, B. et al. (2026) Weird machines in Transport Layer Security. arXiv:2608.13685 (preprint; sections: abstract, 1-2.1, theorem 1 proof, 8.2-8.5, references) (behind its links)
Vanegue, J. (2014) The weird machines in proof-carrying code. IEEE Security and Privacy Workshops. doi:10.1109/SPW.2014.37 (sections: abstract, I, II) (behind its links)
Churchill, A., Biderman, S. and Herrick, A. (2019) Magic: The Gathering is Turing complete. arXiv:1904.09828 (sections: abstract, introduction) (behind its links)
Turing completeness (Wikipedia, via Wikimedia Enterprise snapshot 2026-11-01) (behind its links)
Sassaman, L., Patterson, M. L., Bratus, S., Locasto, M. E. and Shubina, A. (2011) Security applications of formal language theory. Dartmouth Computer Science Technical Report TR2011-709 (sections: introduction, 3.1, 4.1, Part II sections 9-10) (behind its links)
Language-theoretic security (Wikipedia, via Wikimedia Enterprise snapshot 2026-11-01) (behind its links)
Hansen, R. J. and Patterson, M. L. (2005) Guns and butter: towards formal axioms of input validation. Black Hat USA white paper (sections: abstract, 1, 5) (behind its links)
Poll, E. (2018) LangSec revisited: input security flaws of the second kind. IEEE Security and Privacy Workshops. doi:10.1109/spw.2018.00051 (sections: introduction, II, III) (behind its links)
Ali, S., Anantharaman, P., Lucas, Z. S. and Smith, S. W. (2021) What we have here is failure to validate: summer of LangSec. IEEE Security & Privacy 19(3): 17-23. doi:10.1109/MSEC.2021.3059167 (behind its links)
Return-oriented programming (Wikipedia, via Wikimedia Enterprise snapshot 2026-11-01; sections: lead) (behind its links)
Abate, C., Blanco, R., Garg, D., Hritcu, C., Patrignani, M. and Thibault, J. (2019) Journey beyond full abstraction: exploring robust property preservation for secure compilation. IEEE CSF 2019. doi:10.1109/csf.2019.00025 (sections: abstract, related work) (behind its links)
Jančar, P. (2020) Equivalence of pushdown automata via first-order grammars. Journal of Computer and System Sciences. doi:10.1016/j.jcss.2020.07.004 (sections: introduction) (behind its links)
Transactional Synchronization Extensions (Wikipedia, via Wikimedia Enterprise; sections: lead, history) (behind its links)