Back to skill

Security audit

TencentCloud Aiart TextToImage

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but it automatically installs an unpinned cloud SDK at runtime while using Tencent Cloud credentials and making external API calls.

Review this before installing in any environment with real Tencent Cloud credentials. Use least-privilege, temporary credentials; avoid submitting private prompts or private image URLs unless intended for Tencent Cloud; and prefer preinstalling a pinned SDK in an isolated environment rather than allowing the skill to run pip automatically.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T08 · Insecure Dependencies

Warning
Location
scripts/main.py:12
Finding
Automatic Installation of an Unpinned Tencent Cloud SDK in the Main Workflow## Vulnerability Details **File Location**: `scripts/main.py`, lines 12-23 **Vulnerability Type**: Unpinned runtime dependency installation **Risk Level**: Medium ```python def ensure_dependencies(): try: import tencentcloud # noqa: F401 except ImportError: print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr) subprocess.check_call( [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"], stdout=sys.stderr, stderr=sys.stderr, ) print("[INFO] tencentcloud-sdk-python installed successfully.", file=sys.stderr) ensure_dependencies() ``` ### Technical Analysis The main execution path automatically downloads and installs `tencentcloud-sdk-python` from the package index when the `tencentcloud` module is unavailable. The dependency has no exact version constraint or integrity hash. Consequently, the code executed by the Skill depends on mutable external package-registry content that may change after the Skill has been reviewed. Although the command uses an argument list rather than a shell and is therefore not directly vulnerable to command injection, it creates a supply-chain risk. A compromised upstream release, publisher account, package registry, or transitive dependency could introduce malicious code. The installed SDK is imported immediately afterward, causing malicious module-level code to run in the same process context as the Skill. Installation also modifies the active Python environment automatically and without a separate controlled setup or approval phase. ### Attack Path 1. The Skill runs in an environment where the `tencentcloud` module is not installed. 2. An attacker compromises the relevant package release, publisher account, registry distribution channel, or one of its unpinned transitive dependencies. 3. `ensure_dependencies()` invokes pip and installs the current ...[truncated 1010 chars]
Remediation
## Remediation Suggestions 1. Remove runtime package installation from the executable workflow. 2. Declare an exact, reviewed SDK version in a dependency manifest or lock file, for example: ```text tencentcloud-sdk-python==<reviewed-version> ``` 3. Generate and verify cryptographic hashes for the package and all transitive dependencies. Install with pip's `--require-hashes` option. 4. Install dependencies during a controlled build or deployment stage rather than while processing a user request. 5. Use an isolated virtual environment or immutable container image. 6. If the dependency is missing at runtime, terminate with clear setup instructions instead of automatically modifying the environment. 7. Regularly scan and update the pinned dependency through a reviewed change-management process. 8. Run the Skill with least-privilege credentials and prefer temporary Tencent Cloud tokens with narrowly scoped permissions.

T08 · Insecure Dependencies

Warning
Location
scripts/submit_job.py:11
Finding
Automatic Installation of an Unpinned Tencent Cloud SDK in the Submission Workflow## Vulnerability Details **File Location**: `scripts/submit_job.py`, lines 11-22 **Vulnerability Type**: Unpinned runtime dependency installation **Risk Level**: Medium ```python def ensure_dependencies(): try: import tencentcloud # noqa: F401 except ImportError: print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr) subprocess.check_call( [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"], stdout=sys.stderr, stderr=sys.stderr, ) print("[INFO] tencentcloud-sdk-python installed successfully.", file=sys.stderr) ensure_dependencies() ``` ### Technical Analysis The standalone submission script installs `tencentcloud-sdk-python` dynamically if the expected module is absent. Neither the direct dependency nor its transitive dependency graph is pinned or verified with integrity hashes. This makes the effective code executed by the submission workflow dependent on the latest content returned by the configured package index. A malicious or compromised release can be installed after the local Skill has passed review. The installed SDK modules are imported immediately afterward, allowing malicious initialization code to execute within a process that subsequently handles Tencent Cloud credentials and API requests. The use of `subprocess.check_call` with an argument list prevents shell metacharacter interpretation, but it does not mitigate package supply-chain compromise. ### Attack Path 1. The submission script is invoked in a Python environment without the `tencentcloud` module. 2. An attacker causes a malicious package version or dependency to be served through the configured Python package source. 3. The script installs that mutable package version automatically. 4. The subsequent Tencent Cloud imports load attacker-controlled Python code. 5. The code executes with the submissi ...[truncated 724 chars]
Remediation
## Remediation Suggestions 1. Delete the automatic `pip install` behavior from `submit_job.py`. 2. Pin `tencentcloud-sdk-python` to an exact reviewed version. 3. Lock all transitive dependencies and require cryptographic hashes during installation. 4. Provision dependencies in a trusted build pipeline or immutable runtime image. 5. Configure the script to report a missing dependency and exit safely. 6. Use a dedicated virtual environment with restricted write permissions. 7. Restrict package installation to a trusted internal mirror where appropriate. 8. Run submission operations with temporary, least-privilege Tencent Cloud credentials.

