T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/qwen_wan_client.py:48
- Finding
- Outbound HTTP Requests Lack Explicit Timeouts## Vulnerability Details **File Location**: `scripts/qwen_wan_client.py:48-52` and `scripts/qwen_wan_client.py:65-68` **Vulnerability Type**: Unbounded network operations **Risk Level**: Medium ### Vulnerable Code ```python response = requests.post( f"{BASE_URL}/services/aigc/video-generation/video-synthesis", headers=headers, json=payload ) ``` ```python response = requests.get( f"{BASE_URL}/tasks/{task_id}", headers=headers ) ``` ### Technical Analysis Both outbound HTTP operations omit the `timeout` argument. The 600-second deadline in `poll_task_status` only controls the polling loop; it does not interrupt an individual `requests.get` call that has stalled. Similarly, task creation can remain blocked inside `requests.post`. The requests send data only to the hardcoded HTTPS DashScope endpoint, `https://dashscope.aliyuncs.com/api/v1`. Sending the API key, prompt, and optional reference-image URL to this declared provider is necessary for the Skill's advertised functionality and does not, by itself, indicate credential exfiltration or excessive privileges. ### Attack Path 1. A user invokes text-to-video or image-to-video generation. 2. The Skill opens an HTTPS request to DashScope. 3. A network outage, stalled remote service, or connection-level interference causes the server to accept the connection without completing the response. 4. Because no connect or read timeout is configured, the request can remain blocked. 5. The polling deadline is not reevaluated while execution is blocked inside `requests`, causing the Skill or hosting Agent worker to become unavailable indefinitely. ### Impact Assessment Exploitation does not grant additional system privileges, expose arbitrary local files, or enable code execution. The primary impact is denial of service against the current Skill invocation and potentially the hosting Agent worker. Repeated blocked invocations could consume ava ...[truncated 54 chars]
- Remediation
- ## Remediation Suggestions - Configure explicit connect and read timeouts for every HTTP request, for example: ```python REQUEST_TIMEOUT = (5, 30) response = requests.post( f"{BASE_URL}/services/aigc/video-generation/video-synthesis", headers=headers, json=payload, timeout=REQUEST_TIMEOUT, ) response = requests.get( f"{BASE_URL}/tasks/{task_id}", headers=headers, timeout=REQUEST_TIMEOUT, ) ``` - Catch `requests.Timeout` and `requests.ConnectionError`, then return a controlled and non-sensitive error. - If retries are required, use a bounded retry count with exponential backoff and jitter. - Calculate the remaining overall polling time before each request and ensure that per-request timeouts never exceed that remaining budget. - Avoid including authorization headers or other sensitive request details in exception logs.
