Vulnerabilities of Realtek SD card reader driver, part 1
A Windows SD card reader driver exposed a permissive device object and several IOCTL handlers that trusted user-supplied lengths and offsets, letting a non-privileged local user leak kernel pool and stack memory and write to arbitrary kernel memory. Combined, the flaws allowed reliable kernel memory corruption and, via a separate DMA flaw, physical memory access.
zwclose.github.io
Published on zwclose.github.io
I discovered multiple vulnerabilities in RtsPer.sys, an SD card reader driver developed by Realtek. These vulnerabilities enable non-privileged users to leak the contents of kernel pool and kernel stack, write to arbitrary kernel memory, and, the most interesting, read and write physical memory from user mode via the…
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 driver trusted user-supplied length and offset fields (SRB transfer length, SenseInfoOffset, ProtocolArgumentSize, DataBufferOffset) without validating them against the actual buffer size.
Impact
A non-privileged local user could leak kernel memory and, by chaining the flaws, write to arbitrary kernel memory; the DMA flaw additionally allowed reading and writing physical memory, though the PDO-based write required access the PDO ACL did not grant to Everyone.
What the attacker needed
Local access to the machine; device object accessible to Everyone
The fix
Realtek limited the copy length and added a check that SenseInfoOffset plus SenseInfoLength does not exceed the buffer length, and encrypted the log in the fixed version.
How it was found
- Open the device object, which allows access to everyone.
- Send a SCSI pass-through request with a READ CAPACITY command and a data buffer larger than the source.
- Receive the driver's data followed by leaked kernel heap memory.
- Repeat the leaking calls to predict the SystemBuffer address.
- Send a pass-through request with a rogue DataBufferOffset to write to the chosen kernel address.
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 is software that lets the operating system talk to hardware, and it runs with high privileges. This driver accepted instructions from ordinary programs without checking the sizes and positions they claimed, so a normal user could make it hand back hidden operating-system memory or overwrite it. That matters because controlling that memory can crash the machine or let an attacker take over the whole system.
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.