Kuboid
Open Luck·Kuboid.in
Black Hat2024
Open in YouTube ↗

Bypassing ARM's Memory Tagging Extension with a Side-Channel Attack

Black Hat1,803 views27:26about 1 year ago

This talk demonstrates a novel side-channel attack that bypasses ARM's Memory Tagging Extension (MTE) by leaking memory tags through cache timing differences. The research exploits speculative execution to trigger tag checks without crashing the target process, enabling successful memory corruption exploitation. The speaker presents two specific tag-leakage gadgets and demonstrates a successful bypass of MTE protections in the Google Chrome V8 engine. This research highlights critical hardware-level vulnerabilities in MTE implementations and provides a proof-of-concept for bypassing this modern security mitigation.

Bypassing ARM Memory Tagging Extension via Speculative Execution

TLDR: Researchers have demonstrated a novel side-channel attack that bypasses ARM Memory Tagging Extension (MTE) by leaking memory tags through cache timing analysis. By leveraging speculative execution, the attack triggers tag checks without crashing the target process, effectively neutralizing MTE as a memory corruption mitigation. This research confirms that MTE is not a silver bullet and requires additional software-level hardening to remain effective against sophisticated exploitation.

Memory corruption remains the most persistent adversary in modern software security. While we have spent decades layering defenses like ASLR, stack canaries, and control-flow integrity, these mechanisms are often bypassed by clever primitives. ARM introduced Memory Tagging Extension (MTE) to change the game by assigning a 4-bit tag to every 16-byte memory allocation. When a pointer accesses memory, the hardware compares the pointer's tag to the memory's tag. If they do not match, the CPU triggers a fault. It is a elegant, hardware-enforced solution that promised to make use-after-free and buffer overflow vulnerabilities significantly harder to exploit.

However, hardware-level security features often introduce their own side-channel vulnerabilities. The research presented at Black Hat 2024 by Juhee Kim and colleagues from Seoul National University and Samsung Research proves that MTE is susceptible to tag leakage. The attack does not break the tagging mechanism itself; instead, it extracts the secret tags, allowing an attacker to craft pointers that pass the hardware check.

The Mechanics of the Tag Leak

The core of the attack relies on two distinct CPU behaviors: cache side-channels and speculative execution. MTE tag checks are performed by the hardware, but the result of these checks can influence the state of the CPU cache. If an attacker can determine whether a specific memory access was cached, they can infer whether the tag check succeeded or failed.

The challenge is that a failed tag check typically triggers a crash, which would terminate the process and end the attack. This is where speculative execution becomes the attacker's best friend. Modern CPUs execute instructions ahead of time based on branch predictions. If the CPU speculatively executes a code path that performs a memory access with an incorrect tag, it will eventually realize the mistake and revert the architectural state. Crucially, the CPU does not revert the cache state. By carefully timing memory accesses, an attacker can determine if the speculatively executed code accessed the target memory, thereby leaking the tag.

The researchers identified two primary gadgets that facilitate this leakage:

  1. Multiple Loads: By forcing the CPU to perform multiple memory accesses within a speculative window, the attacker can observe cache timing differences that reveal the tag value.
  2. Store-to-Load Forwarding: This gadget exploits the CPU's internal optimization where it forwards data from a store buffer to a subsequent load. If the tag check fails during this process, the CPU blocks the forwarding, creating a measurable timing difference.

Real-World Impact on Chrome

The researchers demonstrated this technique against the Google Chrome V8 engine, specifically targeting CVE-2023-5217, a heap buffer overflow in the libvpx library. In a standard scenario, MTE would detect the overflow and crash the renderer process, preventing exploitation. With the tag leakage gadget, the attacker can first leak the tag of the target object, then reallocate the heap until the tags align, and finally trigger the overflow without triggering a crash.

This is not a theoretical exercise. The proof-of-concept code released by the researchers shows how an attacker can iterate through all 16 possible tag values to find the correct one. For a pentester, this means that MTE-enabled devices are not immune to memory corruption exploits. If you are assessing an application that relies on MTE for security, you must treat it as a defense-in-depth measure rather than a guarantee of safety.

Defensive Considerations

Defenders should not view this as a failure of MTE, but rather as a reminder that hardware security is not isolated from microarchitectural side-channels. The primary mitigation for this class of attack is to ensure that sensitive code paths are not susceptible to speculative execution gadgets. This involves using techniques like speculative barriers or ensuring that memory access patterns do not leak information through the cache.

For those interested in the technical specifics, the official ARM documentation provides a baseline for how MTE is intended to function. However, as this research highlights, the gap between the specification and the microarchitectural implementation is where the most interesting vulnerabilities reside.

Moving forward, the industry must focus on "speculation-aware" sandboxing. If the V8 engine or other high-risk components can be hardened to prevent speculative execution from leaking data across security boundaries, the effectiveness of MTE will be restored. Until then, researchers and attackers alike will continue to probe the hardware-software interface for these subtle, high-impact leaks. If you are working on hardening critical systems, start by auditing your code for speculative gadgets that could be repurposed to leak secrets, whether those secrets are MTE tags or cryptographic keys.

Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in