T08 · Insecure Dependencies

Warning
Location
scripts/query_job.py:12
Finding
Automatic Installation of an Unpinned Tencent Cloud SDK in the Query Workflow## Vulnerability Details **File Location**: `scripts/query_job.py`, lines 12-23 **Vulnerability Type**: Unpinned runtime dependency installation **Risk Level**: Medium ```python def ensure_dependencies(): try: import tencentcloud # noqa: F401 except ImportError: print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr) subprocess.check_call( [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"], stdout=sys.stderr, stderr=sys.stderr, ) print("[INFO] tencentcloud-sdk-python installed successfully.", file=sys.stderr) ensure_dependencies() ``` ### Technical Analysis The standalone query workflow performs an automatic, unpinned installation of the Tencent Cloud SDK. No package version, lock file, or package hash is enforced. Therefore, a query operation can cause new external code to be downloaded, installed, and imported without an explicit dependency-review step. The package is imported directly after installation. A compromised package or transitive dependency can consequently execute code in the credential-bearing query process. This is particularly relevant because the query script retrieves generated-image URLs and revised prompts and has access to the Tencent Cloud credentials used to authenticate requests. ### Attack Path 1. A user invokes `query_job.py` in an environment without the Tencent Cloud SDK. 2. The package source or an applicable package release is compromised. 3. The script retrieves and installs the unpinned package automatically. 4. The following SDK imports execute malicious Python code. 5. The malicious code accesses the query process's credentials and data. 6. It may exfiltrate credentials, alter query behavior, manipulate returned results, or access other resources available to the process. ### Impact Assessment A successful attack could execute ar ...[truncated 557 chars]
Remediation
## Remediation Suggestions 1. Do not install dependencies during job-query execution. 2. Pin the Tencent Cloud SDK and every transitive dependency to reviewed versions. 3. Record and enforce package hashes using a lock file and `pip install --require-hashes`. 4. Build the execution environment in advance from trusted package sources. 5. Fail closed with installation guidance when the SDK is unavailable. 6. Isolate the Skill in a dedicated virtual environment or container. 7. Prevent the runtime identity from modifying shared or system-wide Python environments. 8. Minimize the permissions and lifetime of Tencent Cloud credentials available to the query process.
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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (16)

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill clearly instructs the agent to use shell execution and access environment-based credentials, but it does not declare any explicit tool scope or allowed-tools/permissions boundary. This weakens least-privilege controls and can cause the platform to expose broader shell or env capabilities than necessary, increasing the blast radius if the skill is misused or combined with prompt injection.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The description says to use the skill for broad categories like AI art creation, poster/cover design, illustration generation, or any text-to-image tasks, which is an expansive activation surface. Overly broad routing can cause the agent to invoke shell-backed code in many ordinary conversations, including cases where the user did not clearly request external execution, raising the chance of unintended command execution and credential use.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The skill documentation and operating instructions are presented entirely in Chinese, and the examples direct the agent to return outputs like revised prompts in Chinese without indicating that the user can choose another language. This can violate language or locale policy where user language preference should be respected unless the locale restriction is explicitly justified.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The agent rule states that any user-provided text description with image-generation intent is sufficient to trigger execution, and elsewhere it emphasizes zero-interaction automatic execution. In context, that means a very small amount of user text can cause the agent to run local scripts and consume cloud credentials without a tighter confirmation or policy gate, making accidental or adversarial triggering more likely.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
Installing Python packages at runtime is a real security issue here because it pulls code from an external repository during execution, outside normal review and deployment controls. Even if the package name is fixed, this creates supply-chain exposure and allows package installation side effects to run with the script's privileges. For a text-to-image API wrapper, this behavior is unnecessary and makes the skill more dangerous than its stated purpose suggests.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
import tencentcloud  # noqa: F401
    except ImportError:
        print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr)
        subprocess.check_call(
            [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"],
            stdout=sys.stderr,
            stderr=sys.stderr,
Confidence
96% confidence
Finding
The script automatically installs a Python package at runtime using pip when an import fails. Runtime package installation introduces supply-chain risk, can execute arbitrary code from package install hooks, and mutates the execution environment in a way users may not expect from a text-to-image skill. In this skill context, network/package installation is not essential to safely process local arguments, so the behavior increases risk rather than being justified.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
A text-to-image job query skill should only query API state, but this file also installs software dynamically when imported or run. That behavior is outside the core business purpose and is dangerous because it introduces supply-chain risk, unexpected network access, and execution of third-party installer logic in the user's environment.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
import tencentcloud  # noqa: F401
    except ImportError:
        print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr)
        subprocess.check_call(
            [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"],
            stdout=sys.stderr,
            stderr=sys.stderr,
Confidence
92% confidence
Finding
The script automatically installs a Python package at runtime using pip via subprocess. Even though the command is not shell-injected, runtime dependency installation expands the skill's capabilities, performs network and code-fetching side effects during execution, and can lead to unreviewed code being installed and executed in the environment if package sources or dependency resolution are compromised.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
Installing Python packages at runtime is risky and unnecessary for the stated text-to-image functionality. It can pull unpinned code from external package infrastructure, alter the host environment without user approval, and create a supply-chain exposure if package resolution or repository configuration is compromised.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
import tencentcloud  # noqa: F401
    except ImportError:
        print("[INFO] tencentcloud-sdk-python not found. Installing...", file=sys.stderr)
        subprocess.check_call(
            [sys.executable, "-m", "pip", "install", "tencentcloud-sdk-python", "-q"],
            stdout=sys.stderr,
            stderr=sys.stderr,
Confidence
94% confidence
Finding
The script automatically invokes pip at runtime to install a dependency when the package is missing. Even though it does not use a shell and the package name is hardcoded, executing package installation during normal skill execution introduces supply-chain and environment-modification risk, especially in shared or production runtimes where package sources, indexes, or local pip configuration may be attacker-influenced.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The script sends prompts and optional image URLs to Tencent Cloud's remote API, which is inherent to the service, but it does so without an explicit user-facing disclosure about external transmission. If users include sensitive prompts or private image references, data may leave the local environment unexpectedly, creating confidentiality and compliance concerns.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
This markdown file contains user-facing documentation exclusively in Chinese and does not indicate that other language options are available. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is clearly documented and justified.

Natural-Language Policy Violations

Low
Confidence
72% confidence
Finding
The parameter description states '推荐使用中文' for prompts, which is a language preference expressed in natural language. Because the document does not explicitly frame this as optional user choice or narrowly justify a locale requirement, it may be interpreted as steering users toward a specific language without opt-in.

Missing User Warnings

Low
Confidence
85% confidence
Finding
This markdown file documents an API that accepts image URLs as input, which can involve transmitting user-provided or potentially sensitive image references to an external service. The description explains the parameter format but does not include any warning about privacy, external network access, or ensuring the referenced images are appropriate to send to the API.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The CLI help string says 'Chinese recommended,' which nudges users toward a specific language/locale without an explicit opt-in or a clear region-specific justification. This is a natural-language policy concern because the skill presents a preferred language choice rather than remaining language-neutral.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The argument help string says 'Chinese recommended', which nudges users toward a specific language choice. Under the language/locale policy, forcing or steering toward a specific language without opt-in can be a natural-language policy issue unless the constraint is explicitly justified as region- or tool-specific.

Static analysis

No suspicious patterns detected.