skills/binary-exploitation/common-binary-protections-and-bypasses/memory-tagging-extension-mte/SKILL.md
Memory Tagging Extension (MTE) analysis and bypass for ARM binary exploitation. Use this skill whenever working with ARM binaries, analyzing memory protections, debugging MTE-related crashes (SIGSEGV with SEGV_MTESERR/SEGV_MTEAERR), investigating use-after-free or buffer overflow vulnerabilities on ARM systems, or when the user mentions MTE, memory tagging, ARM security, KASAN, or hardware memory protections. This skill covers MTE fundamentals, detection, and bypass techniques including speculative execution attacks like TikTag.
npx skillsauth add abelrguezr/hacktricks-skills mte-memory-taggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A comprehensive guide to understanding, detecting, and bypassing ARM's Memory Tagging Extension for binary exploitation.
Memory Tagging Extension (MTE) is a hardware-based memory protection mechanism in ARM architecture that detects and prevents memory-related errors like buffer overflows and use-after-free vulnerabilities.
MTE works by:
Pointer structure (64-bit ARM):
┌─────────────────────────────────────────────────────────────┐
│ 31-28: TAG (4 bits) │ 27-0: Address bits │
└─────────────────────────────────────────────────────────────┘
| Mode | Behavior | Performance | Security |
|------|----------|-------------|----------|
| Sync | Immediate check, raises SIGSEGV (SEGV_MTESERR) | Slowest | Highest |
| Async | Deferred check, sets exception bit, SIGSEGV (SEGV_MTEAERR) | Faster | Lower |
| Mixed | Per-core preferences via /sys/devices/system/cpu/cpu*/mte_tcf_preferred | Variable | Variable |
# Check if MTE is enabled on the system
cat /sys/devices/system/cpu/cpu*/mte_tcf_preferred
# Check process MTE status
cat /proc/<pid>/auxv | grep -i mte
The kernel implements MTE through Hardware Tag-Based KASAN:
| Tag | Meaning | |-----|---------| | 0x0-0xD | Valid random tags (14 values) | | 0xE | Invalid tag (unallocated memory) | | 0xF | Match-all tag (bypasses MTE) |
slab and page_alloc use MTE; vmalloc, stack, and globals may still be exploitableChallenge: Writing past allocated buffer
MTE Behavior:
Bypass Strategy:
1. Map memory layout to find granule boundaries
2. Exploit within last granule (bytes 36-47 in 35-byte allocation)
3. Or rely on 7% tag collision probability
4. Or use speculative execution (TikTag) to leak tags
Challenge: Accessing freed memory
MTE Behavior:
Bypass Strategy:
1. Trigger UAF immediately after free (before reallocation)
2. Control allocation to get same tag
3. Use heap spraying to increase collision probability
4. Or leak tag via TikTag and craft matching pointer
TikTag (2024) demonstrated that MTE can be bypassed via speculative execution side channels.
When analyzing an ARM binary or system:
# 1. Check MTE support
grep -i mte /proc/cpuinfo
# 2. Check MTE mode
cat /sys/devices/system/cpu/cpu*/mte_tcf_preferred
# 3. Check for MTE-related crashes
# SIGSEGV with SEGV_MTESERR = sync MTE violation
# SIGSEGV with SEGV_MTEAERR = async MTE violation
# 4. Check kernel MTE (KASAN)
dmesg | grep -i mte
dmesg | grep -i kasan
# 5. Check process MTE status
cat /proc/<pid>/auxv | grep -i mte
Is MTE enabled?
├─ No → Standard exploitation
└─ Yes
├─ Can you stay within tagged granules?
│ └─ Yes → Exploit within last granule
├─ Can you control allocation?
│ ├─ Yes → Heap spray for tag collision (7%)
│ └─ No → Try speculative execution (TikTag)
├─ Is it async mode?
│ └─ Yes → Complete attack before exception
└─ Can you leak tags?
└─ Yes → Craft matching pointers
Use this skill when:
testing
How to perform a House of Lore (small bin attack) heap exploitation. Use this skill whenever the user mentions heap exploitation, small bin attacks, fake chunks, glibc heap vulnerabilities, or needs to insert fake chunks into small bins for arbitrary read/write. Trigger for CTF challenges involving heap corruption, glibc 2.31+ exploitation, or when the user needs to bypass malloc sanity checks using fake chunk linking.
testing
How to perform House of Force heap exploitation attacks. Use this skill whenever the user mentions heap exploitation, House of Force, top chunk manipulation, arbitrary memory allocation, malloc manipulation, or wants to allocate chunks at specific addresses. Also trigger for CTF challenges involving heap overflows, top chunk size overwrites, or when the user needs to calculate evil_size for heap attacks. Make sure to use this skill for any binary exploitation task involving glibc heap manipulation, even if they don't explicitly say "House of Force".
tools
How to perform House of Einherjar heap exploitation to allocate memory at arbitrary addresses. Use this skill whenever the user mentions heap exploitation, glibc heap attacks, arbitrary memory allocation, off-by-one overflow exploitation, tcache poisoning, fast bin attacks, or any CTF challenge involving heap manipulation. This is essential for binary exploitation tasks where you need to control malloc() return addresses.
testing
How to identify, analyze, and exploit heap overflow vulnerabilities in binary exploitation challenges and real-world scenarios. Use this skill whenever the user mentions heap overflows, memory corruption, heap grooming, tcache poisoning, fast-bin attacks, or any heap-related vulnerability in CTF challenges, binary analysis, or security research. This skill covers heap overflow fundamentals, exploitation techniques, heap grooming strategies, and real-world CVE analysis.