Summary
PinchTab versions 0.8.3 through 0.8.5 contain a security-policy bypass that allows arbitrary JavaScript execution via the POST /wait and POST /tabs/{id}/wait endpoints when using fn mode.
Even when security.allowEvaluate is disabled, an authenticated caller holding the server token can supply a JavaScript function body that is embedded into executable code and run in the browser tab context.
Affected context
This issue affects PinchTab deployments that:
- Run versions
v0.8.3throughv0.8.5 - Expose the HTTP API to AI agents, automation systems, or other services that hold the server token
- Rely on the
security.allowEvaluatesetting (disabled by default) to prevent direct JavaScript execution
In this context, the /wait and /tabs/{id}/wait endpoints accept a mode parameter, and when fn mode is used, user-controlled JavaScript is evaluated in the Chrome tab.
Exploit preconditions
- Attack surface: PinchTab HTTP API, specifically:
POST /waitinfnmodePOST /tabs/{id}/waitinfnmode- Required access: Valid server token or equivalent authenticated API access; there is no unauthenticated vector described.
- Trigger point: Sending a
POSTrequest usingfnmode with an attacker-controlledfnexpression whilesecurity.allowEvaluateis disabled or expected to block evaluation. - Why exploitation is possible: The implementation embeds the user-supplied
fnexpression directly into a JavaScript snippet and evaluates it in the browser context, but fails to enforce thesecurity.allowEvaluatepolicy on the/waitendpoints, even though that policy is correctly enforced on/evaluate. This creates a policy enforcement gap (CWE-693) and insufficient access control over code execution (CWE-284).
Why this happens
The underlying bug is a form of code injection (CWE-94) combined with inconsistent security policy enforcement (CWE-693):
- The
/waitand/tabs/{id}/waitendpoints support afnmode where a client supplies a JavaScript function body. - This function body is treated as trusted and concatenated into an executable JavaScript context without appropriate validation or restriction.
- While the
/evaluateendpoint checks thesecurity.allowEvaluateflag before executing arbitrary JavaScript, thefnmode of/waitdoes not apply the same guard.
Conceptually, this reflects an insecure pattern where different code paths that perform the same high-risk operation (remote code execution in a browser tab) are not consistently protected by the same policy boundary and authorization checks. The application assumes all code evaluation flows are guarded, but an alternate path is left unprotected.
Potential impact
- Execution of arbitrary JavaScript in the target Chrome tab for any caller with the PinchTab server token
- Manipulation of active web sessions, including DOM modification, form submission, or simulated user actions
- Access to sensitive data available to the tab, such as page content, DOM-stored secrets, or local application state
- Potential abuse of the browser as an automation or attack pivot (e.g., triggering actions in authenticated web apps open in the tab)
- Violation of operator expectations and policies that rely on
security.allowEvaluatebeing a strong boundary
General mitigation guidance
Until a patched release is available, operators and developers can focus on reducing exposure of code-evaluation capabilities and tightening access boundaries:
- Consolidate policy enforcement for code execution paths: Ensure that all endpoints and modes that can execute user-controlled code use a single, centralized authorization and policy check (e.g., always consult
security.allowEvaluateor an equivalent capability flag). - Restrict API credentials and trust boundaries: Treat the PinchTab server token as a high-privilege secret. Limit which agents or services receive it, and segregate tokens by trust level (e.g., separate tokens for read-only navigation vs. code execution workflows).
- Disable or restrict
fn-style dynamic code modes where not needed: Prefer non-code-based waiting or synchronization mechanisms (e.g., time-based waits, DOM selectors, or ready-state checks) instead of arbitrary function execution. - Apply least-privilege configuration: Run PinchTab in environments that minimize the risk from browser compromise (e.g., dedicated profiles, restricted network access from the browser, constrained data access).
- Introduce higher-level policy controls: Wrap PinchTab behind an API gateway or mediator that filters or disallows high-risk operations (such as arbitrary
fnpayloads) for less-trusted agents.
How teams detect issues like this
Detection can focus on both code-level issues and runtime behavior:
- Static analysis and code review:
- Identify all code paths that assemble or evaluate JavaScript from user-controlled input (e.g., string concatenation into scripts,
eval-like constructs, or remote debugging protocol calls). - Verify that each such path consistently consults the same security policy or configuration flag before execution.
- Look for duplicated logic around code evaluation where one path references
security.allowEvaluateand others do not. - Configuration and policy audits:
- Review service configurations to identify deployments that rely on
security.allowEvaluatefor risk reduction. - Confirm that downstream consumers (AI agents, automation frameworks) are not sending
fn-mode requests in contexts where evaluation is meant to be disabled. - Runtime monitoring and logging:
- Enable detailed logging for calls to
/wait,/tabs/{id}/wait, and/evaluate, including the mode used and whether the policy was applied. - Create alerts for unexpectedly frequent or complex
fn-mode invocations, especially whensecurity.allowEvaluateis configured as disabled. - Automated security review tools:
- Use application security testing tools or custom linters that flag any usage of dynamic code execution APIs that are not protected by the standard policy enforcement routine.

