Back to skill

Security audit

Coze Image Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but it has review-worthy security weaknesses around unrestricted endpoints, token handling, automatic image fetching, and automatic updates.

Install only if you trust the publisher and runtime isolation. Use a least-privilege Coze token, avoid sensitive prompts, disable implicit invocation or require confirmation where possible, pin dependencies, consider disabling auto-update, and do not allow untrusted callers to pass api_url until endpoint allowlisting and image-download limits are added.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/coze_image_skill.py:153
Finding

Bearer Token Disclosure Through a Caller-Controlled API Endpoint

Content
View full analysis
None: self.url = url self.project_id = project_id self.session_id = session_id self.timeout = timeout self.headers = { "Authorization": f"Bearer {api_token}", "Content-Type": "application/json", "Accept": "text/event-stream", } ``` ```python response = requests.post( self.url, headers=self.headers, json=self._build_payload(prompt), stream=True, timeout=self.timeout, ) response.raise_for_status() ``` ```python def run(params: Dict[str, Any]) -> Dict[str, Any]: prompt = params.get("text") or params.get("prompt") or "" api_token = params.get("api_token") or os.environ.get("IMAGE_API_TOKEN") api_url = params.get("api_url") or os.environ.get("IMAGE_API_URL", "https://6fj9k4p9x3.coze.site/stream_run") project_id = params.get("project_id") or os.environ.get("IMAGE_API_PROJECT_ID", "7621854258107039796") session_id = params.get("session_id") or os.environ.get("IMAGE_API_SESSION_ID", "mT8SQeCGgTMZNBsJEiRuN") timeout = int(params.get("timeout") or os.environ.get("IMAGE_API_TIMEOUT", "60")) include_debug = _bool_param(params.get("include_debug")) strict_mode = _bool_param(params.get("strict")) try: if not api_token: raise RuntimeError("Missing IMAGE_API_TOKEN environment variable or params['api_token']") if not project_id: raise RuntimeError("Missing IMAGE_API_PROJECT_ID environment variable or params['project_id']") if not session_id: raise RuntimeError("Missing IMAGE_API_SESSION_ID environment variable or params['session_id']") client = Coz ...[truncated 2245 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/coze_image_skill.py:113
Finding

Server-Side Request Forgery and Memory Exhaustion Through an Unvalidated Image URL

Content
View full analysis
Optional[str]: if isinstance(value, str): return self._find_url_in_string(value) if isinstance(value, list): for item in value: found = self._extract_image_url(item) if found: return found return None if isinstance(value, dict): # Check direct URL fields for key in ("url", "image_url", "imageUrl"): nested = value.get(key) if isinstance(nested, str) and nested.startswith("http"): return nested # Special handling for tool_response.result which may contain URL text tool_response = value.get("tool_response") if isinstance(tool_response, dict): result = tool_response.get("result") if isinstance(result, str): # Look for URL pattern in result text (e.g., "图片生成成功,图片 URL: https://...") found = self._find_url_in_string(result) if found: return found # Recurse into common nested fields for key in ("content", "output", "result", "data", "tool_result", "tool_response"): found = self._extract_image_url(value.get(key)) if found: return found return None ``` ```python image_url = self._extract_image_url(event_data) if image_url: return image_url, "".join(answer_chunks).strip() assistant_text = "".join(answer_chunks).strip() if assistant_text: raise RuntimeError(f"Image URL not found in SSE response. Upstream assistant replied: {assistant_text}") raise RuntimeError("Image URL not found in SSE response") def _download_as_data_uri(self, image_url: str) -> Tuple[str, str]: response = requests.get( ...[truncated 3179 chars]
Remediation
View remediation
MAX_IMAGE_BYTES: raise ValueError("Image exceeds maximum permitted size") ``` 7. Restrict accepted MIME types to a small allowlist such as `image/png`, `image/jpeg`, and `image/webp`. 8. Verify file signatures or decode the response with a hardened image library rather than trusting `Content-Type`. 9. Apply process-level memory and network egress limits as defense in depth. 10. Limit SSE line sizes, event counts, and accumulated assistant text to prevent additional response-based resource exhaustion. ]]>

T08 · Insecure Dependencies

Warning
Location
package.json:26
Finding

Unpinned Dependency and Automatic Update Supply-Chain Exposure

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (9)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 83)May include surrounding context.

md
- Python 3.8+
- `requests` library
- Coze API access token

## License

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises and relies on environment access and outbound network access, but it does not declare any explicit tool scope such as permissions or allowed-tools. This creates a transparency and policy-enforcement gap: consumers and execution frameworks may not clearly understand or constrain the skill's external communication and secret usage, increasing the risk of over-privileged execution and unintended data exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill sends user prompts to an external Coze service and then automatically downloads returned images and embeds them as Base64, but the description does not clearly warn users about this data flow. That omission can cause users to unknowingly transmit sensitive prompts to a third party and can hide the fact that external content is being fetched and inlined, which has privacy, compliance, and content-safety implications.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill enables implicit invocation without any visible trigger constraints or narrowing conditions, so an agent may call the image-generation capability in broader contexts than intended. In this skill, that increases the chance of unplanned external API use, unintended prompt/data transmission to Coze, and surprise generation of inline Base64 image content that could affect cost, privacy, or downstream handling.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/coze_image_skill.py (reported line 92)May include surrounding context.

python
return None

    def _stream_for_image_url(self, prompt: str) -> Tuple[str, str]:
        response = requests.post(
            self.url,
            headers=self.headers,
            json=self._build_payload(prompt),

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill sends the full user prompt to an external Coze endpoint, which can expose sensitive or proprietary text if users assume processing is local. This is primarily a privacy and data-handling risk rather than code execution, but it becomes significant if prompts may contain confidential information.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency version for requests is completely unpinned ("*") so installs may pull any future release, including breaking or compromised versions. This creates a supply-chain risk and reduces build reproducibility, though the package.json alone does not show active exploitation logic.

Content

Scanner excerpt · package.json (reported line 26)May include surrounding context.

json
"openclaw": ">=1.0.0"
  },
  "dependencies": {
    "requests": "*"
  },
  "clawhub": {
    "type": "skill",

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code downloads arbitrary content from a URL extracted from upstream SSE data without validating the host, scheme beyond basic HTTP(S), size, or content type. This creates an SSRF-style primitive and can be abused to make the runtime fetch attacker-influenced URLs, including internal services or large payloads, especially if the upstream service can be manipulated or compromised.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The manifest describes a text-to-image generator with Base64 preview, but the implementation also pulls API token, URL, project ID, session ID, and timeout from process environment variables. Accessing environment configuration is not mentioned in the stated purpose and adds a capability beyond pure prompt-to-image transformation.

Content

No source excerpt is available for this finding.