Back to skill

Security audit

GPT Image 2 精准文字图片

Security checks for vulnerabilities and agentic risk

Overview

This is a real AI Hive image-generation helper, but it handles an API key and allows credential-bearing requests and uploads with weaker scoping than users may expect.

Review this before installing if you use a valuable AI Hive account. Keep the default AI Hive endpoint unless you fully trust the replacement, avoid setting AI_HIVE_BASE_URL from untrusted environments, use a dedicated low-privilege API key if possible, and only pass media files you intend to upload to AI Hive.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:68
Finding

Bearer API Credential Can Be Redirected to an Arbitrary Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:68-76 and scripts/imagegen.py:105-123
Vulnerability Type: Unrestricted credential forwarding to a configurable endpoint
Risk Level: Medium

Vulnerable Code

python
def _resolve_base_url(self, cli_url):
    if cli_url:
        return cli_url.rstrip("/")
    env_url = os.environ.get("AI_HIVE_BASE_URL")
    if env_url:
        return env_url.rstrip("/")
    file_config = self._read_config_file()
    if file_config.get("base_url"):
        return file_config["base_url"].rstrip("/")
    return DEFAULT_BASE_URL
python
def __init__(self, config):
    self.config = config
    self.base = config.base_url
    self.headers = {
        "Authorization": f"Bearer {config.api_key}",
        "Content-Type": "application/json",
    }

def _url(self, path):
    return f"{self.base}/openapi/v1/{path}"

def _request(self, method, url, **kwargs):
    self.config.log(f"{method} {url}")
    try:
        resp = requests.request(
            method, url, headers=self.headers, timeout=DEFAULT_TIMEOUT, **kwargs
        )

Technical Analysis

The API base URL may be supplied through a command-line option, the AI_HIVE_BASE_URL environment variable, or the user-writable configuration file. The value is accepted without validating its scheme, hostname, port, or relationship to the expected AI Hive service.

The HTTP client unconditionally attaches the AI Hive bearer credential to every request constructed from that configurable base URL. Consequently, any party able to influence the process environment, command invocation, or base_url configuration can redirect authenticated requests to a server under their control.

TLS certificate validation by requests does not prevent this attack when the destination is an attacker-owned HTTPS server with a valid certificate. The flaw is therefore an endpoint trust failure rather ...[truncated 1228 chars]

Remediation
View remediation

Remediation Suggestions

  1. Allowlist the expected HTTPS origin, including the exact hostname and permitted port.
  2. Reject non-HTTPS URLs and URLs containing user information, fragments, unexpected ports, or untrusted hostnames.
  3. Do not attach the AI Hive bearer credential unless the final request destination matches the trusted allowlist.
  4. Treat custom API endpoints as an exceptional development feature requiring an explicit, high-friction opt-in.
  5. Display a warning and require confirmation before sending credentials to any non-default endpoint.
  6. Validate redirects or disable them for authenticated API requests so a trusted endpoint cannot redirect the credential-bearing request to another origin.
  7. Store custom endpoint configuration separately from credentials and verify configuration-file ownership and permissions before trusting it.
  8. Add automated tests proving that credentials are never sent to untrusted schemes, hosts, ports, or redirect destinations.

T08 · Insecure Dependencies

Note
Location
SKILL.md:64
Finding

Unpinned Runtime Dependency Installation Creates Supply-Chain Risk

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:64-66
Vulnerability Type: Mutable and unverified third-party dependency installation
Risk Level: Low

Vulnerable Code

bash
pip3 install requests
python3 "$SKILL_PATH/scripts/imagegen.py" init --skill-name gpt-image-2-exact-text-image
python3 "$SKILL_PATH/scripts/imagegen.py" task --task-id <taskId>

Technical Analysis

The documented setup procedure installs requests without an exact version constraint, dependency lockfile, package hashes, or an explicitly trusted package index. The installed version and its transitive dependencies can therefore change over time without any change to the audited project.

