Back to skill

Security audit

MigraQ

Security checks for vulnerabilities and agentic risk

Overview

This Tencent Cloud migration skill is mostly disclosed as a remote proxy, but unsafe command templates and configurable/plaintext forwarding paths make it risky enough for Review before installation.

Install only if you are comfortable sending migration prompts, inventory, billing, and planning context to Tencent Cloud endpoints. Avoid putting secrets in prompts, do not use --dry-run with real credentials in shared logs, and run the script through argument-array execution rather than interpolated Bash strings. Review or remove CMG_NO_AUTH_* endpoint overrides before use, and use separate sessions when moving from unauthenticated consultation to authenticated cloud operations.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:98
Finding

Shell Command Injection Through Verbatim User Input

Content
View full analysis
' [session_id] ``` ```bash python3 {baseDir}/scripts/migrateq_sse_api.py '' [session_id] ``` The forwarding rules in the same section require `question` to contain the user's original input without modification or translation. No shell-safe encoding procedure is specified. ### Technical Analysis The Skill permits Bash execution and instructs the agent to insert untrusted user input into a shell command between literal single quotes. Single quotes prevent ordinary expansion only while the input itself contains no single quote. An attacker can supply a quote that closes the argument, followed by shell operators and another command. The Python client does not independently launch a shell and is not directly vulnerable when invoked through a safe argument-array API. The vulnerability arises from the invocation procedure defined in `SKILL.md`, where an agent following the documented command template can pass the constructed string to Bash. This violates the separation between data and executable shell syntax. The additional requirement to preserve user input verbatim makes ad hoc filtering or rewriting incompatible with the current instructions. ### Attack Path 1. An attacker submits a migration question containing a single quote, shell separators, and a command, for example: ```text '; id > /tmp/migraq-command-injection; # ``` 2. The agent preserves the input verbatim as required by the forwarding rules. 3. The agent substitutes it into the documented Bash template: ```bash python3 .../migrateq_sse_api.py --no-auth ''; id > /tmp/migraq-command-injection; #' ``` 4. Bash treats the quote as the end of the `question` argument. 5. The injected command execu ...[truncated 801 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/migrateq_sse_api.py:417
Finding

Arbitrary Endpoint Override and Plaintext Transmission of User Data

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是面向用户的云迁移售前与规划能力,而给出的代码块并未执行任何资源扫描、选型推荐、成本计算或迁移分析逻辑。相反,它的核心职责是运维/安装辅助:检查运行环境、查询技能版本更新、读取环境变量中的密钥配置,并向 cmg.ai.tencentcloudapi.com 发起鉴权请求验证 API 可达性。这属于与声明主目的 materially different 的功能。虽然代码中提到“扫描、推荐、TCO分析等”作为文案说明,但并没有实际实现这些能力,因此描述与实际行为不符。

Content

No source excerpt is available for this finding.

Lp1

High
Category
MCP Least Privilege
Confidence
95% confidence
Finding

This script opens HTTPS connections to remote services for version checks and API connectivity tests while also accessing sensitive AK/SK values from the environment. Even though the current code does not explicitly exfiltrate the secrets, combining undeclared network and env capabilities in a skill materially increases risk because secrets are brought into process memory and transmitted in authenticated requests without an explicit permission boundary visible to users/platform policy.

Content

No source excerpt is available for this finding.

Lp1

High
Category
MCP Least Privilege
Confidence
95% confidence
Finding

This script opens HTTPS connections to remote services for version checks and API connectivity tests while also accessing sensitive AK/SK values from the environment. Even though the current code does not explicitly exfiltrate the secrets, combining undeclared network and env capabilities in a skill materially increases risk because secrets are brought into process memory and transmitted in authenticated requests without an explicit permission boundary visible to users/platform policy.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Dry-run mode emits authentication material to stdout without any warning, confirmation, or redaction. In practice this can leak signed headers into shell history, terminal scrollback, shared logs, screenshots, or CI systems, which is especially risky in a cloud-migration tool likely to be run by operators with privileged credentials.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes generic phrases like '帮我推荐' and '给我推荐', which are common in unrelated conversations. In this skill's context, broad activation is more dangerous because non-meta inputs are then forwarded to remote Tencent endpoints by default, potentially causing unintended transmission of user prompts or context to an external service.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The role definition at L030-L037 says the local skill should forward user input verbatim and transparently pass results through, without semantic modification. However, L074 and L143-L151 explicitly allow local rewriting/format transformation of prior results and appending additional context, which contradicts the stated "原样转发" and "结果透传" behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Lines L048-L049 state that questions like "你是谁" and "你能做什么" must be forwarded to the remote agent. But the routing table at L070-L074 and the unauthenticated examples at L092-L093 describe local handling for help/usage and include capability queries in the pre-sales category, creating contradictory operator guidance about where these requests are handled.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The rule 'all inputs except a small set of meta intents are forwarded remotely' creates an overly permissive exfiltration surface. In this skill's context, that means arbitrary user text—including unrelated or sensitive content accidentally present in the conversation—may be sent to external APIs, which is a real privacy and data-handling risk even though the destination is allowlisted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation explicitly states that authenticated and unauthenticated modes share the same SessionKey and preserve continuous context, but it does not warn users that sensitive context can bleed across trust boundaries. A user could begin in no-auth presales mode, then continue the same session in authenticated execution mode, causing prior untrusted prompts or previously disclosed sensitive details to influence privileged operations or be exposed in later responses.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

Skill manifest将 MigraQ 描述为云资源扫描、选型推荐、对标腾讯云、成本/TCO/报价等售前迁移评估能力。该脚本却多次向用户说明配置 AK/SK 后可解锁“迁移执行、集群管理等功能”,表明该技能实际覆盖或预期覆盖更广的执行性运维能力,超出了 manifest 中声明的范围。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script unconditionally reconfigures stdout/stderr for UTF-8 and hard-codes X-TC-Language to zh-CN, while all user-facing messages are written in Chinese. This imposes a specific language/locale behavior without offering the user a choice or documenting an opt-in, which matches the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The --dry-run path prints the full signed request metadata, including the Authorization header and SecretId-derived credential scope. While it does not reveal the SecretKey directly, it exposes a reusable signed request artifact and sensitive account-identifying data to logs, terminals, CI output, or other observers without a strong need for normal migration/recommendation workflows.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · scripts/migrateq_sse_api.py (reported line 636)May include surrounding context.

python
args = args[1:]

    # --no-auth 模式:免鉴权调用
    no_auth = False
    if args and args[0] == "--no-auth":
        no_auth = True
        args = args[1:]

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

get_remote_version 的文档写明“从 SkillHub 查询最新 Skill 版本”,并接收 name 参数,暗示按当前 skill 名称查询远端版本。实际实现仅对固定 URL 发起 GET 请求,未在请求中使用 name,因此注释/接口意图与代码行为存在直接偏差。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.