Skip to content
Memory corruption Write-up Advanced

Sequoia: A Local Privilege Escalation Vulnerability in Linux’s Filesystem Layer (CVE-2021-33909)

A size_t-to-int conversion flaw in the Linux kernel's seq_file interface allows an unprivileged local user to write out of bounds by creating a deep directory structure and reading /proc/self/mountinfo. This can lead to full root privileges on default installations of several Linux distributions.

blog.qualys.com

Published on blog.qualys.com

The Qualys Research Team has discovered a sizet-to-int type conversion vulnerability in the Linux Kernel’s filesystem layer affecting most Linux operating systems. Any unprivileged user can gain root privileges on a vulnerable host by exploiting this vulnerability in a default configuration.

The author, on blog.qualys.com

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 a size_t-to-int type conversion: a buffer size (size_t) is passed to a function expecting an int, so a size larger than 2GB becomes negative, leading to an out-of-bounds write.

Impact

Successful exploitation allows any unprivileged user to gain root privileges on the vulnerable host; the researchers verified this on default installations of Ubuntu 20.04, Ubuntu 20.10, Ubuntu 21.04, Debian 11, and Fedora 34 Workstation, and other distributions are likely vulnerable.

What the attacker needed

Unprivileged local user account; ability to create and mount a deep directory; read access to /proc/self/mountinfo

The fix

The kernel must be patched; mitigations such as disabling unprivileged user namespaces or eBPF only prevent the specific exploit and do not fully fix the vulnerability.

How it was found

  1. Create, mount, and delete a deep directory structure whose total path length exceeds 1GB.
  2. Open and read /proc/self/mountinfo.
  3. The kernel allocates a 2GB buffer and calls show_mountinfo().
  4. The buffer size is passed as an int, becoming negative, and a string is written out of bounds.

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.

The Linux kernel uses a buffer to hold information about mounted filesystems. When a very long path is involved, a number that should be large and unsigned becomes negative when treated as a signed integer, causing a write outside the buffer. An attacker with a normal user account can use this to become the administrator (root) of the machine.

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.