The installation also depends on the user's active pip configuration. A compromised package index, unsafe mirror, manipulated proxy, or upstream package compromise could cause different code to be installed than the code expected during the audit.

This is a supply-chain hardening deficiency rather than evidence that the current requests package is malicious.

Attack Path

  1. A user follows the documented pip3 install requests instruction.
  2. Pip resolves the package and transitive dependencies using mutable index metadata and the user's configured package sources.
  3. An upstream account compromise, malicious mirror, compromised proxy, or unsafe index configuration supplies a substituted or compromised artifact.
  4. Pip installs the artifact into the active Python environment.
  5. Malicious dependency code executes during installation or when imagegen.py imports requests.

Impact Assessment

Exploitation could execute dependency-supplied Python code with the privileges of the user running pip or the skill. Depending on those privileges, this could expose local files, environment variables, the AI Hive API credential, and data submitted through the skill.

No evidence was found that the currently referenced dependency i ...[truncated 227 chars]

Remediation
View remediation

Remediation Suggestions

  1. Define an audited exact version of requests and all transitive dependencies in a requirements or lock file.
  2. Record cryptographic hashes for every permitted artifact.
  3. Install with an integrity-enforcing command such as pip install --require-hashes -r requirements.txt.
  4. Use a dedicated virtual environment rather than modifying a shared or system Python environment.
  5. Explicitly configure an approved HTTPS package index and avoid untrusted fallback indexes or mirrors.
  6. Add automated dependency vulnerability scanning and a controlled update process.
  7. Regenerate and review the lock file whenever dependency versions are intentionally upgraded.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared purpose is a narrowly scoped exact-text image generator, but the underlying behavior reportedly includes broader AI Hive functions such as general chat, video generation, user/model queries, and media upload, while the promised character-by-character QA is not actually implemented. This mismatch is dangerous because users and policy layers may trust the description and approve the skill for low-risk image tasks, while the implementation can perform materially broader operations and transmit more data than expected.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill exposes executable examples that use shell, network access, package installation, and file I/O, but it declares no tool scope or permission boundaries. This is dangerous because a caller or orchestrator may grant overly broad capabilities by default, enabling the skill to read/write local files, access environment data, and make external requests beyond the narrow image-generation purpose.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The description lists many generic phrases such as poster generation, text replacement, commercial design, and localization without defining clear trigger boundaries or exclusion conditions. In a manifest/markdown context, this can cause the skill to activate on ordinary image-design requests that may not specifically require this exact-text workflow.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file implements a broad-purpose AI Hive client with chat, image, video, model enumeration, user-info retrieval, uploads, and task polling, while the skill metadata claims a narrowly scoped exact-text image generation skill. This scope mismatch increases the attack surface and enables users or higher-level agents to invoke capabilities that were not disclosed in the manifest, which can lead to unintended data exposure, cost-incurring operations, or policy bypass through repurposing the skill as a generic API wrapper.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains user-facing natural-language descriptions and prompts that are exclusively in Chinese, starting with the module docstring and continuing through CLI help and status messages. Because the skill does not offer language selection or explain that it is intentionally Chinese-only for a specific audience, it may violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains user-facing natural language exclusively in Chinese across the changelog entries. Under the policy rule for language or locale constraints, forcing a single language without opt-in or justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The example API key value includes Chinese text ('请替换为你的APIKey'), which imposes a specific language in a user-facing config example. For a general-purpose skill file, this can violate language/locale policy when no user opt-in or documented locale-specific scope is provided.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The exposed skill interface includes task querying and arbitrary media upload commands that are not part of the manifest’s stated end-user purpose. While these operations are less dangerous than generic chat or video generation, they still create undeclared functionality that can be abused for unauthorized file transfer, persistence of user-provided content, or probing task metadata outside the expected image-generation workflow.

Content

No source excerpt is available for this finding.