Skip to content
Memory corruption Write-up Advanced

Microsoft Windows Network File System v4 Remote Code Execution

A buffer overflow in Windows NFSv4 response handling lets an unauthenticated attacker send a crafted RPC compound request with many operations, causing a size miscalculation and overflow. Successful exploitation could execute arbitrary code as SYSTEM; failure may crash the system.

thezdi.com

Published on thezdi.com

A remote code execution vulnerability exists in Windows Network File System. The vulnerability is due to improper handling of NFSv4 requests.

The author, on thezdi.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

The server calculates the response buffer size without including the size of each opcode, under-allocating by OP Count * 4 bytes, so a compound request with enough operations overflows the buffer.

Impact

An unauthenticated attacker could execute arbitrary code as SYSTEM; an unsuccessful attempt may crash the target system.

What the attacker needed

Network access to the NFS service; NFSv4 enabled on the target

The fix

Microsoft patched the bug in June 2022; the update should only be applied after the fix for CVE-2022-26937 is installed, and disabling NFSv4.1 is a mitigation that may lose functionality.

How it was found

  1. Send an ONC RPC message over TCP with the NFS program number and the COMPOUND procedure.
  2. Set the program version to NFSv4.
  3. Include more than 18 operations in the compound request so the overflow exceeds the buffer padding.

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.

NFS is a way for computers to share files over a network. The Windows version had a bug where it worked out how much memory to reserve for a reply but forgot to count a small part for each requested action, so a request with many actions made the reply spill over into neighbouring memory. An attacker who can reach the NFS service could use that spill to run their own code with the highest Windows 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.