Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Heap Write
Cyber Security

Heap Write

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Cyber Security

A heap write is a memory corruption bug where an attacker or faulty program writes data to an unintended location in heap memory. In security work, it often leads to crashes, data corruption, or code execution when the write alters objects, pointers, or control data used by the running process.

Heap Memory Corruption and Why Heap Writes Matter

A heap write is dangerous because heap memory is where many programs store live objects, pointers, and bookkeeping data. If a write lands in the wrong location, it can corrupt program state in ways that are hard to predict, often turning a simple memory bug into a crash or a security boundary bypass.

Heap writes are especially important in security work because the heap is dynamic. Allocation, reuse, and object layout change during execution, so a corruption that seems minor in testing can become exploitable under different timing, inputs, or allocator behaviour.

How Heap Writes Become Exploitable

The security significance of a heap write depends on what the overwritten bytes influence. A stray write may damage ordinary data, but if it changes a pointer, size field, vtable reference, function pointer, or adjacent object content, the process may later follow attacker-controlled data.

That is why heap write bugs are often evaluated not just for their immediate effect, but for their ability to create a reliable primitive such as arbitrary write, object corruption, or controlled execution flow. The exploitability question is usually about reachability, precision, and what the corrupted structure is used for later.

Common Failure Modes and Consequences

Heap write failures often show up as crashes, corrupted application state, or logic failures long before they produce a visible security incident. In some cases the corruption remains latent until the program frees memory, reuses the object, or dereferences a damaged pointer.

When the overwritten target participates in control flow or security decisions, the consequence can escalate from availability loss to code execution. Even when full execution is not achieved, heap corruption can still expose sensitive data, destabilise services, or undermine later security checks.

Defensive Analysis and Validation

Defenders usually validate heap-write exposure by tracing the write source, identifying the overwritten destination, and understanding allocator and object-lifetime behaviour. A write is more serious when it can cross object boundaries, bypass bounds checks, or affect memory that will be interpreted as metadata or a pointer later.

Security testing typically focuses on repeatability and control. Fuzzing, sanitizers, crash triage, and debugger-assisted analysis help determine whether the bug is only a stability issue or whether it exposes a path to dependable exploitation.

Risk and Threat Considerations

Heap writes are a classic memory corruption path because they can turn ordinary application input handling defects into attacker influence over live process memory. The risk is highest when the corrupted heap region later drives object access, control flow, or privilege-sensitive logic.

Failure mechanism: An attacker or faulty component causes a write to land beyond the intended heap object, then waits for the program to reuse the damaged memory or trust the corrupted structure.

Impact: The result can be process crashes, data corruption, denial of service, information exposure, or code execution, depending on what the overwritten bytes control.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5, OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKT1055 — Process InjectionHeap writes can enable code execution through corrupted process memory and control flow.
Recommendation — Map exploitation chains to process-memory manipulation techniques and hunt for post-exploit control-flow abuse.
NIST SP 800-53 Rev 5SI-10 — Information Input ValidationInvalid or unchecked input often produces the writes that corrupt heap memory.
SI-16 — Memory ProtectionHeap writes are addressed through protections that reduce memory corruption impact.
Recommendation — Validate untrusted input before it reaches memory-handling code paths. Apply memory-protection controls to limit exploitation of corrupted heap state.
OWASP ASVSV15 — Secure Coding and ArchitectureHeap-write bugs arise from unsafe memory handling that secure coding standards seek to prevent.
Recommendation — Review code for unsafe memory operations and enforce safer implementation patterns.
CIS Controls v8CIS-16 — Application Software SecurityHeap corruption is an application-layer defect that falls under secure software development safeguards.
Recommendation — Use secure development controls to reduce exploitable memory corruption defects.

Practitioner Guidance

What to watch for: Treat heap-write findings as more than a generic crash if the overwrite touches pointers, lengths, object headers, or any structure that influences later execution. Those details usually determine whether the bug is exploitable or merely unstable.

Practitioner note: The most useful next step is not just confirming that a heap write exists, but proving exactly what state it can corrupt and whether that state is security relevant. That distinction drives prioritisation far better than crash frequency alone.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org