VirtualBox and .NET: when rejecting an image enables a fallback

Started by Anoncto@anoncto••0 views•1 replies
A
Anoncto@anoncto
VIP
22
0
#1

A loader can reject an untrusted DLL and still hand the runtime exactly the signal it needs to execute that file another way. The interesting part of this VirtualBox bypass is that the rejection worked—the caller interpreted it as permission to try a different representation.

James Forshaw's VirtualBox hardening writeup explains CVE-2026-87268. Oracle's CNA record lists supported version 7.2.16 as affected, on Windows hosts, with a local low-privileged attacker. This is host-process hardening research, not a guest-to-host escape.

One file, two loading paths

In the .NET Framework v4 path Forshaw describes:

  1. The runtime first tries to map the assembly as a PE image using SEC_IMAGE. That brings VirtualBox's image-screening hook into play.
  2. An architecture mismatch makes the hook return STATUS_INVALID_IMAGE_FORMAT, translated into Win32's ERROR_BAD_EXE_FORMAT.
  3. That particular error lets the runtime try FlatImageLayout: map the file as ordinary data instead.
  4. If the assembly is valid and the runtime's policy checks permit loading, managed code can execute without the original image mapping succeeding.

A non-executable data mapping is not the same thing as non-executable content. An interpreter or managed runtime can consume those bytes and produce executable behavior later.

Forshaw reports that an unmodified AnyCPU assembly was enough to hit the architecture-mismatch path. A per-user COM registration supplied the assembly-loading entry into the hardened process. So the missing piece was not a broken signature—it was a disagreement over what a failed image load meant.

The fix changes the conversation

The upstream VirtualBox change, dated 7 September 2026, changes that architecture-mismatch result:

Diff
- return STATUS_INVALID_IMAGE_FORMAT;
+ return STATUS_FILE_NOT_SUPPORTED;

Its comment explicitly warns against errors translated to ERROR_BAD_EXE_FORMAT, because .NET may take the data-mapping fallback. Both statuses reject the original request; only one sends the caller down that fallback. Error codes are part of the security boundary, not just log decoration.

Forshaw also describes separate COM hardening. The source change above is not a complete shipped-version matrix. His observed fallback result is scoped to .NET Framework v4; he describes different later loading behavior in v2/v3.5 and did not investigate modern .NET v5+.

A useful way to review loader failures

I'd trace three things together:

  • The denial: which exact status reaches the caller?
  • The next representation: does the caller retry as an image, data, a byte array or input to another runtime?
  • The eventual execution gate: does that path apply the policy the original image check was meant to enforce?

A security regression test that only asserts “image mapping failed” would miss the important outcome. For a security rejection, the assertion needs to cover whether those bytes reach managed execution through a fallback.

For loaders that need compatibility fallbacks, where would you draw the API distinction between “unsupported representation, try another” and “security policy rejected these bytes”? Is a different error enough in your design, or does the fallback need an explicit shared policy decision?

0

Join the conversation!