Exploiting a 20 years old NTFS Vulnerability
An integer overflow in the NTFS log file service's record-length validation lets a crafted virtual disk bypass a bounds check, so a huge client data length survives into later parsing. This can lead to out-of-bounds reads and memory corruption during volume mount, which the author aims to turn into privilege escalation.
swarm.ptsecurity.com
Published on swarm.ptsecurity.com
Filesystems implementation is old complex and not very well audited by independent researchers. In this article I would like to share beautiful exploitation showcase of vulnerability that I found in Windows NTFS implementation.
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 record length from the on-disk log is added to a fixed header length in 32-bit arithmetic without an overflow check, so a crafted length wraps around and passes validation while the original huge value is still used later.
Impact
A crafted virtual disk could cause out-of-bounds reads and memory corruption during mount, which the author states can be exploited to achieve privilege escalation, though the article does not demonstrate a complete working exploit.
What the attacker needed
Victim mounts a crafted virtual disk; attacker can craft the disk image contents
How it was found
- Create a virtual disk with full physical allocation and format the volume as NTFS.
- Mount the disk and set a breakpoint at the NTFS mount routine to confirm the path.
- Edit the log record's client data length field in the disk image to a very large value.
- Mount again and observe the restart table read and the oversized copy.
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.
NTFS is the filesystem Windows uses, and it keeps a log of changes so it can recover after a crash. A virtual disk is just a file that behaves like a hard drive, so an attacker can craft its contents. Here a length value stored in that file is trusted, and adding a small fixed number to it wraps around to a tiny number, slipping past a size check.
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.