T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/extract_chrome_bookmarks.py:70
- Finding
- Unvalidated Bookmark URLs Can Reach Downstream Fetch Operations## Vulnerability Details **File Location**: `scripts/extract_chrome_bookmarks.py:70-75`; downstream behavior specified in `SKILL.md:47-49` **Vulnerability Type**: Server-Side Request Forgery and unsafe URL scheme handling **Risk Level**: Medium **Vulnerable code in `scripts/extract_chrome_bookmarks.py`:** ```python if node.get("type") == "url": collected.append( { "title": node.get("name", "").strip(), "url": node.get("url", "").strip(), } ) ``` **Downstream instruction in `SKILL.md`:** ```markdown 4. Batch webpage summarization - Fetch page content for each URL (prefer full body text; fall back to title + short description on failure) - Recommended output structure: ``` ### Technical Analysis The extraction script copies bookmark URL values into its JSON output without validating their scheme, hostname, resolved address, port, or redirect destination. The documented workflow then directs the Agent to fetch every extracted URL. Because bookmark files can contain arbitrary URL strings, a malicious or compromised bookmark may identify loopback services, private-network systems, link-local cloud metadata endpoints, local files, or unsupported non-HTTP schemes. The precise exploitability depends on the downstream fetch tool and its own network and scheme restrictions. If that tool permits such destinations, the workflow creates a server-side request forgery path. ### Attack Path 1. An attacker adds a crafted URL to the target Chrome bookmark folder, or persuades the user to import a malicious bookmark set. 2. The user asks the Skill to summarize that folder. 3. `collect_urls()` copies the crafted value into `results[].urls[]` without validation. 4. The Agent follows `SKILL.md` and submits the URL to its webpage-fetching tool. 5. If the fetch tool permits the destination, it accesses an internal service, loopback endpoint, link-local metadata service, ...[truncated 652 chars]
- Remediation
- ## Remediation Suggestions - Parse each URL before returning or fetching it and allow only explicitly supported schemes, preferably `https` and, where necessary, `http`. - Reject URLs containing embedded credentials and reject unsupported, malformed, or ambiguous hostnames. - Resolve hostnames and block loopback, private, link-local, multicast, unspecified, reserved, and cloud-metadata address ranges for both IPv4 and IPv6. - Revalidate the resolved address immediately before connection to reduce DNS rebinding risk. - Validate every redirect target using the same policy and enforce a small redirect limit. - Deny local schemes such as `file:`, `data:`, `javascript:`, and tool-specific schemes. - Use an isolated fetch service with restricted egress, no ambient credentials, and strict response-size and timeout limits. - Require explicit user confirmation before accessing unusual ports or destinations outside normal public web endpoints. - Return a structured validation error for rejected bookmark entries rather than silently attempting to fetch them.
