Memory Safety Isn't All You Need: Code Reuse Attacks in Memory Safe Languages
Eric Cornelissen, Musard Balliu
Key points
From the paper's conclusion- We further systematize existing defenses into three common strategies - mediation, minimization, and constraint - and use them to derive candidate defense directions.
Abstract
Memory safety rules out classical code reuse attacks that rely on arbitrary memory corruption, but does not eliminate code reuse altogether. Attacks such as object injection, prototype pollution, class pollution, DOM clobbering, and DOM script gadgets arise in memory-safe languages without violating the underlying memory safety abstraction. We show that these seemingly different attacks share a common structure: Attacker-controlled data influences accesses to shared runtime state, such as runtime type information, prototype or class state, and the DOM, and a value fetched from that state subsequently influences a security-sensitive operation. Drawing on this insight, we develop a language-agnostic framework that decomposes an attack into a weakness, ending in a fetch from shared runtime state, and a gadget, which propagates the fetched value to a sensitive sink. We show that the framework captures five established attack classes and use it to derive stateless, mutating, and recycling weaknesses, together with simple, vertical, and horizontal gadget structures. We further systematize existing defenses into three common strategies - mediation, minimization, and constraint - and use them to derive candidate defense directions. Finally, we develop a model language that gives a formal account of code-reuse weaknesses and potential conditions for gadgets and end-to-end vulnerabilities.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Compositional Exploits in Autonomous Coding Agents: Attack Mechanics and Ephemeral DefensearXiv · 2026
- CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code GenerationarXiv · 2026
- Type-Confusion SecurityarXiv · 2026
- CodeMimicry: Exploiting Safety Generalization Lag in Large Language Models via Structured Code CompletionarXiv · 2026
- When Malicious Instructions Persist: Persistent Memory Poisoning Attack on Harness-Based AgentsarXiv · 2026
- Beyond Copying: Lifelong Smart Contract Security Task Construction via Protocol MutationarXiv · 2026