T09 · Insecure Skill Coding Practices
- Location
scripts/grs_image.py:114- Finding
Unvalidated API-Controlled Image URL Enables Server-Side Request Forgery and Unbounded Downloads
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This image-generation skill mostly matches its stated purpose, but it needs review because it trusts a remote API to choose an arbitrary download URL and sends user prompts or reference images to a third-party service.
Review before installing. Use a dedicated low-privilege GrsAI API key, avoid submitting confidential prompts or reference images, install dependencies in a virtual environment, and consider adding URL allowlisting, response size limits, content-type checks, and pinned dependency versions before regular use.
scripts/grs_image.py:114Unvalidated API-Controlled Image URL Enables Server-Side Request Forgery and Unbounded Downloads
SKILL.md:11Unpinned Third-Party Dependency Installation Creates a Mutable Supply-Chain Risk
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
try:
# 发起请求(API返回SSE流,逐行解析)
response = requests.post(
f"{BASE_URL}/v1/draw/nano-banana",
headers=headers,
json=payload,
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
for i in range(60): # 最多等120秒
time.sleep(2)
result_resp = requests.post(
result_url,
headers=headers,
json={"id": task_id},
The skill documentation indicates use of environment variables for API credentials and outbound network access to third-party endpoints, but it does not declare any corresponding tool scope or permissions. This creates a least-privilege violation: an agent or runner may grant broader capabilities implicitly, making secret access and external exfiltration harder to review and control.
The script sends user prompts and optional reference image URLs/Base64 data to a third-party API but does not provide an explicit privacy or data-sharing warning at runtime. In this skill context, users may submit sensitive design images or proprietary text, so silent transmission to an external provider creates a real privacy and data-governance risk.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
try:
# 发起请求(API返回SSE流,逐行解析)
response = requests.post(
f"{BASE_URL}/v1/draw/nano-banana",
headers=headers,
json=payload,
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
for i in range(60): # 最多等120秒
time.sleep(2)
result_resp = requests.post(
result_url,
headers=headers,
json={"id": task_id},
The script downloads image_url returned by the remote API without validating the scheme, host, or content type. If the upstream service is compromised or returns unexpected URLs, the client could be induced to fetch arbitrary resources, enabling SSRF-like behavior from the user's machine or downloading malicious/unexpected content.
print(f"\n图片URL: {image_url}")
# 下载图片
img_resp = requests.get(image_url, timeout=60)
with open(output_path, "wb") as f:
f.write(img_resp.content)
print(f"已保存: {output_path}")
The docstring, error messages, status output, and argument descriptions are all written exclusively in Chinese. This imposes a language choice on users without offering an alternative or documenting that the skill is intended only for a Chinese-speaking audience.