Skip to content
Memory corruption Write-up Advanced

The Intel SYSRET privilege escalation (2012)

A difference in how Intel processors handle the SYSRET instruction compared to AMD allows a guest to cause a general protection fault while the processor is still in hypervisor mode, using a non-canonical return address. This lets the guest overwrite the hypervisor's stack pointer with a value it controls, potentially escalating to hypervisor-level privileges.

blog.xenproject.org

Published on blog.xenproject.org

The Xen Security team recently disclosed a vulnerability, Xen Security Advisory 7 (CVE-2012-0217), which would allow guest administrators to escalate to hypervisor-level privileges. The impact is much wider than Xen; many other operating systems seem to have the same vulnerability, including NetBSD, FreeBSD, some…

The author, on blog.xenproject.org

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Intel SYSRET implementation checks for a canonical return address before changing the privilege level, so a non-canonical address causes a fault in privileged mode using the guest's stack pointer.

Impact

A guest administrator could escalate to hypervisor-level privileges; the same attack also affected NetBSD, FreeBSD, and some versions of Windows 7, while OpenBSD and Linux were not vulnerable.

What the attacker needed

Guest administrator access; Intel processor; 64-bit operating system or hypervisor using SYSRET

The fix

Xen fixed it by checking that RCX is canonical on the SYSRET return path and falling back to the slower IRET path if not.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a computer program asks the operating system to do something, it uses a special instruction to switch from user mode to kernel mode. On Intel chips, if the return address given to this instruction is invalid, the chip raises an error before switching back to user mode, so the error handler runs with kernel privileges and uses a stack pointer that the user program can control. This lets a malicious program overwrite kernel memory and gain higher privileges.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.