# VirtualBox Process Hardening on Windows 2026 Edition: What’s a Single Bit Between Friends?

.NET Framework's FlatImageLayout fallback loads assemblies from data-only sections, letting an AnyCPU DLL bypass VirtualBox's NtCreateSection hardening and execute arbitrary code in protected VM processes.

- Payout: Research
- Severity: high
- Program: VirtualBox
- Write-up by: James Forshaw
- Disclosed: 2026-11-23
- CVE: CVE-2026-87268, CVE-2026-108398
- Write-up quality: 9/10
- Original: https://projectzero.google/2026/11/virtualbox-process-hardening.html
- Library page: https://bugbountylibrary.com/r/blog%3Aprojectzero-google-2026-11-virtualbox-process-hardening-html
- Tags: area:os domain:desktop impact:integrity impact:privesc kind:research platform:research sev:high tech:dotnet tech:windows technique:chained technique:source-review vuln:auth-bypass vuln:privilege-escalation vuln:sandbox-escape

**Target:** .NET Framework assembly loader / VirtualBox NtCreateSection hardening hook
**Root cause:** PEImageLayout::Map falls back to FlatImageLayout (data-only CreateFileMapping, no SEC_IMAGE) when the image mapping fails with ERROR_BAD_EXE_FORMAT, and .NET still executes the assembly from memory. VirtualBox's NtCreateSection hook returns STATUS_INVALID_IMAGE_FORMAT for architecture-mismatched PEs with executable sections, which AnyCPU assemblies trigger.
**Steps:**
1. Compile a managed-only .NET assembly as AnyCPU (produces 32-bit x86 PE with executable code size).
2. Register a .NET COM class in HKCU for a CLSID a hardened VirtualBox process loads.
3. Start a VM; the process loads the COM object, .NET runtime loads the assembly.
4. VirtualBox's NtCreateSection hook sees SEC_IMAGE on the x86 PE, PE parser returns VERR_LDR_ARCH_MISMATCH, mapped to STATUS_INVALID_IMAGE_FORMAT.
5. CreateFileMapping fails with ERROR_BAD_EXE_FORMAT, .NET falls back to FlatImageLayout and executes the assembly in the protected process.
6. For WDAC/UMCI: clear IMAGE_FILE_EXECUTABLE_IMAGE bit in COFF Characteristics with a hex editor, then run `C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe c:\path\to\assembly.dll /unregister` to load and execute via UnregisterFunction.
7. For PPL: COM-hijack WerSecureFault.exe's COM registration with the modified assembly to get TCB-level PPL code execution.
**How found:** Forshaw questioned his 2017 assumption that loading a .NET assembly from a file always maps an image section subject to DLL hardening checks; reading PEImageLayout::Map revealed the FlatImageLayout fallback on ERROR_BAD_EXE_FORMAT. He then traced which VirtualBox hook path returns STATUS_INVALID_IMAGE_FORMAT (VERR_LDR_ARCH_MISMATCH from rtldrPEOpen) and realized AnyCPU assemblies naturally trigger it.
**Exploitation:** COM hijacking in HKCU registers a .NET COM class loaded by a hardened VirtualBox VM process (or WerSecureFault.exe for PPL). The .NET runtime loads the AnyCPU assembly, VirtualBox's hook rejects the image section as arch-mismatched, and .NET's FlatImageLayout fallback executes it from a data-only mapping, yielding arbitrary code in the protected process without admin rights.
**Escalation:** Same primitive reused beyond VirtualBox: single-bit IMAGE_FILE_EXECUTABLE_IMAGE clear bypasses WDAC/UMCI on Windows 11 S Mode via regasm.exe, and COM hijack of WerSecureFault.exe yields PPL at TCB level.
**Insight:** When a hardening hook maps an error to a benign-looking NTSTATUS, check whether a downstream loader treats that status as a fallback trigger rather than a hard failure; AnyCPU .NET assemblies are x86 PEs with executable sections, so arch-mismatch checks on 64-bit hosts reject them while .NET still loads them from a flat mapping.

## Proof of concept (copied exactly from the original report)

**RegAsm loads bit-modified .NET assembly under UMCI**

```
using System;
using System.Runtime.InteropServices;

public class ComClass
{
 [ComUnregisterFunction]
 public static void UnregisterFunction(Type t)
 {
 //Insert code here.
 }
}


Modify the resulting assembly to remove the IMAGE_FILE_EXECUTABLE_IMAGE flag. You don’t need to fix up anything else like the image checksum, a hex editor is all you need to change a single bit. Then you can pass the path to the modified assembly DLL to the RegAsm executable from the .NET runtime directory. Note, you should pass the /unregister option to run the UnregisterFunction, as unregistering doesn’t require administrator privileges.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe c:\path\to\assembly.dll /unregister
```

**NtCreateSection hook returning STATUS_INVALID_IMAGE_FORMAT**

```
static NTSTATUS supR3HardenedScreenImageCalcStatus(int rc) {
 if (rc == VERR_LDR_ARCH_MISMATCH)
 return STATUS_INVALID_IMAGE_FORMAT;

 return STATUS_TRUST_FAILURE;
}
```

**FlatImageLayout fallback mapping without SEC_IMAGE**

```
void FlatImageLayout::FlatImageLayout(HANDLE file) {
 HANDLE mapping = CreateFileMapping(file, nullptr, PAGE_READONLY);
 if (mapping) {
 this->Image = CLRMapViewOfFileEx(mapping);
 } else {
 ThrowLastError();
 }
 // ...
}
```

