[deep-review] C6: Deep-link named pipe has no PipeSecurity / PipeOptions.CurrentUserOnly
Summary
The single-instance deep-link forwarder uses NamedPipeServerStream("OpenClawTray-DeepLink", PipeDirection.In) with no PipeSecurity argument and no PipeOptions.CurrentUserOnly. The pipe inherits default ACLs, which on Windows allow any same-user process to connect. There is no authentication on the pipe message itself either — any same-user process can submit a single line of UTF-8 that the tray parses as a deep-link URI and dispatches via DeepLinkHandler.Handle.
Where
src/OpenClaw.Tray.WinUI/App.xaml.cs:4246-4282(StartDeepLinkServer)src/OpenClaw.Tray.WinUI/App.xaml.cs:4338-4352(SendDeepLinkToRunningInstance— the client that writes to the pipe)
Why it matters
Combined with C5 (message-injection via deep links), any same-user process can drive the user's agent. Even without C5, deep links can trigger restart-ssh-tunnel, copy-debug-bundle (which copies redacted but still informative diagnostic state to the clipboard), open-settings, and ~25 other actions.
Compare:
AppInstance.FindOrRegisterForKey(the WinAppSDK API): redirected activation has the OS as the trusted intermediary; the activator's claims are present.PipeOptions.CurrentUserOnly: hardens the pipe to refuse cross-user connections (still permits same-user, but at least the API author opted in deliberately).
The codebase already uses AppInstance.FindOrRegisterForKey for MSIX protocol activation — the named-mutex + pipe pattern is inherited inertia from the WinForms era.
Proposed fix
Short-term (small):
- Construct
NamedPipeServerStreamwithPipeOptions.CurrentUserOnly. - Add an explicit
PipeSecuritygranting Read + Connect only to the current user SID. - Add a token-based authentication step: tray writes a per-session pipe token to a sibling file with ACL-restricted DACL; pipe clients send the token as the first line and tray validates before dispatching.
Long-term (medium):
- Replace named-mutex + pipe with
Microsoft.Windows.AppLifecycle.AppInstance.FindOrRegisterForKey. The codebase already uses this API for protocol activation; using it for single-instance forwarding would eliminate the bespoke pipe entirely.
Severity
Critical — local privilege escalation from any same-user process to the tray's trust boundary.
Closing this one-off deep-review issue as consolidated, not necessarily fixed. The useful signal is preserved in #372: named-pipe security remains useful signal, but should be verified and fixed fresh. We will take these one at a time from #372 after verifying against current master instead of keeping the issue list flooded.