HLE: allow rpcrt4.dll in default host policy #510

Closed
pushkarreddyy wants to merge 1 commit from upstream-pr/510 into main
pushkarreddyy commented 2026-11-24 04:20:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:20:26Z.


Problem

During startup and runtime, titles importing RPC and UUID functionality (such as UuidCreate) cause the loader to log:

WARN victory_hle::modules::kernel: a host DLL outside the host policy: refused dll="rpcrt4.dll"

as reported in #417. On Windows PC and console, standard RPC runtime functions live in rpcrt4.dll.

Fix

Add "rpcrt4.dll" to HostPolicy::default().allow, allowing standard host RPC/UUID functions to resolve. Added unit test host_policy_allows_rpcrt4.

No game files used.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6574536272 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/510). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T04:20:26Z. --- ## Problem During startup and runtime, titles importing RPC and UUID functionality (such as `UuidCreate`) cause the loader to log: ``` WARN victory_hle::modules::kernel: a host DLL outside the host policy: refused dll="rpcrt4.dll" ``` as reported in #417. On Windows PC and console, standard RPC runtime functions live in `rpcrt4.dll`. ## Fix Add `"rpcrt4.dll"` to `HostPolicy::default().allow`, allowing standard host RPC/UUID functions to resolve. Added unit test `host_policy_allows_rpcrt4`. No game files used.
pushkarreddyy commented 2026-11-24 06:55:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T04:50:52Z.


### Technical Verification & Implementation Details

Context & Root Cause

In crates/victory-hle/src/host.rs, DEFAULT_HOST_DLLS lists system DLLs safe for host passthrough when running in the default host policy. Previously, only ws2_32.dll and bcrypt.dll were included. Windows RPC runtime (rpcrt4.dll) is standard on Windows and required by system services and game titles for COM/RPC operations, UUID generation (UuidCreate), and object marshalling. Without it, symbol resolution fails when games call RPC functions.

Changes & Diff

  • Added "rpcrt4.dll" to DEFAULT_HOST_DLLS.
  • Added unit test default_policy_allows_rpcrt4 testing case-insensitive matching ("RPCRT4.DLL").

Git Log Line & Verification

ext 756a1f0 HLE: allow rpcrt4.dll in default host policy crates/victory-hle/src/host.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+)

  • Passes cargo xtask policy (Rule #1 compliance, zero game assets).
  • Formatted with rustfmt --edition 2024.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7122392239 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/510#issuecomment-7122392239). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T04:50:52Z. --- ### Technical Verification & Implementation Details #### Context & Root Cause In `crates/victory-hle/src/host.rs`, `DEFAULT_HOST_DLLS` lists system DLLs safe for host passthrough when running in the default host policy. Previously, only `ws2_32.dll` and `bcrypt.dll` were included. Windows RPC runtime (`rpcrt4.dll`) is standard on Windows and required by system services and game titles for COM/RPC operations, UUID generation (`UuidCreate`), and object marshalling. Without it, symbol resolution fails when games call RPC functions. #### Changes & Diff - Added `"rpcrt4.dll"` to `DEFAULT_HOST_DLLS`. - Added unit test `default_policy_allows_rpcrt4` testing case-insensitive matching (`"RPCRT4.DLL"`). #### Git Log Line & Verification ` ext 756a1f0 HLE: allow rpcrt4.dll in default host policy crates/victory-hle/src/host.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) ` - Passes `cargo xtask policy` (Rule #1 compliance, zero game assets). - Formatted with `rustfmt --edition 2024`.
pushkarreddyy commented 2026-11-24 06:56:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T06:24:02Z.


### Call for Testing & Maintainer Review
Community members testing game initialization or HLE modules on Windows 10/11: verification and feedback on this PR is warmly welcome!

  • Rule #1 asset policy compliant (cargo xtask policy passing).
  • Formatted with Rust 2024.

@Marvisak: Ready for maintainer review and merge when convenient!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123893051 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/510#issuecomment-7123893051). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T06:24:02Z. --- ### Call for Testing & Maintainer Review Community members testing game initialization or HLE modules on Windows 10/11: verification and feedback on this PR is warmly welcome! - Rule #1 asset policy compliant (`cargo xtask policy` passing). - Formatted with Rust 2024. @Marvisak: Ready for maintainer review and merge when convenient!
upstream-sync closed this pull request 2026-11-24 08:02:19 +00:00
mercuryVM commented 2026-11-24 08:02:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T07:16:15Z.

Review: CHANGES_REQUESTED


Tested 756a1f0 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).

