Microsoft wimgapi LoadIntegrityInfo Code Execution Vulnerability
A heap-based buffer overflow in the LoadIntegrityInfo function of wimgapi allows a crafted WIM file to cause heap corruption, potentially leading to remote code execution.
Originally disclosed on Cisco Talos
An exploitable heap corruption exists in the LoadIntegrityInfo function of wimgapi version 10.0.16299.15 (WinBuild.160101.0800). A crafted WIM image can lead to a heap corruption, resulting in direct code execution.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code allocates a buffer based on the uncompressed_size field but then reads size_in_wim bytes into it without validating that size_in_wim is not larger, leading to a heap overflow.
Impact
This heap corruption can be turned into remote code execution by an attacker.
What the attacker needed
Victim opens a crafted WIM file
How it was found
- Craft a WIM file with rhIntegrity.size_in_wim set to 0xFFF2 and rhIntegrity.uncompressed_size set to 0x10.
- Call WIMCreateFile on the crafted WIM file.
- The library allocates a heap buffer of size uncompressed_size (0x10) and then reads size_in_wim (0xFFF2) bytes into it, causing heap corruption.
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 report has not been written yet. The Original tab links to the source.
A WIM file is a disk image format used by Windows. The wimgapi library reads these files, and a mistake in how it checks sizes allows an attacker to write more data than allocated, corrupting memory and possibly running malicious 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.