Memory Safety Isn't All You Need: Code Reuse Attacks in Memory Safe Languages
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.
Create a lesson
Metadata
- Comments
- 19 pages, 9 figures, 4 tables, 20 listings, to be published in the 22nd ACM ASIA Conference on Computer and Communications Security (ACM ASIACCS 2027)
Related papers
The Limit Is in the Input, Not the Model: State-Dependent Command Safety in Natural-Language Interfaces to Industrial Controllers
Shared title terminologycs.CRHemen Taukoor, Zhaoxia Wang, Venky Shankararaman
Compositional Exploits in Autonomous Coding Agents: Attack Mechanics and Ephemeral Defense
Shared title terminologycs.CRDeep Shah, Nehal Kathrotia
Look Here, Then Decide: Small Decision Models in a Harness Find Memory-Safety Vulnerabilities at Scale on Commodity GPUs
Shared title terminologycs.CRTim De Wachter, Kyryl Volkov, Myrto Eleftheria Gkogkou et al.
When Safety Becomes an Attack Surface: Manipulating Abstention in Tool-Using AI Agents
Shared title terminologycs.CRCharles Xiao
From Attack Surface to Defense Architecture: Compositional Security for Agentic Coding Harnesses
Shared title terminologycs.CRSimon Hegelich, Bardh Prenkaj, Habiba Sarhan et al.
Domain-Invariant and Language-Model-Assisted Acoustic Side-Channel Attacks on Keyboards
Shared title terminologycs.CRBikrant Bikram Pratap Maurya