The change does what it says, but allowing rpcrt4.dll wholesale widens the network surface. I'd rather not take it as is.

  • ws2_32.dll and winhttp.dll are allowed only because modules::net overrides the title's imports from them and refuses off-machine traffic (the comment on the ws2_32 line says so). That override only catches the title's own import table.
  • rpcrt4.dll brings the RPC client runtime: RpcStringBindingCompose/RpcBindingFromStringBinding with ncacn_ip_tcp or ncacn_http, then calls. rpcrt4 opens those sockets through its own ws2_32 imports, which modules::net never sees. With this change, a title RPC call to a remote endpoint would bypass the loopback-only rule.
  • ole32 is already allowed and can in principle reach DCOM the same way, so the hole isn't brand new. Still, adding the RPC runtime directly makes it the easy path.

Suggested alternative for #417: implement the few functions titles actually import from rpcrt4 as HLE (UuidCreate → BCryptGenRandom with the version 4 bits set, UuidToStringA/W, RpcStringFreeA/W). Refuse the rest, as today. If the full DLL really is needed, add a comment on this line noting the bypass and that modules::net does not cover it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6035134940 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/510#pullrequestreview-6035134940). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T07:16:15Z. **Review:** CHANGES_REQUESTED --- Tested 756a1f0 on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (265 passed, 0 failed). The change does what it says, but allowing `rpcrt4.dll` wholesale widens the network surface. I'd rather not take it as is. - `ws2_32.dll` and `winhttp.dll` are allowed only because `modules::net` overrides the title's imports from them and refuses off-machine traffic (the comment on the `ws2_32` line says so). That override only catches the title's own import table. - `rpcrt4.dll` brings the RPC client runtime: `RpcStringBindingCompose`/`RpcBindingFromStringBinding` with `ncacn_ip_tcp` or `ncacn_http`, then calls. rpcrt4 opens those sockets through its own `ws2_32` imports, which `modules::net` never sees. With this change, a title RPC call to a remote endpoint would bypass the loopback-only rule. - `ole32` is already allowed and can in principle reach DCOM the same way, so the hole isn't brand new. Still, adding the RPC runtime directly makes it the easy path. Suggested alternative for #417: implement the few functions titles actually import from rpcrt4 as HLE (`UuidCreate` → `BCryptGenRandom` with the version 4 bits set, `UuidToStringA`/`W`, `RpcStringFreeA`/`W`). Refuse the rest, as today. If the full DLL really is needed, add a comment on this line noting the bypass and that `modules::net` does not cover it. AI-assisted (Claude Code).
pushkarreddyy commented 2026-11-24 08:02:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T07:32:18Z.


Thank you @mercuryVM for the thorough security and network architecture review!

You make a crucial architectural point: allowing rpcrt4.dll wholesale bypasses modules::net's loopback-only intercept on ws2_32.dll, opening remote socket paths via ncacn_ip_tcp and ncacn_http.

I completely agree that the proper, sandboxed approach is implementing the specific imported UUID functions in HLE (UuidCreate via BCryptGenRandom with RFC 4122 v4 bits, UuidToStringA/W, and RpcStringFreeA/W) rather than opening up the entire host RPC runtime.

Closing this PR in favor of targeted HLE implementations. Thanks again!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125100099 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/510#issuecomment-7125100099). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T07:32:18Z. --- Thank you @mercuryVM for the thorough security and network architecture review! You make a crucial architectural point: allowing `rpcrt4.dll` wholesale bypasses `modules::net`'s loopback-only intercept on `ws2_32.dll`, opening remote socket paths via `ncacn_ip_tcp` and `ncacn_http`. I completely agree that the proper, sandboxed approach is implementing the specific imported UUID functions in HLE (`UuidCreate` via `BCryptGenRandom` with RFC 4122 v4 bits, `UuidToStringA`/`W`, and `RpcStringFreeA`/`W`) rather than opening up the entire host RPC runtime. Closing this PR in favor of targeted HLE implementations. Thanks again!

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!510
No description provided.