browser-agent-automation-v1
22 rules · Keryn Software Licence · rules 0.8.0 · all packs
How to read a rule
- Severity
- How bad the finding is if it is real:
errorfails a default gate,warningandinfodo not. - Confidence
- P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
- False-positive risk
- low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
- Edge
- The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
- Taxonomy chips
- References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.
keryn.browseragent.model-output-to-page-navigation-js
Section titled “keryn.browseragent.model-output-to-page-navigation-js”error javascript, typescript data-flow rule playwright, puppeteer, cdp
A URL produced by the model (completion text, tool-call arguments, a tool parameter) is passed straight to the browser’s navigation. A prompt-injected or hallucinated URL then opens internal services, file:// paths or phishing pages inside the agent’s browser session, with whatever cookies and exposed functions that session carries. Resolve the URL, check its scheme and host against an allowlist, and navigate only after the check.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-918 CWE-441 LLM05 LLM06 ASI02 ASI01
Fix: Parse the model’s URL with new URL(), allow only http(s), compare the hostname with an explicit allowlist (or the task’s origin) and reject private and link-local address ranges before calling goto; log the navigation.
References: https://playwright.dev/docs/api/class-page#page-goto · https://pptr.dev/api/puppeteer.page.goto · https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-navigate
keryn.browseragent.model-output-to-page-navigation-py
Section titled “keryn.browseragent.model-output-to-page-navigation-py”error python data-flow rule playwright
A URL produced by the model (completion text, tool-call arguments, a tool parameter) is passed straight to the browser’s navigation. A prompt-injected or hallucinated URL then opens internal services, file:// paths or phishing pages inside the agent’s browser session, with whatever cookies and exposed functions that session carries. Resolve the URL, check its scheme and host against an allowlist, and navigate only after the check.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-918 CWE-441 LLM05 LLM06 ASI02 ASI01
Fix: Parse the model’s URL with urllib.parse, allow only http(s), compare the hostname with an explicit allowlist (or the task’s origin) and reject private and link-local address ranges before calling goto; log the navigation.
References: https://playwright.dev/python/docs/api/class-page#page-goto
keryn.browseragent.model-output-to-page-script-js
Section titled “keryn.browseragent.model-output-to-page-script-js”error javascript, typescript data-flow rule playwright, puppeteer, cdp
JavaScript or a script URL produced by the model is executed in the automation page (evaluate, addScriptTag, addInitScript, Runtime.evaluate). The model, and anything that injected into its context, then runs arbitrary code in the page with access to the page’s origin, storage and every function the host exposed. Keep page scripts as fixed functions in your code and pass model output only as a serialisable argument.
Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-94 CWE-95 LLM05 ASI05 ASI02
Fix: Call page.evaluate with a function literal defined in your source and pass model data as its argument (page.evaluate((v) => …, value)); never build the script body or a script URL from model text.
References: https://playwright.dev/docs/api/class-page#page-evaluate · https://pptr.dev/api/puppeteer.page.evaluate · https://pptr.dev/api/puppeteer.page.addscripttag · https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#method-evaluate
keryn.browseragent.model-output-to-page-script-py
Section titled “keryn.browseragent.model-output-to-page-script-py”error python data-flow rule playwright
JavaScript produced by the model is executed in the automation page (evaluate, add_script_tag, add_init_script). The model, and anything that injected into its context, then runs arbitrary code in the page with access to the page’s origin, storage and every function the host exposed. Keep page scripts as fixed strings in your code and pass model output only as the serialisable argument.
Confidence P0: exploitable as written. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
CWE-94 CWE-95 LLM05 ASI05 ASI02
Fix: Call page.evaluate with a fixed script and pass model data as its argument (page.evaluate(“v => …”, value)); never build the script body or a script URL from model text.
References: https://playwright.dev/python/docs/api/class-page#page-evaluate · https://playwright.dev/python/docs/api/class-page#page-add-script-tag
keryn.browseragent.model-output-to-page-html-js
Section titled “keryn.browseragent.model-output-to-page-html-js”warning javascript, typescript data-flow rule playwright, puppeteer
HTML produced by the model is rendered into the automation page with setContent. Script in that HTML runs in the page and can call every function the host exposed to it; a rendered page is also what screenshots and extracted text feed back to the model. Render model output as text, or sanitise it with an HTML sanitiser before setContent.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Escape the model’s text and insert it into a fixed template, or pass it through an HTML sanitiser (DOMPurify, sanitize-html) before page.setContent; do not expose host functions to a page that renders model HTML.
References: https://playwright.dev/docs/api/class-page#page-set-content · https://pptr.dev/api/puppeteer.page.setcontent
keryn.browseragent.model-output-to-page-html-py
Section titled “keryn.browseragent.model-output-to-page-html-py”warning python data-flow rule playwright
HTML produced by the model is rendered into the automation page with set_content. Script in that HTML runs in the page and can call every function the host exposed to it; a rendered page is also what screenshots and extracted text feed back to the model. Render model output as text, or sanitise it with an HTML sanitiser before set_content.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).
Fix: Escape the model’s text and insert it into a fixed template, or pass it through an HTML sanitiser (bleach, nh3) before page.set_content; do not expose host functions to a page that renders model HTML.
References: https://playwright.dev/python/docs/api/class-page#page-set-content
keryn.browseragent.page-content-in-system-prompt-js
Section titled “keryn.browseragent.page-content-in-system-prompt-js”warning javascript, typescript data-flow rule playwright, puppeteer, anthropic, openai, vercel-ai-sdk
Text or HTML read from a web page (content, innerText, evaluate, $eval) is placed in the model’s system prompt or instructions. Anything written on that page then speaks with system authority to the agent: hidden text can redirect its goal, exfiltrate the task context or trigger tool calls. Put page content in a user-role message inside a clearly delimited data block and keep the system prompt fixed.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Keep system/instructions constant; pass page text as a user message wrapped in explicit delimiters (“<page_content>” …), tell the model it is untrusted data, truncate it, and never let it carry tool-call permissions.
References: https://playwright.dev/docs/api/class-page#page-content · https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/system-prompts · https://genai.owasp.org/llmrisk/llm01-prompt-injection/
keryn.browseragent.page-content-in-system-prompt-py
Section titled “keryn.browseragent.page-content-in-system-prompt-py”warning python data-flow rule playwright, anthropic, openai, google-genai, langchain
Text or HTML read from a web page (content, inner_text, evaluate) is placed in the model’s system prompt or instructions. Anything written on that page then speaks with system authority to the agent: hidden text can redirect its goal, exfiltrate the task context or trigger tool calls. Put page content in a user-role message inside a clearly delimited data block and keep the system prompt fixed.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Keep system/instructions constant; pass page text as a user message wrapped in explicit delimiters, tell the model it is untrusted data, truncate it, and never let it carry tool-call permissions.
References: https://playwright.dev/python/docs/api/class-page#page-content · https://genai.owasp.org/llmrisk/llm01-prompt-injection/
keryn.browseragent.browser-launch-no-sandbox-js
Section titled “keryn.browseragent.browser-launch-no-sandbox-js”warning javascript, typescript playwright, puppeteer, chromium
The automation browser is launched with the Chromium sandbox disabled (–no-sandbox / –disable-setuid-sandbox). A renderer exploit on any page the agent visits then runs as the host process, with the agent’s credentials and files. Run the browser with the sandbox on; in containers, use a user namespace or a seccomp profile instead of disabling it.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: Remove –no-sandbox and –disable-setuid-sandbox from the launch args; run as a non-root user (the sandbox refuses root), and in Docker use the official Playwright image or a seccomp profile that allows user namespaces.
References: https://chromium.googlesource.com/chromium/src/+/main/docs/design/sandbox.md · https://pptr.dev/troubleshooting · https://playwright.dev/docs/api/class-browsertype#browser-type-launch
keryn.browseragent.browser-launch-no-sandbox-py
Section titled “keryn.browseragent.browser-launch-no-sandbox-py”warning python playwright, chromium
The automation browser is launched with the Chromium sandbox disabled (–no-sandbox / –disable-setuid-sandbox or chromium_sandbox=False). A renderer exploit on any page the agent visits then runs as the host process, with the agent’s credentials and files. Run the browser with the sandbox on; in containers, use a user namespace or a seccomp profile instead of disabling it.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: Remove –no-sandbox and –disable-setuid-sandbox from args and keep chromium_sandbox at its default; run as a non-root user, and in Docker use the official Playwright image or a seccomp profile that allows user namespaces.
References: https://chromium.googlesource.com/chromium/src/+/main/docs/design/sandbox.md · https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch
keryn.browseragent.browser-launch-disable-web-security-js
Section titled “keryn.browseragent.browser-launch-disable-web-security-js”error javascript, typescript playwright, puppeteer, chromium
The automation browser is launched with –disable-web-security, which turns off the same-origin policy. Any page the agent visits can then read responses from every other origin the browser can reach, including logged-in internal sites and localhost services, and hand them to the model. Keep the same-origin policy on and use route interception or a proxy for the specific cross-origin need.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: grants authority is given or left unchecked.
CWE-346 LLM06 LLM02 ASI02 ASI03
Fix: Remove –disable-web-security (and –disable-site-isolation-trials); for a cross-origin fetch use page.route, a server-side proxy or the API directly from the host process.
References: https://playwright.dev/docs/api/class-browsertype#browser-type-launch · https://pptr.dev/api/puppeteer.launchoptions
keryn.browseragent.browser-launch-disable-web-security-py
Section titled “keryn.browseragent.browser-launch-disable-web-security-py”error python playwright, chromium
The automation browser is launched with –disable-web-security, which turns off the same-origin policy. Any page the agent visits can then read responses from every other origin the browser can reach, including logged-in internal sites and localhost services, and hand them to the model. Keep the same-origin policy on and use route interception or a proxy for the specific cross-origin need.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: grants authority is given or left unchecked.
CWE-346 LLM06 LLM02 ASI02 ASI03
Fix: Remove –disable-web-security (and –disable-site-isolation-trials); for a cross-origin fetch use page.route, a server-side proxy or the API directly from the host process.
References: https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch
Try it: a snippet that triggers this rule
Written for this page, not taken from any project. Save it as scraper/session.py and scan it with keryn scan scraper --verbose; the finding below appears.
from playwright.sync_api import sync_playwright
def open_dashboard(url: str) -> str: with sync_playwright() as p: browser = p.chromium.launch(headless=True, args=["--disable-web-security", "--window-size=1280,900"]) page = browser.new_page() page.goto(url) title = page.title() browser.close() return titleChecked with Keryn’s browser engine when this page was built: it reports keryn.browseragent.browser-launch-disable-web-security-py at line 6 (error, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.
keryn.browseragent.browser-ignore-https-errors-js
Section titled “keryn.browseragent.browser-ignore-https-errors-js”warning javascript, typescript playwright, puppeteer
The automation browser accepts invalid TLS certificates (ignoreHTTPSErrors / acceptInsecureCerts). An agent that browses with this setting can be redirected to a spoofed site by anyone on the network path, and every credential it types or cookie it carries goes to the impostor. Keep certificate validation on; trust a specific test CA instead.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: Drop ignoreHTTPSErrors / acceptInsecureCerts; install the test CA in the browser profile (or use the –ignore-certificate-errors-spki-list flag with the pinned SPKI hash) when a local service must be reached over a self-signed certificate.
References: https://playwright.dev/docs/api/class-browser#browser-new-context-option-ignore-https-errors · https://pptr.dev/api/puppeteer.launchoptions
keryn.browseragent.browser-ignore-https-errors-py
Section titled “keryn.browseragent.browser-ignore-https-errors-py”warning python playwright
The automation browser accepts invalid TLS certificates (ignore_https_errors=True). An agent that browses with this setting can be redirected to a spoofed site by anyone on the network path, and every credential it types or cookie it carries goes to the impostor. Keep certificate validation on; trust a specific test CA instead.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
Fix: Drop ignore_https_errors; install the test CA in the browser profile when a local service must be reached over a self-signed certificate.
References: https://playwright.dev/python/docs/api/class-browser#browser-new-context-option-ignore-https-errors
keryn.browseragent.browser-agent-uses-personal-profile-js
Section titled “keryn.browseragent.browser-agent-uses-personal-profile-js”warning javascript, typescript playwright, puppeteer
The automation browser is started on a real user profile directory (Chrome, Chromium, Brave or Edge under the user’s Library / AppData / .config). The agent then browses with the owner’s logged-in sessions, saved passwords and extensions, so a prompt-injected page can act as the owner on any site and read whatever those sessions can. Give the agent a dedicated, empty profile and log in to only what the task needs.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-522 CWE-250 LLM06 LLM02 ASI03 ASI02
Fix: Point userDataDir / launchPersistentContext at a directory created for the agent (or use an ephemeral context) and provision only the sessions the task needs; never the default Chrome profile.
References: https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context · https://pptr.dev/api/puppeteer.launchoptions
keryn.browseragent.browser-agent-uses-personal-profile-py
Section titled “keryn.browseragent.browser-agent-uses-personal-profile-py”warning python playwright, browser-use
The automation browser is started on a real user profile directory (Chrome, Chromium, Brave or Edge under the user’s Library / AppData / .config). The agent then browses with the owner’s logged-in sessions, saved passwords and extensions, so a prompt-injected page can act as the owner on any site and read whatever those sessions can. Give the agent a dedicated, empty profile and log in to only what the task needs.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: grants authority is given or left unchecked.
CWE-522 CWE-250 LLM06 LLM02 ASI03 ASI02
Fix: Point launch_persistent_context / user_data_dir at a directory created for the agent (or use an ephemeral context) and provision only the sessions the task needs; never the default Chrome profile.
References: https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-persistent-context · https://docs.browser-use.com/cloud/quickstart
keryn.browseragent.browser-agent-attaches-to-live-browser-js
Section titled “keryn.browseragent.browser-agent-attaches-to-live-browser-js”warning javascript, typescript playwright, puppeteer, cdp
The agent attaches to an already running browser over the DevTools protocol (connectOverCDP, puppeteer.connect, or a –remote-debugging-port launch flag). That browser is usually the owner’s, with every logged-in session, and the debugging port has no authentication: any local process can drive it too. Launch a dedicated browser for the agent; if a CDP endpoint is unavoidable, bind it to localhost, keep the port private and close it when the task ends.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another.
CWE-306 CWE-250 LLM06 ASI03 ASI02
Fix: Prefer launch() with a dedicated profile; when attaching is required, start the target browser with –remote-debugging-address=127.0.0.1 and a random port, never expose it beyond the host, and never attach to the owner’s daily browser.
References: https://playwright.dev/docs/api/class-browsertype#browser-type-connect-over-cdp · https://pptr.dev/api/puppeteer.connectoptions · https://chromedevtools.github.io/devtools-protocol/
keryn.browseragent.browser-agent-attaches-to-live-browser-py
Section titled “keryn.browseragent.browser-agent-attaches-to-live-browser-py”warning python playwright, browser-use, cdp
The agent attaches to an already running browser over the DevTools protocol (connect_over_cdp, a cdp_url, or a –remote-debugging-port launch flag). That browser is usually the owner’s, with every logged-in session, and the debugging port has no authentication: any local process can drive it too. Launch a dedicated browser for the agent; if a CDP endpoint is unavoidable, bind it to localhost, keep the port private and close it when the task ends.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another.
CWE-306 CWE-250 LLM06 ASI03 ASI02
Fix: Prefer launch() with a dedicated profile; when attaching is required, start the target browser with –remote-debugging-address=127.0.0.1 and a random port, never expose it beyond the host, and never attach to the owner’s daily browser.
References: https://playwright.dev/python/docs/api/class-browsertype#browser-type-connect-over-cdp · https://docs.browser-use.com/cloud/quickstart
keryn.browseragent.host-function-exposed-to-page-js
Section titled “keryn.browseragent.host-function-exposed-to-page-js”warning javascript, typescript playwright, puppeteer
A host function is exposed to page JavaScript (exposeFunction / exposeBinding). Every page the agent visits, including ones a prompt-injected URL chose, can call it with arbitrary arguments; if it touches files, shells, secrets or the model, the page now does too. Expose nothing to untrusted pages, or expose a narrow function that validates its arguments and checks the calling frame’s origin.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Remove the exposure for agent browsing sessions, or use exposeBinding and check source.frame.url() against an allowlist before doing anything; validate every argument and never pass them to shells, file APIs or the model as instructions.
References: https://playwright.dev/docs/api/class-page#page-expose-function · https://playwright.dev/docs/api/class-browsercontext#browser-context-expose-binding · https://pptr.dev/api/puppeteer.page.exposefunction
keryn.browseragent.host-function-exposed-to-page-py
Section titled “keryn.browseragent.host-function-exposed-to-page-py”warning python playwright
A host function is exposed to page JavaScript (expose_function / expose_binding). Every page the agent visits, including ones a prompt-injected URL chose, can call it with arbitrary arguments; if it touches files, shells, secrets or the model, the page now does too. Expose nothing to untrusted pages, or expose a narrow function that validates its arguments and checks the calling frame’s origin.
Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk high: it finds a lead to confirm, so expect benign hits.
Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).
Fix: Remove the exposure for agent browsing sessions, or use expose_binding and check source[“frame”].url against an allowlist before doing anything; validate every argument and never pass them to shells, file APIs or the model as instructions.
References: https://playwright.dev/python/docs/api/class-page#page-expose-function · https://playwright.dev/python/docs/api/class-browsercontext#browser-context-expose-binding
keryn.browseragent.mcp-browser-server-attached-to-user-browser
Section titled “keryn.browseragent.mcp-browser-server-attached-to-user-browser”warning json mcp, playwright, claude-code, cursor, vscode
A browser MCP server is configured to drive the user’s own browser (–cdp-endpoint, –extension, or –user-data-dir on a real profile) rather than an isolated one. Every model turn can then act with the user’s logged-in sessions, and a prompt-injected page reaches the same accounts. Run the browser server isolated (–isolated, or a dedicated profile) and sign in to only the sites the task needs.
Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.
Edge inspected: calls one thing invokes another.
CWE-250 CWE-306 LLM06 ASI03 ASI02
Fix: Remove –cdp-endpoint / –extension and any –user-data-dir that names a daily-use profile; use –isolated with –storage-state for the sessions the task needs, or a profile directory created for the agent.
References: https://github.com/microsoft/playwright-mcp · https://code.claude.com/docs/en/mcp
keryn.browseragent.mcp-browser-server-sandbox-or-tls-off
Section titled “keryn.browseragent.mcp-browser-server-sandbox-or-tls-off”warning json mcp, playwright, claude-code, cursor, vscode
A browser MCP server is configured with the Chromium sandbox or TLS validation turned off (–no-sandbox, –ignore-https-errors). Pages the model navigates to run with host privileges or can be spoofed on the network path. Remove the flag; run as a non-root user and trust a specific CA instead.
Confidence P1: dangerous in context. False-positive risk low: an exact API or flag, so hits are almost always real.
Edge inspected: grants authority is given or left unchecked.
Fix: Drop –no-sandbox and –ignore-https-errors from the server’s args; run the MCP server as a non-root user and install the test CA in the agent’s browser profile when a self-signed local service is needed.
References: https://github.com/microsoft/playwright-mcp