Back to skill

Security audit

hidream-model-gen

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its Vivago image/video generation purpose, but it needs Review because token handling is under-scoped and some adult audio/video template behavior is not clearly disclosed.

Install only if you are comfortable sending prompts, images, and generation metadata to Vivago using your account token. Do not use an untrusted custom ports configuration, rotate the Vivago token if one may have been exposed, and review or remove the adult template data if the skill will be used in a general or policy-restricted environment.

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

Warning
Location
scripts/vivago_client.py:65
Finding
Configurable API Host Can Receive the Vivago Bearer Token<![CDATA[ ## Vulnerability Details **File Location**: `scripts/vivago_client.py:65-83`, `scripts/vivago_client.py:89-97`, `scripts/vivago_client.py:355-368` **Vulnerability Type**: Authenticated request redirection through unrestricted configuration **Risk Level**: Medium ### Complete Code Snippet ```python def __init__( self, token: str, ports_config_path: Optional[str] = None ): """ Initialize Vivago client. Args: token: Vivago API Bearer token ports_config_path: Path to api_ports.json (optional) """ self.token = token self.headers = { "Authorization": f"Bearer {token}", "X-accept-language": "en", } # Load ports configuration self.ports_config = self._load_ports_config(ports_config_path) self.base_url = self.ports_config.get("base_url", "https://vivago.ai/api/gw") ``` ```python def _load_ports_config(self, config_path: Optional[str] = None) -> Dict: try: if config_path: with open(config_path, 'r', encoding='utf-8') as f: return json.load(f) else: return load_ports_config() ``` ```python try: url = f"{self.base_url}{endpoint}" headers_post = {**self.headers, "Content-Type": "application/json"} response = requests.post( url, json=data, headers=headers_post, timeout=1800 ) ``` ### Technical Analysis The API client accepts an arbitrary configuration file through `ports_config_path`. The file can define `base_url`, which is used directly to construct API request URLs. The client does not verify that the configured URL: - Uses HTTPS. - Belongs to `vivago.ai` or an explicitly trusted subdomain. - Has no embedded credentials or unexpected port. - Resolves to a non-local, trusted destination. Every generated request includes the Vivago bearer token through the `Authorization` header. Therefore, control over the configuration path or contents is sufficient to redirect au ...[truncated 1345 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Enforce an explicit destination allowlist before sending authenticated requests: ```python from urllib.parse import urlparse ALLOWED_API_HOSTS = {"vivago.ai"} def validate_api_base_url(url: str) -> str: parsed = urlparse(url) if parsed.scheme != "https": raise ValueError("The API base URL must use HTTPS") if parsed.hostname not in ALLOWED_API_HOSTS: raise ValueError("Untrusted API host") if parsed.username or parsed.password: raise ValueError("Embedded URL credentials are prohibited") return url.rstrip("/") ``` 2. Validate endpoint fields and require them to be relative paths beginning with a single `/`. Reject absolute URLs, network-path references, backslashes, fragments, and traversal components. 3. Do not forward credentials to custom hosts. If custom endpoints are genuinely required, make credential forwarding a separate explicit option that defaults to disabled. 4. Prefer removing `ports_config_path` from untrusted entry points and package reviewed endpoint definitions as immutable application data. 5. Add tests confirming that HTTP URLs, unrelated domains, localhost, IP literals, and absolute endpoint URLs are rejected. 6. Rotate any Vivago token that may already have been used with an untrusted configuration. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/vivago_client.py:977
Finding
Bearer Token Is Unnecessarily Sent During Image Downloads<![CDATA[ ## Vulnerability Details **File Location**: `scripts/vivago_client.py:977-985` **Vulnerability Type**: Excessive credential forwarding **Risk Level**: Low ### Complete Code Snippet ```python # Use the correct storage URL format urls_to_try = [ f"https://storage.vivago.ai/image/{image_id}.jpg", f"https://storage.vivago.ai/image/{image_id}.png", ] for url in urls_to_try: try: resp = requests.get( url, headers=self.headers, timeout=1800, allow_redirects=True ) ``` The supplied `self.headers` value contains the bearer token: ```python self.headers = { "Authorization": f"Bearer {token}", "X-accept-language": "en", } ``` ### Technical Analysis `download_image()` forwards the primary Vivago API bearer token to `storage.vivago.ai`. The project documentation demonstrates downloading these storage URLs without authentication, and `download_video()` explicitly omits the authorization header. This indicates that forwarding the token is not required for the declared download behavior. It expands the credential's exposure from the primary API to a separate storage service. Because redirects are enabled, the implementation also depends on the HTTP client's redirect-header handling to avoid forwarding sensitive headers beyond the intended host. The behavior violates least privilege: a public media download should not receive an account-level API credential. ### Attack Path 1. A user generates an image and invokes `download_image()`. 2. The client requests the public storage URL with the Vivago bearer token attached. 3. The storage infrastructure, reverse proxy, monitoring system, or request logs receive the token. 4. If any such component is compromised or improperly logs authorization headers, an attacker can recover the credential. 5. The attacker reuses the token against the Vivago API within its validity and authorization scope. ### Impact Assessment The primary impact ...[truncated 441 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the authorization header from public image-download requests: ```python resp = requests.get( url, timeout=1800, allow_redirects=True ) ``` 2. Use separate header dictionaries for API requests and public media downloads. Do not store a broadly reusable authorization-bearing dictionary where it may be passed to unrelated requests accidentally. 3. If storage authentication becomes necessary, use a short-lived, narrowly scoped presigned URL rather than the primary account bearer token. 4. Validate redirect destinations or disable automatic redirects and process them manually with an allowlist. 5. Ensure application, proxy, and storage logs redact `Authorization` headers. 6. Add a regression test asserting that `download_image()` sends no `Authorization` header. ]]>

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding
Open-Ended and Unhashed Dependencies Prevent Reproducible Installation<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1-20` **Vulnerability Type**: Unpinned dependency and supply-chain exposure **Risk Level**: Low ### Complete Code Snippet ```text # Core dependencies requests>=2.31.0 Pillow>=10.0.0 # Replaces opencv-python for lighter image processing tqdm>=4.66.0 # For progress bars # Configuration python-dotenv>=1.0.0 # Testing pytest>=7.4.4 pytest-cov>=4.1.0 responses>=0.24.1 # Code quality black>=23.12.1 flake8>=7.0.0 mypy>=1.8.0 # Type stubs for better IDE support types-requests>=2.31.0 ``` ### Technical Analysis Every dependency uses an open-ended lower bound. Consequently, `pip install -r requirements.txt` may install any future compatible version rather than the versions reviewed during this audit. The file also mixes runtime packages with testing, formatting, linting, and type-checking tools, unnecessarily increasing the installation and dependency graph. No package in the observed file is an evident typosquat or malicious package. The risk arises from the absence of exact reviewed versions and integrity hashes, not from a confirmed malicious dependency. Without a lock file or hashes, installation results can change over time. A compromised future release, malicious transitive dependency, or incompatible update could therefore execute code during package installation or when imported by the Skill. ### Attack Path 1. A direct or transitive dependency publishes a compromised future version that still satisfies the declared lower bound. 2. A user follows the documented `pip install -r requirements.txt` installation procedure. 3. The package resolver selects the compromised version because no upper bound, lock file, or hash prevents it. 4. Malicious build hooks, installation code, or imported runtime code executes under the privileges of the installing or running user. This is a conditional supply-chain path; the audit found no evidence that the currently named packages are intentional ...[truncated 562 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Separate runtime dependencies from development and testing dependencies. 2. Pin reviewed versions exactly in a lock file instead of using unrestricted `>=` constraints. 3. Generate and enforce cryptographic hashes, for example with `pip-tools` and `pip install --require-hashes`. 4. Review and lock transitive dependencies, not only direct dependencies. 5. Install only runtime packages in production environments. 6. Use automated dependency scanning and controlled update workflows so version changes are reviewed and tested before release. 7. Prefer isolated virtual environments and avoid installing the Skill as a privileged operating-system user. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (75)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
This code chunk does not implement the declared media-generation behavior. Its primary purpose is configuration management: locating config files, reading local JSON files, combining category data, and returning cached configuration objects. There is no API call logic, no image/video processing, no Vivago platform integration, and no user-facing generation functionality in this snippet. While configuration loading could be a supporting utility within a larger image/video skill, the supplied chunk itself is materially different from the declared purpose, so this is a mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description says the skill generates images and videos through the Vivago AI platform/API. However, the supplied code chunk only processes local JSON template data: it reads template_list_full.json, tries to fix malformed JSON, extracts fields, writes templates_data.json, and prints statistics. This is a materially different primary purpose from AI media generation. The filesystem access is consistent with a preprocessing/export script, not with the declared end-user capability. Therefore this is a clear description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description presents a broad multimodal Vivago generation skill covering several image and video workflows. This specific code chunk, however, is narrowly focused on generating a video from a text prompt, then returning a Vivago media URL and a Feishu-formatted message because Feishu cannot send playable video directly. That Feishu integration behavior is a distinct undeclared capability, and the implemented functionality in this chunk is materially narrower than the declared set of supported generation modes. While the video-generation aspect is consistent with the description at a high level, the code does not substantiate most of the declared capabilities and adds Feishu-specific delivery behavior not mentioned in the declared purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared purpose describes an AI media-generation skill integrated with the Vivago AI platform. The supplied code does not call any external API, does not generate images or videos, and does not implement transformation workflows beyond basic preprocessing. Its actual role is a supporting utility for image upload preparation, which is materially narrower and different from the claimed primary purpose. Therefore, the description does not accurately represent this code chunk.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared purpose centers on AI image/video generation through the Vivago AI platform, but the code chunk contains only generic logging setup utilities. It does not call any external AI service, process images or videos, handle prompts or media inputs, or implement any generation/transformation workflow. This is a clear description-to-behavior mismatch because the code’s primary purpose is unrelated logging configuration.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description says this skill generates images and videos through the Vivago AI platform. However, the actual code only processes a local JSON file containing template information, with fallback regex-based extraction if JSON parsing fails, and prints categorized summaries. This is a materially different primary purpose from media generation. There is no evidence of text-to-image, image-to-image, image-to-video, keyframe-to-video, style transfer, or any network/API usage. Therefore the description does not accurately represent the code.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description presents a broad Vivago media-generation skill supporting multiple creation modes. The supplied code chunk, however, is a supporting configuration/request-construction component: it loads template definitions, computes endpoints, exposes template metadata, and builds request bodies for effect video generation using an image UUID. There is no code here that sends requests to Vivago, uploads assets, polls results, or implements text-to-image, image-to-image, keyframe-to-video, or style transfer workflows directly. While related to Vivago video templating, its primary purpose is materially narrower and infrastructural, so the description overstates what this code chunk actually does.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
This template includes explicit sexualized audio generation ('female moaning') that extends the skill into erotic audio content outside the declared image/video generation purpose. In a general-purpose agent context, that creates a policy and trust-boundary problem: users or downstream systems may invoke undeclared NSFW audio generation without proper consent, moderation, or age gating.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
This second template likewise embeds erotic audio generation ('male moaning'), expanding the skill beyond its stated purpose and bypassing user expectations about what content can be produced. The risk is amplified because the capability is hidden in data templates rather than obvious from the manifest, making moderation and review easier to evade.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill declares access to an environment credential and documents file and network operations, but it does not define an explicit tool/permission scope such as allowed tools or permissions. That increases the risk of overbroad execution in agent environments, especially because the skill can read local files, write outputs, and make authenticated external network requests using HIDREAM_AUTHORIZATION.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The architecture notes are written only in Chinese while the file otherwise contains English keys and values, creating an implicit language requirement for maintainers or tooling users who need to interpret these instructions. Under the language/locale policy, forcing a specific language without opt-in or justification is a natural-language policy issue.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The configured API surface exposes text-to-video and large template/effect-generation capabilities that are broader than the skill’s stated description. This mismatch can mislead users, reviewers, or policy enforcement into approving a narrower skill while the implementation can invoke materially different generation flows, including higher-risk media transformations.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The template_to_video category includes ports that actually return static images via image_edit_gen and related image-edit endpoints, which diverges from the declared capability and can bypass feature-specific safeguards. Mislabeling output types undermines review assumptions and may cause callers to apply the wrong moderation, consent, or content-handling controls.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
This manifest file specifies asynchronous API endpoints for submitting image-to-video generation requests, which implies user-provided image data will be transmitted to a remote service. The only existing warning discusses generation time, not that user content leaves the local system or is processed by an external provider.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest describes text-to-image, image-to-image, image-to-video, and keyframe-to-video generation, while this video-template configuration also includes direct image editing/image generation endpoints such as /v2/image/image_easy_edit/async. That is broader than a pure template-to-video capability and mixes image-only operations into a video template registry.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
This file is for the "template_to_video" category, but several entries are explicitly documented and configured to return images via image endpoints rather than videos. That diverges from both the category name and the skill manifest's framing around video generation modes.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This manifest contains user-facing name and description fields in Chinese (e.g. "文生图" and "从文本描述生成图像") while providing no indication that the skill is region-specific or that users can choose their preferred language. That creates a natural-language locale policy concern because the skill appears to impose a specific language by default.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
This Python file contains user/developer-facing natural-language text in Chinese in the module docstring and class docstrings. The policy requires avoiding forced language or locale constraints unless the skill offers opt-in or clearly documents a justified regional limitation, which is not present here.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The module docstrings and all user-facing console messages are written only in Chinese, indicating a fixed language choice for the skill's interaction surface. The file provides no opt-in, fallback, or documented reason for restricting the locale, which matches the policy category for forced language without user choice.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This code file contains natural-language strings and documentation in Chinese, beginning with the module docstring and continuing in user-facing output. Under the policy rule, forcing a specific language without user opt-in is a locale/language policy concern unless the tool is clearly documented as region-specific, which is not evident here.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The script's runtime status, success, and error messages are emitted only in Chinese, which constrains user interaction to one language. The file does not offer opt-in language selection or explain that the skill is intended only for a Chinese-speaking context.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script sends the user-supplied prompt to Vivago's external video-generation service via `client.text_to_video(...)` without any explicit notice or consent mechanism at the point of transmission. Prompts can contain sensitive business, personal, or confidential information, so silent forwarding to a third party creates a real privacy and data-sharing risk in this skill context.

Vague Triggers

Medium
Confidence
91% confidence
Finding
This JSON manifest contains a template whose identifying text is just "Shake It Down" in both the main prompt and custom prompt. As a manifest file, it falls under vague-trigger review, and this phrase is broad, colloquial, and lacks any constraint or negative examples to distinguish when this template should be selected versus ordinary user speech.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The manifest identifies a template only as "Kiss Kiss" with no additional context about intended use, subject type, or exclusion conditions. In a manifest file, such a short everyday phrase is overly broad and can overlap with common language, increasing the risk of unintended invocation or mismatched template selection.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This code file contains user- and developer-facing natural language exclusively in Chinese in the module docstring and class docstring. Under the language/locale policy, forcing a specific language without opt-in or justification is a natural-language policy violation.

Static analysis

No suspicious patterns detected.