fix(network): scope Windows egress by socket owner - #3491
prekshivyas wants to merge 7 commits into
Conversation
NVBug 6783086 Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Resolve each accepted Windows proxy connection to its unique owning PID and executable before evaluating binary-scoped network policy. Fail closed when ownership or process identity cannot be established, and cover allowed and undeclared child processes with a real MXC regression.
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> (cherry picked from commit 32ea316deb6c83c157fdf2de4a2cdc3a7d2da1e3)
|
Combined Windows-NVBug qualification exposed and fixed a cross-PR compatibility regression with #3434. #3434 attaches immutable per-sandbox OCSF context to the former static Windows proxy identity; this PR replaces that identity with per-socket Windows process ownership. When both heads were merged, the audit-context methods still matched the removed Pushed:
Validation on native Windows ARM64:
This PR is now intentionally stacked on #3434. Once #3434 merges into |
shailendra-nv
left a comment
There was a problem hiding this comment.
Requesting changes for two authorization-correctness issues: the Windows identity cache can reuse a trusted digest after a same-length in-place rewrite with restored timestamps, and the TCP-table parser assumes a packed layout despite the Windows API documented padding. I also left an IPv6 scope-ID byte-order comment. Please address these with regression coverage and run the Windows MSVC gate before approval. The current status list has Branch Checks, E2E, GPU E2E, and Helm Lint, but no Windows MSVC check; the PR description also leaves x64 as expected coverage.
…ess-identity Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> # Conflicts: # Cargo.toml
Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com>
|
Addressed all three review threads in |
|
@shailendra-nv All requested updates are pushed, the addressed threads are resolved, and validation evidence is posted above. Could you please re-review? |
Summary
Fixes a Windows MXC authorization defect by authorizing each proxied TCP connection as the process that actually owns the workload-side socket.
The Windows host proxy previously evaluated every connection with one static identity:
command[0], captured when the sandbox started. As a result, a child process could inherit the entry command's allow grant, while a policy explicitly granting the child binary did not authorize it.Change
GetExtendedTcpTable(OWNER_PID_ALL)QueryFullProcessImageNameWBefore / after evidence
Environment: Yukon Windows ARM64; Rust 1.95; MXC
wxc-exec.exe0.8.0+7dac1a9 (ARM64).Pre-fix reproduction on unmodified
windowstipfb2980e077288b61ef03a2e6187e162d158526aa, usingcmd.exe /c curl.exe https://example.com/:curl.exe: denied with HTTP 403 / curl exit 22 /ExecFailed; test exit 101; scenario 0.63 scmd.exe: child curl succeeds; test exit 0; scenario 0.70 sThat inversion proves the proxy was using the static parent identity rather than the socket owner.
Post-fix commit
3a902900ed7d0d995b3e58ace3f5e0fe9bd32e80, rebased onto currentwindowsbase4f06e23cc8e4bfb48f78f43645771683f674fe2d:curl.exe: HTTPS succeeds and produces a non-empty responsecmd.exe: child curl is denied with HTTP 403 /ExecFailedVerification
cargo test -p openshell-supervisor-network --lib --target aarch64-pc-windows-msvc windows_process::tests -- --nocapture— 2 passedcargo test -p openshell-supervisor-network --lib --target aarch64-pc-windows-msvc per_sandbox_credentials_reject_missing_wrong_cross_and_duplicate_auth -- --nocapture— 1 passedcargo test -p openshell-driver-mxc --test wxc_exec_real --target aarch64-pc-windows-msvc pc_proxy_scopes_network_policy_to_socket_owner -- --ignored --test-threads=1 --nocapture— 1 passed, 1.04 smise run --jobs 1 pre-commiton the rebased tree — exit 0, 219.975 scargo fmt --all -- --checkand focused Windows ARM64 Clippy — passgit diff --check— passThe full Windows gate used the installed x64 Biome binary because Biome's native ARM64 executable crashes on this host, plus the official Z3 4.16.0 ARM64 release because the unauthenticated prebuilt download endpoint returned HTTP 403.
Security impact
This removes an authorization-broadening path: an allowed Windows entry process no longer lends its binary-scoped network permissions to arbitrary descendants. Identity failures deny the request; they do not fall back to entry-command or endpoint-only authorization.
Scope and residual risk
This is intentionally limited to Windows proxy process-identity binding. It does not normalize Windows path spelling or case; that separate behavior remains tracked separately. The latest base already contains the independent governed-proxy lifecycle fix.
Validation was performed on native Windows ARM64 with real ARM64 MXC. x64 compilation/CI remains expected coverage. A process that exits before its image can be queried is denied, which is the intended fail-closed behavior.