T09 · Insecure Skill Coding Practices
- Location
scripts/qwen_wan_client.py:48- Finding
Outbound HTTP Requests Lack Explicit Timeouts
- Content
View full analysis
Vulnerability Details
File Location:
scripts/qwen_wan_client.py:48-52andscripts/qwen_wan_client.py:65-68
Vulnerability Type: Unbounded network operations
Risk Level: MediumVulnerable 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
timeoutargument. The 600-second deadline inpoll_task_statusonly controls the polling loop; it does not interrupt an individualrequests.getcall that has stalled. Similarly, task creation can remain blocked insiderequests.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
- A user invokes text-to-video or image-to-video generation.
- The Skill opens an HTTPS request to DashScope.
- A network outage, stalled remote service, or connection-level interference causes the server to accept the connection without completing the response.
- Because no connect or read timeout is configured, the request can remain blocked.
- 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
View 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.Timeoutandrequests.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.
-
