T09 · Insecure Skill Coding Practices
Error
- Location
- read.py:183
- Finding
- Authentication Cookies Are Disclosed to a Third-Party Service and Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `read.py:92-94`, `read.py:183-184`, `read.py:192-203`; documented at `SKILL.md:61-63` **Vulnerability Type**: Sensitive credential exposure **Risk Level**: High ### Complete Code Snippet ```python parser.add_argument( "--set-cookie", type=str, help="Set Cookie header value for pages requiring authentication.", ) ``` ```python if args.set_cookie: payload["setCookie"] = args.set_cookie ``` ```python def execute_read(payload: Dict[str, Any], api_key: str) -> Dict[str, Any] | str: """Call UniFuncs Web Reader API and return parsed response.""" json_data = json.dumps(payload).encode("utf-8") headers = { "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", } req = urllib.request.Request(API_URL, data=json_data, headers=headers, method="POST") try: with urllib.request.urlopen(req, timeout=REQUEST_TIMEOUT_SECONDS) as response: response_data = response.read().decode("utf-8") ``` The corresponding documentation explicitly presents this option: ```text --set-cookie SET_COOKIE Set Cookie header value for pages requiring authentication. ``` ### Technical Analysis The `--set-cookie` option accepts a complete HTTP cookie value through a command-line argument. The implementation places that value in the `setCookie` field of a JSON request and sends it to the fixed third-party endpoint `https://api.unifuncs.com/api/web-reader/read`. This creates two credential-exposure channels: 1. The cookie can be recorded in shell history or exposed to local process-inspection facilities because it is supplied through `argv`. 2. The complete cookie is disclosed to UniFuncs so that its infrastructure can retrieve the authenticated page. Authenticated-page retrieval may legitimately require the remote service to receive a credential, but this behavior is optional and is not required for ordinary publ ...[truncated 1753 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove authenticated-cookie support unless it is essential to the Skill's declared purpose. 2. If the feature is retained, require explicit user confirmation before transmitting credentials to UniFuncs and clearly disclose: - The destination receiving the cookie. - The reason the cookie is required. - Applicable retention and logging behavior. - The risk that the cookie may enable account impersonation. 3. Do not accept secrets directly through command-line arguments. Read them from protected standard input, an operating-system credential store, or a file with restrictive permissions. 4. Encourage use of short-lived, narrowly scoped authentication tokens instead of complete browser cookie headers. 5. Reject broad or unrelated cookie values and transmit only the minimum cookie required for the requested target. 6. Ensure the service redacts cookies from application, proxy, telemetry, and error logs and does not retain them after processing. 7. Never include cookie values in exception messages or diagnostic output. 8. Document how users can invalidate the credential immediately after use. ]]>
