Skip to content
Memory corruption Write-up Advanced

Hyper-V 1-day Class: CVE-2024-38127

A buffer over-read in the Hyper-V virtual hard disk driver vhdmp.sys lets a caller request metadata with a small output buffer, after which the driver reports a larger copied length than the buffer holds. The kernel then copies adjacent non-paged pool memory back to the user, leaking kernel data; the author doubts this is a real elevation of privilege.

hackyboiz.github.io

Published on hackyboiz.github.io

안� �하세요, pwndorei� 니다. 이번에도 어김없이 Hyper-V 1-day 취약점 분석글로 돌아왔습니다. 이번 달에 나온 취약점은 아니고 저번 달에 공개된 CVE-2024-38127이란 취약점� 니다. 이번 달에도 DoS 취약점이 하나 공개되었던데 시간이 된다면 그거도 분석해보겠습니다….

j0dev, y2sman, on hackyboiz.github.io

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 error path sets the returned output length to the full metadata size even when the caller's output buffer is too small, so the I/O manager copies more bytes than were written.

What the attacker needed

Ability to open or create a virtual hard disk; local access to the Hyper-V driver

The fix

The patch adds an else branch that sets the returned output length to zero when the output buffer is too small, preventing the over-read; the text shows the fixed driver version.

How it was found

  1. Create a virtual hard disk with CreateVirtualDisk to obtain a handle.
  2. Send a DeviceIoControl request with control code 0x2d1940 and an input value of 5.
  3. Provide an output buffer of 0x20 bytes, smaller than the metadata length.
  4. Observe that the call fails but the returned data contains adjacent non-paged pool contents.

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.

A driver in Windows that handles virtual hard disks has a function that copies information back to the program that asked for it. If the program provides a small output area, the driver still tells Windows to copy more bytes than that area can hold, so Windows also copies whatever sits next to it in kernel memory. That extra data is returned to the caller, which is an information leak rather than a way to run code.

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.