-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
safe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processingsecuritySecurity vulnerabilities and concernsSecurity vulnerabilities and concerns
Description
Summary
connect.ts reads tunnel_browser_url_template from ~/.spawn/history.json metadata and passes it directly to openBrowser() without URL validation. The tunnel_remote_port field is also used without range validation.
Inconsistency
Every other field read from the history file IS validated before use:
connection.ip→validateConnectionIP()connection.user→validateUsername()connection.server_name→validateServerIdentifier()connection.server_id→validateServerIdentifier()connection.launch_cmd→validateLaunchCmd()
But tunnel_browser_url_template (lines 195-198, 262-264 in connect.ts) skips validation entirely.
Attack Scenario
If an attacker can modify ~/.spawn/history.json (malware, shared system), they can set tunnel_browser_url_template to a phishing URL. When the user runs spawn enter openclaw or spawn dashboard, the CLI opens the malicious URL in their browser.
Proposed Fix
- Add
validateTunnelUrl(url)insecurity.ts— enforce URL starts withhttp://localhost:orhttp://127.0.0.1:only - Validate
tunnel_remote_portis a numeric string in range 1–65535 - Apply both in
cmdEnterAgent()andcmdOpenDashboard()inconnect.ts - Add test cases in the security-connection-validation test file
Affected Files
packages/cli/src/commands/connect.tslines ~195-198, ~262-264packages/cli/src/shared/security.ts
Discovered by refactor/security-auditor
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
safe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processingsecuritySecurity vulnerabilities and concernsSecurity vulnerabilities and concerns