T09 · Insecure Skill Coding Practices
- Location
adapters/coze_client.py:1200- Finding
Remote Tool Cards Can Trigger Unauthorized Upload of Arbitrary Local Files
- Content
View full analysis
Vulnerability Details
File Location:
adapters/coze_client.py, lines 1200, 1457–1469, and 1634
Vulnerability Type: Remote-controlled arbitrary local file disclosure
Risk Level: HighVulnerable Code:
python out["tool_cards"] = _json_or_obj(outer.get("tool_cards")) or []python local_files = params.get("_local_files") or [] put_urls = params.get("_put_urls") or {} refs = [] for item in local_files: lp = item if isinstance(item, str) else item.get("path") purp = None if isinstance(item, str) else item.get("purpose") if not lp: continue ref = _upload_file(lp, purpose=purp) url = put_urls.get(lp) or put_urls.get(os.path.basename(lp)) if url: with open(os.path.abspath(lp), "rb") as f: _http_put(url, f.read(), headers={"Content-Type": ref["mime"]}) ref["put_url"] = url refs.append(ref)python cards = resp.get("tool_cards") or [] if cards: outs = execute_tool_cards(cards, out_dir=out_dir)Technical Analysis
parse_stage_response()acceptstool_cardsfrom the remote Coze response.run_pipeline()then passes those cards directly toexecute_tool_cards()without requiring user confirmation.For a
request_uploadcard, the remote response can populate:params["_local_files"], which identifies local paths to read.params["_put_urls"], which identifies destinations receiving those files.
The implementation converts each supplied path to an absolute path, reads the complete file, and transmits it using
_http_put(). There is no canonical path allowlist, workspace containment check, opaque client-side file identifier, or confirmation tied to the specific file and destination.Although the Skill discloses that analysis data is sent to Coze, that authorization does not grant the remote service permission to select unrelated files from the local filesystem.
Attack Path
- The user starts a workflow through
run_pipeline(). - The client ...[truncated 1151 chars]
- Remediation
View remediation
Remediation Suggestions
- Never accept raw local filesystem paths from remote tool cards.
- Maintain a client-side registry of files explicitly selected by the user and expose only opaque file IDs to the remote service.
- Resolve each selected path canonically and require it to remain inside an explicitly approved workspace or upload directory.
- Require file-specific user confirmation showing:
- Canonical local path
- File size and type
- Destination hostname
- Purpose of the upload
- Restrict upload URLs to authenticated HTTPS origins on an explicit allowlist.
- Reject redirects to unapproved origins.
- Apply file-size and file-type limits before reading data.
- Ensure the remote service cannot introduce new local paths during pipeline continuation.
- Record a security audit event for every approved upload without logging file contents or credentials.
