You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[deep-review] C8: app.settings.set over MCP accepts arbitrary keys without validation #348
AppCapability exposes app.settings.set as a node capability. Reachable from both the gateway WS and the local MCP HTTP server, the command accepts arbitrary key/value pairs and forwards them to a delegate wired in App.xaml.cs. There is no allowlist of settings that may be remotely mutated. A local MCP caller with the bearer token can flip GatewayUrl, EnableMcpServer, UseLegacyWebChat, EnableNodeMode, or any other field on SettingsData.
Where
Capability surface: src/OpenClaw.Shared/Capabilities/AppCapability.cs (look for settings.set handler delegate)
The safeSettings allowlist set used elsewhere (e.g., gated UI editor): exists but not enforced on this code path.
Why it matters
Flipping GatewayUrl to an attacker-controlled URL with the user's saved bootstrap token completes a remote takeover. Flipping EnableMcpServer from off to on (or rotating the token via a misuse of the same surface) creates persistence.
This is the same pattern as the system.execApprovals.set defense-in-depth gap (see C7) — the capability's caller is implicitly trusted because the MCP token gates it, but the trust boundary is fragile.
Proposed fix
Introduce an allowlist of settings that may be mutated via app.settings.set. Reject anything outside the list with Error("Setting not remotely writable: {key}"). The existing safeSettings set used in the UI is a reasonable starting point.
Settings to keep writable: cosmetic toggles, notification preferences, capability enables that already have UI confirmations.
Settings to deny: GatewayUrl, BootstrapToken, Token, EnableMcpServer, EnableNodeMode, ScreenRecordingConsentGiven, anything in dpapi: prefix paths.
Add tests covering each rejected key.
Severity
High — defense-in-depth gap; combined with token compromise, enables takeover.
Closing this one-off deep-review issue as consolidated, not necessarily fixed. The useful signal is preserved in #372: MCP settings validation remains useful, but should be handled as one MCP hardening slice. We will take these one at a time from #372 after verifying against current master instead of keeping the issue list flooded.
Activity
shanselman commentedon May 18, 2026
Closing this one-off deep-review issue as consolidated, not necessarily fixed. The useful signal is preserved in #372: MCP settings validation remains useful, but should be handled as one MCP hardening slice. We will take these one at a time from #372 after verifying against current master instead of keeping the issue list flooded.