Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 528

Heap Spraying

Reviewed byCybersecurity entrepreneur & security researcher

What is Heap Spraying?

Heap SprayingAn exploitation primitive that fills the heap with many copies of a payload so that a corrupted pointer is highly likely to land on attacker-controlled data.


Heap spraying populates large regions of process memory with predictable copies of a NOP-sled and shellcode (or, in modern variants, ROP gadgets or fake object vtables). When an attacker triggers a memory corruption bug — a use-after-free or type confusion in a browser — the corrupted pointer is steered to a likely fixed address (historically 0x0c0c0c0c, which doubles as a valid NOP-equivalent instruction) where the spray guarantees the desired bytes. Because the attacker controls millions of identical allocations, exact heap layout knowledge is unnecessary.

The technique was popularised by SkyLined's 2004 Internet Explorer exploits. Its most consequential real-world use was Operation Aurora (late 2009–January 2010), the espionage campaign against Google, Adobe and others: the IE exploit abused use-after-free CVE-2010-0249, combining a malformed HTML comment element with a JavaScript heap spray to place shellcode, and was patched out-of-band in Microsoft bulletin MS10-002. Heap spraying remained a staple of browser, PDF and font-parsing exploit kits for years afterward.

Modern defences include high-entropy ASLR, partitioned/isolated heaps (Chromium's PartitionAlloc, Edge's MemGC and heap isolation), Control-Flow Integrity, and JIT-hardening mitigations that stop attacker-controlled JavaScript arrays from leaking into executable memory.

flowchart TD
  A["Attacker JS/ActionScript in page"] --> B["Allocate many identical chunks<br/>NOP-sled + shellcode / ROP"]
  B --> C["Heap filled; address 0x0c0c0c0c<br/>almost certainly attacker data"]
  A --> D["Trigger memory-corruption bug<br/>e.g. use-after-free (CVE-2010-0249)"]
  D --> E["Corrupted pointer dereferenced"]
  E --> F{"Where does it land?"}
  F -->|"Into the spray"| G["Execution slides down NOP-sled<br/>to shellcode / ROP chain"]
  F -->|"Unmapped / randomised (ASLR)"| H["Crash — exploit fails"]

● Examples

  1. 01

    Allocating hundreds of MB of JavaScript strings containing shellcode to make 0x0c0c0c0c executable shellcode after a use-after-free.

  2. 02

    Adobe Flash exploits using Vector<uint> sprays to land ROP chains.

● Frequently asked questions

What is Heap Spraying?

An exploitation primitive that fills the heap with many copies of a payload so that a corrupted pointer is highly likely to land on attacker-controlled data. It belongs to the Attacks & Threats category of cybersecurity.

What does Heap Spraying mean?

An exploitation primitive that fills the heap with many copies of a payload so that a corrupted pointer is highly likely to land on attacker-controlled data.

How do you defend against Heap Spraying?

Defences for Heap Spraying typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Heap Spraying?

Common alternative names include: Heap spray.

● Related terms

● See also