Back to skill

Security audit

opencli-adapter-author

Security checks for vulnerabilities and agentic risk

Overview

This is a real adapter-authoring workflow, but it gives agents broad access to browser session credentials and captured private responses without enough scoping or consent guardrails.

Install only if you are comfortable letting the agent work inside active browser sessions for sites you are authorized to inspect. Avoid using it on sensitive personal, financial, or enterprise accounts unless you can supervise what cookies, tokens, response bodies, and fixtures are captured; clear ~/.opencli caches and fixtures after use.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
references/api-discovery.md:205
Finding
Broad Enumeration of Browser Cookies and Storage Credentials<![CDATA[ ## Vulnerability Details **File Location**: `references/api-discovery.md`, lines 205-220 **Vulnerability Type**: Excessive credential discovery **Risk Level**: Medium ### Vulnerable Code ```bash opencli browser eval "document.cookie.split('; ').reduce((o,x)=>{const[k,v]=x.split('=');o[k]=v;return o},{})" ``` ```bash opencli browser eval "Object.keys(localStorage).map(k=>k+' => '+localStorage.getItem(k).slice(0,50))" ``` ### Technical Analysis The discovery workflow enumerates every script-readable cookie and returns every local-storage key together with the first 50 characters of its value. It does not initially restrict access to known authentication keys such as a specific CSRF token or session-cookie name. This violates least-privilege principles because adapter discovery normally requires identifying and using only the credential associated with the selected endpoint. The output may include unrelated session identifiers, bearer tokens, personal preferences, tenant identifiers, or credentials belonging to other applications hosted under the same origin. Because these values are returned through `opencli browser eval`, they may also enter terminal output, agent context, conversation logs, or diagnostic records. ### Attack Path 1. A user opens an authenticated target site in the browser session. 2. The agent encounters an authenticated API and follows the token-discovery procedure. 3. The cookie command returns all non-HttpOnly cookies for the current document. 4. The storage command returns every local-storage key and a portion of every value. 5. Unrelated credentials become visible to the agent and may be retained in tool output or logs. 6. A malicious or compromised adapter-authoring process could reuse the exposed values outside the intended API request. ### Impact Assessment The exposed scope is limited to cookies accessible to page JavaScript and storage associated with the current origin. HttpOnly cookies are not exposed by the first ...[truncated 388 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Enumerate cookie and storage **names only** during initial discovery. 2. Retrieve a value only after the required credential name has been identified from a target request. 3. Add explicit allowlists for expected names such as `csrfToken` or a site-specific session token. 4. Mask values in tool output, showing only a short fingerprint where comparison is necessary. 5. Do not print bearer tokens, JWTs, session identifiers, or complete cookie objects. 6. Prefer using credentials inside the target page context without returning their values to the agent. 7. Add a warning that browser evaluation output may be logged or retained. 8. Clear diagnostic output and caches immediately if credential values are accidentally displayed. ]]>

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
references/adapter-template.md:180
Finding
Cookie Adapter Template Collects and Forwards the Entire Domain Cookie Set<![CDATA[ ## Vulnerability Details **File Location**: `references/adapter-template.md`, lines 180-206 **Vulnerability Type**: Excessive credential collection and manual cookie forwarding **Risk Level**: Medium ### Vulnerable Code ```javascript const BASE = 'https://www.example.com'; const HOST = 'www.example.com'; const ROOT = '.example.com'; async function readCookie(page) { const seen = new Map(); for (const opts of [{ domain: HOST }, { domain: ROOT }]) { try { const cookies = await page.getCookies(opts); for (const c of cookies || []) { if (!seen.has(c.name)) seen.set(c.name, c.value); } } catch { /* try next domain */ } } return [...seen].map(([k, v]) => `${k}=${v}`).join('; '); } async function fetchHtml(url, { cookie, encoding = 'utf-8', headers = {} } = {}) { const resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0', 'Accept-Language': 'zh-CN,zh;q=0.9', Referer: `${BASE}/`, ...(cookie ? { Cookie: cookie } : {}), ...headers, }, redirect: 'follow', }); ``` ### Technical Analysis The template queries both the host and root-domain cookie stores, merges every returned cookie by name, serializes the complete set, and manually attaches it to a Node-side request. This approach does not limit collection to the authentication cookies required by the endpoint. It may include analytics identifiers, CSRF values, unrelated application sessions, feature flags, or cookies whose original path and subdomain restrictions would have prevented them from being sent by a normal browser request. Manual serialization also discards browser-enforced cookie attributes and selection behavior. The helper accepts a URL argument without independently verifying that its origin matches `BASE` or `HOST`. Although the supplied example uses a fixed same-origin URL, copied adapters could pass anothe ...[truncated 1148 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Change `readCookie` to accept an explicit allowlist of required cookie names. 2. Return only those allowlisted values rather than the complete domain cookie set. 3. Require an exact HTTPS origin and reject any URL whose origin does not equal the declared adapter origin. 4. Avoid forwarding root-domain cookies to a subdomain unless each cookie is explicitly required. 5. Preserve cookie path and expiry semantics where possible instead of constructing a universal header. 6. Disable automatic redirect following for authenticated requests, or validate every redirect destination before continuing. 7. Prevent caller-provided headers from overriding security-sensitive headers such as `Cookie`, `Host`, and `Authorization`. 8. Prefer browser-context requests when they can preserve native cookie-selection rules safely. 9. Document the exact credential names required by each adapter and fail closed when they are absent. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/api-discovery.md:50
Finding
Authenticated Network Response Bodies Are Persisted Without Mandatory Redaction<![CDATA[ ## Vulnerability Details **File Location**: `references/api-discovery.md`, lines 50-57 and 94-98 **Vulnerability Type**: Plaintext persistence of potentially sensitive response data **Risk Level**: Medium ### Relevant Commands and Storage Behavior ```bash opencli browser network ``` ```bash opencli browser network --detail <key> ``` The documented workflow states that network capture includes response bodies, status values, and content types. It also states that captures are persisted at: ```text ~/.opencli/cache/browser-network/<workspace>.json ``` with a default retention period of 24 hours. ### Technical Analysis The Skill supports authenticated adapters for private resources, including watchlists, viewing history, favorites, user timelines, and tenant-specific APIs. Running network discovery in such a session can therefore capture complete private response bodies. The capture is automatically persisted locally for later `--detail` access. The documentation does not require redaction before this cache is written, does not exclude authenticated responses, and does not specify encryption or restrictive file permissions. A separate fixture policy requires removing cookies, tokens, and personal fields before saving fixtures, but that policy does not cover this automatic network cache. Response bodies can themselves contain user identifiers, email addresses, private activity, tenant data, embedded access links, or reflected tokens. ### Attack Path 1. The user authenticates to a target site in the browser session. 2. The target page requests a private API resource. 3. The agent runs `opencli browser network`. 4. The tool captures the complete authenticated response body. 5. The capture is written to the workspace cache for up to 24 hours. 6. Another local process, later agent session, backup process, or user with access to the same account may read the cached private content. ### Impact Assessment The accessible data is limited to response b ...[truncated 317 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Disable full response-body persistence by default. 2. Persist only request metadata and response schemas unless the user explicitly opts in. 3. Exclude authenticated responses from caching unless they are explicitly selected. 4. Apply redaction before disk writes, including tokens, cookies, user identifiers, contact details, and private account fields. 5. Store cache files with owner-only permissions. 6. Provide a command to delete the current workspace capture immediately. 7. Use a shorter retention period for authenticated captures and delete them when adapter verification completes. 8. Clearly notify the user before capturing or retaining private response bodies. 9. Apply the same sanitization requirements used for fixtures to network-cache content. 10. Consider encrypted storage when complete authenticated bodies are genuinely required for debugging. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (16)

Ae1

High
Category
analysis-evasion
Content
| `references/adapter-template.md` | Step 9 文件结构 + 活例子 `convertible.js` |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ssd 3

High
Confidence
97% confidence
Finding
These sections provide step-by-step methods to extract and reuse authentication material from cookies, localStorage, session state, and JS bundles, including guidance for bypassing normal browser protections by reading from CDP cookie jars. In the context of adapter authoring for arbitrary sites, this materially enables credential misuse and unauthorized API access if applied to targets without clear permission.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The skill directly instructs the agent in Chinese ('你是要给一个站点写 adapter 的 agent') and the rest of the document is written in Chinese, which imposes a specific language/locale on operation. There is no indication that the user can opt into another language or that the constraint is justified as region-specific.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file’s instructional content is written as a directive in Chinese, establishing a single required language for the skill documentation/template without any opt-in or alternative locale. The policy allows fixed locale behavior only when clearly documented and justified, which is not present here.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The example request sets `Accept-Language: zh-CN,zh;q=0.9`, which forces a specific language/locale in network behavior. There is no indication that the user can choose the locale or that the locale restriction is required for a documented regional purpose.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The document explicitly instructs users to inspect authentication cookies and tokens from document.cookie, browser storage, and CDP cookie jars, but provides no guardrails about authorization, consent, secure handling, or redaction. In a skill for building adapters against third-party sites, this guidance can normalize credential harvesting and increase the chance that sensitive session material is copied, logged, or reused beyond its intended scope.

Ssd 4

Medium
Confidence
95% confidence
Finding
The fallback workflow escalates from observation to interception, culminating in installInterceptor-based man-in-the-middle style capture of responses when signatures cannot otherwise be obtained. That is bypass-oriented tradecraft: it teaches users to let the page authenticate and then siphon the protected response, which can defeat intended access controls and anti-automation measures.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The entire markdown file is written in Chinese and provides operational guidance without indicating that other languages are supported or that Chinese is required for a region-specific purpose. This creates a natural-language locale policy issue because users are implicitly forced into a specific language with no opt-in or alternative.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The playbook's operative instructions are written in Chinese and assume Chinese-language use, but there is no statement that the skill is region-specific or that users may opt into another language. This can violate language/locale policy when a skill imposes a specific language without user choice.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
Line L011 states "camelCase,全英文", which is a natural-language rule forcing a specific language for field names. The policy allows locale or language constraints only when the skill offers choice or clearly documents a justified region-specific need, which is not present here.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The file is entirely written as an instruction document in Chinese and does not indicate that language selection is optional or constrained by a documented regional requirement. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The document explicitly notes endpoints for watching history and favorites that require a logged-in session, but it gives no privacy warning, consent guidance, or data-minimization constraints. In the context of an adapter-authoring skill, this can normalize collection of highly sensitive behavioral data from authenticated accounts and make it easier for downstream adapters to access user activity without clear safeguards.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The documentation instructs adapter authors to perform authenticated browser-backed requests using cookies, including the identity-bearing `xq_a_token`, but does not warn that these requests may access user-specific data or operate in a logged-in context. In a skill designed to build adapters, this increases the chance of unintentionally collecting account-scoped data, exposing private watchlists or timelines, or normalizing unsafe handling of session credentials.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The markdown instructions are written entirely in Chinese and do not indicate that another language is available or that Chinese is a deliberate opt-in. Under the stated policy, forcing a specific language without user choice is a natural-language policy violation.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
This markdown file is written primarily in Chinese while also embedding English labels such as field names and section titles, but it does not state that the skill is intended only for Chinese-speaking users or offer any language/locale option. Under the language/locale policy, forcing a specific language without user opt-in can be a natural-language policy issue.

Natural-Language Policy Violations

Low
Confidence
98% confidence
Finding
The file’s instructional content is written entirely in Chinese and does not indicate that language selection is optional or limited to a China-specific audience. Under the stated policy, forcing a specific language without user opt-in is a natural-language locale policy violation.

Static analysis

No suspicious patterns detected.