T09 · Insecure Skill Coding Practices
- Location
REFERENCE.md:314- Finding
Persistent Authenticated Browser Profile Exposed Through a Fixed Chrome Debugging Interface
- Content
View full analysis
Vulnerability Details
File Location:
REFERENCE.md:314-382
Vulnerability Type: Persistent sensitive browser state combined with an exposed debugging interface and unrestricted downloads
Risk Level: MediumVulnerable Configuration
REFERENCE.md:314-318documents that browser profiles are deliberately preserved:text **Implementation Details**: - Calls `stagehand.close()` to clean up Playwright resources - Kills Chrome process if it was started by the CLI tool - Clears internal state variables - Does NOT delete `.chrome-profile/` directory (preserved for reuse)REFERENCE.md:354-368documents the persistent profile and fixed Chrome DevTools Protocol port:bash --remote-debugging-port=9222 --user-data-dir=.chrome-profile --window-position=-9999,-9999 --window-size=1280,720text **Arguments**: - `--remote-debugging-port`: Enables CDP on port 9222 - `--user-data-dir`: Persistent profile directory for session/cookie persistence - `--window-position`: Launches minimized off-screen - `--window-size`: Default window sizeREFERENCE.md:371-382documents unrestricted automatic downloads:typescript await client.send("Browser.setDownloadBehavior", { behavior: "allow", downloadPath: "./agent/downloads", eventsEnabled: true, })text **Behavior**: - Downloads start automatically (no dialog) - Files saved to `./agent/downloads/` - Download events can be monitored via CDPTechnical Analysis
The browser is configured to retain
.chrome-profile/, including session cookies and potentially other authenticated browser state, between automation runs. At the same time, Chrome is launched with its debugging protocol enabled on the predictable port9222.Chrome DevTools Protocol provides extensive control over an active browser, including page navigation, DOM inspection, script execution in page contexts, cookie access su ...[truncated 2399 chars]
- Remediation
View remediation
Remediation Suggestions
-
Use isolated, ephemeral profiles
- Create a unique browser profile directory for each task.
- Delete the profile securely when the task ends.
- Require explicit user consent before enabling cross-run session persistence.
-
Harden the debugging interface
- Bind CDP explicitly to the loopback interface.
- Select a random available port instead of fixed port
9222. - Do not expose the endpoint to containers, shared hosts, or network interfaces that do not require access.
- Validate that the endpoint belongs to the Chrome process launched by the Skill before connecting.
- Terminate the debugging endpoint immediately when automation completes.
-
Separate sensitive workflows
- Use dedicated profiles for each user, origin, and security context.
- Do not reuse a profile containing personal browsing data or unrelated authenticated sessions.
- Avoid storing passwords in the automation profile.
-
Restrict network access
- Block loopback, link-local, private-network, and cloud metadata destinations by default.
- Allow internal destinations only after explicit user approval.
- Enforce URL scheme and destination validation before navigation.
-
Control downloads
- Require confirmation before initiating downloads.
- Apply file-type and maximum-size restrictions.
- Save files in a per-task quarantine directory.
- Scan downloaded content before it is opened or moved elsewhere.
-
Improve auditability
- Include the referenced
src/cli.ts,package.json, and lockfile in the artifact. - Add tests verifying CDP binding, profile deletion, destination filtering, and download controls.
- Include the referenced
-
