Repository navigation
Decode the agent desktop's video and images in a sandboxed process (decoder phases 2–4) - #73
Merged
Merged
Conversation
…process (phases 2-4) RemoteHubDecoder.exe decodes the device's H.264 video and clipboard images. RemoteHub starts it in an AppContainer with no capabilities (low integrity if that can't be made, refusing the picture if neither works), inside a job: ended with RemoteHub, no child processes, 1 GB, all UI limits, no error dialog, and only its two pipe ends and the video section inherited. Pixels come back through shared memory; RemoteHub checks every answer (kind, length, frame or image id, buffer, size) before it touches them. A decoder that ends, doesn't answer in time or answers something it can't mean is ended and restarted from a key frame; more than 3 failures in a minute end the session. Each stop is logged (no device names) and audited (desktop.decoder_stopped). Clipboard images are decoded once, when they arrive, in the session's decoder; the clipboard data is built from those pixels. RemoteHub.exe --decoder-check <file> runs the decoder as a session does and writes decoding and sandbox probe results as JSON (lab case SEC-DEC-06). The installer publishes and signs the decoder next to RemoteHub.exe. Tests: answer checks, the restart limit, the real decoder in its AppContainer and at low integrity (decoding and probes), a killed decoder, closing a session while a call waits, fuzzed video and images, and the tab after the session gives up. The memory-dump test now runs alone: dumping its own process beside the decoder tests deadlocked the run.
|
Pull requests start as drafts here. Mark this one Ready for review when it's done and all checks have passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phases 2–4 of
docs/decoder-isolation-design.md: a device's video and clipboard images are now decoded in a separate process,RemoteHubDecoder.exe, that can reach nothing of the administrator's PC (threats T9.1 and T9.2). A device that has been taken over can no longer use a flaw in Windows' H.264 or image decoders to run code inside RemoteHub, where the unlocked credentials are.How it works
src/RemoteHub.Decoder: only the H.264 decoder (VideoCodec.cs),DeviceImage.Decodeand the protocol. No settings, database, network or files.DecoderSandbox), §3.2:DIE_ON_UNHANDLED_EXCEPTIONDecoderProtocol,DecoderHost), §3.3:DuplicateHandleSessionDecoder), §3.4:desktop.decoder_stopped("Desktop decoder stopped")ClipboardOfferonly re-encodes the pixels; nothing is decoded in RemoteHub any more.RemoteHub.exe --decoder-check <file>: starts the decoder as a session does, decodes a test stream and images, runs the sandbox probes and writes the results as JSON. The lab uses it, and so can support.build-installer.ps1publishes the decoder self-contained into RemoteHub's folder, on the same runtime, and signs it. A release now uses 5 eSigner signings (6 with the credential provider), one more than before. Development builds copy it next toRemoteHub.exe.Measured in the spike and in a self-contained publish: 1080p frames cost the same as decoding in-process (9.4 ms against 9.9 ms), the decoder starts in about 0.3 s, and each one uses 21 MB private memory at 640 × 360, 42 MB at 1080p and 112 MB at 4K.
Tests
DecoderProcessTests(14):DeviceImageTestsandClipboardOfferTests: updated for decoding through the process.SecretMemoryTests(from Passwords stay encrypted in memory; editors no longer show stored ones #70): now runs alone, after all other tests. It dumps its own process, and with the decoder tests running beside it a suspended thread held a lock the dump needed, which deadlocked the whole run. Dumping from outside isn't possible with .NET'screatedumpsince .NET 8.SEC-DEC.Tests.ps1, device VMs: Windows 11 and Server): normaluser runs--decoder-checkon the installed build. It needs an AppContainer, the pictures shown, the images decoded and every probe blocked. Not run in the lab yet (marked ◐).RecordingTests.FrameGrabber_CapturesHostedChildWindowsAndCoveredContent; they fail the same way on main's build on this PC right now (the desktop session's state) and passed in the run before.--decoder-check.Not in this PR
SEC-DEC-01 … 05 need a rogue agent in the lab harness: a fake hostile device that RemoteHub has pinned, which sends malformed video and images, hostile file names, floods and a hostile Hello. That comes next, in its own PR.
Docs
decoder-isolation-design.md: status, §2, §3.3, §6, §10 and a new §12 "As built".security-test-lab-design.md: T9.1 and T9.2 are now mitigated, and a SEC-DEC-06 row.credential-provider-design.mdand therelease.ymlcomment: the signing count.