Back to skill

Security audit

根据用户输入的需求描述生成测试用例

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local test-case generation helper with purpose-aligned scripts and no evidence of hidden data theft, backdoors, or destructive behavior.

Install only if you are comfortable with a Chinese-language local test-case workflow that reads requirement documents and testcase JSON and writes output files you specify. Review generated TestLink XML before importing it, avoid running unpinned pip installs in a privileged environment, and use the config manager only if you want persistent settings for this skill.

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/export_testcases.py:140
Finding

Unescaped Test-Case Data in TestLink XML Export

Content
View full analysis
') xml_lines.append(f' ')

xml_lines.append(f' ') for i, step in enumerate(steps.split('\n'), 1): xml_lines.append(f' <step_number></step_number>1') xml_lines.append(f' ') xml_lines.append(f' ')

text

### Technical Analysis

The TestLink exporter constructs XML by directly interpolating test-case fields into XML attributes and CDATA sections. These fields originate from JSON supplied through standard input and are not escaped or validated.

The `tc_id` and `title` values are inserted into the `name` attribute without XML attribute escaping. A quotation mark can terminate the attribute and allow injection of additional attributes or elements. The `precondition`, `step`, and `expected` values are inserted into CDATA sections without handling the CDATA terminator `]]>`. An attacker can therefore close the CDATA section and inject arbitrary XML markup.

For example, a malicious title could contain:

```text
malicious" injected="true

A malicious step could contain:

text
]]></actions></step><testcase name="Injected"><steps><![CDATA[

This can produce malformed XML or attacker-controlled elements in the exported document.

Attack Path

  1. An attacker supplies or influences requirement content or generated test-case JSON.
  2. The resulting test case contains quotation marks or ]]> sequences in a title, precondition, step, or expected result.
  3. A user invokes the TestLink export function ...[truncated 885 chars]
Remediation
View remediation
`.
  1. Validate every test-case record before serialization:
    • Require the expected number of fields.
    • Require string values for textual fields.
    • Apply reasonable field-length limits.
  2. Parse the completed output with a secure XML parser before writing or returning it to confirm that it is well formed.
  3. Add regression tests covering quotation marks, angle brackets, ampersands, and ]]> in every exported field.

A safer implementation should resemble:

python
import xml.etree.ElementTree as ET

testcase = ET.SubElement(
    testsuite,
    "testcase",
    {
        "name": f"{tc_id} {title}",
        "importance": priority_map.get(priority, "3"),
        "exec_order": "1",
    },
)
ET.SubElement(testcase, "preconditions").text = precondition

]]>

T08 · Insecure Dependencies

Note
Location
scripts/check_dependencies.py:47
Finding

Unpinned Third-Party Dependency Installation Guidance

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (31)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述覆盖了一个完整的测试用例生成平台,但给出的代码块只实现了其中很窄的一部分:需求变更对比和基于现有用例的增量更新建议。虽然“增量更新”与声明有部分重合,但代码并不会根据输入文档自动生成高质量测试用例,也没有实现所宣称的大多数高级功能。其主用途是离线 CLI 文件比较与更新计划生成,和声明中的核心能力存在明显差异,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

代码的实际主功能是“测试用例导出工具”,而不是声明中的“测试用例生成技能”。虽然声明中提到的“多格式导出”与代码行为一致,但这只是声明功能的一部分。该脚本通过命令行参数选择导出格式,并从标准输入读取现成的测试用例数据后写入文件,支持 CSV、Markdown、JSON、XMind 兼容 JSON 和 TestLink XML。它没有任何从文本或文档生成测试用例的逻辑,也没有实现高级分析、评分、评审、增量更新或 prompt/config 定制等能力。因此,描述明显夸大并偏离了代码的实际用途,属于描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明的核心用途是“测试用例生成”,且列出多项高级测试管理与生成能力;但实际代码只是一个需求文档提取脚本,负责读取 txt/docx/pdf 并返回文本内容。虽然“支持文本/文档输入”与代码的文件读取行为部分一致,但这只是输入预处理,不构成所声明的主要功能。代码没有任何测试用例生成、分析、评分、导出、评审或增量更新逻辑,因此描述与实际行为存在明显且实质性的不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

该代码块的核心功能是“根据现有测试用例生成测试数据并导出”,而不是声明中的“测试用例生成技能”。虽然声明中提到包含测试数据生成功能,这与代码部分吻合,但代码并未实现声明中大部分关键能力,尤其是最主要的测试用例自动生成功能。输入也不是文本/文档,而是结构化 JSON。未发现明显越权或额外敏感操作,但其实际主功能与声明主功能存在实质性偏差,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

描述的核心能力是“自动生成测试用例”,而代码的实际核心功能是“对已有测试用例进行质量评分”。虽然描述中提到“内置依赖检测、质量评分”,代码中确实包含独立性/依赖性检查和质量评分,但这只是描述中的一小部分,且并不能支撑其作为完整“测试用例生成技能”的主要定位。代码没有实现生成、文档解析、导出、测试数据生成、增量更新或 prompt 定制等关键声明能力,因此描述与实际行为存在明显且实质性的偏差。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

描述将该技能定位为“测试用例生成”系统,核心能力应是从输入内容自动产出测试用例,并附带多项高级生成相关功能。但代码仅处理已有的 JSON 测试用例集合,提供统计、去重、筛选、批量修改和保存等评审维护能力。虽然声明中提到“用例评审、增量更新”等部分与代码有少量重合,但代码的主要用途明显不是生成,而是审查和管理现有用例。因此描述与实际行为存在显著不一致,属于功能主旨和能力范围的实质性错配。

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/generate_testdata.py (reported line 126)May include surrounding context.

python
"超大字符串": "x" * 10000,
        "恶意 HTML": "<img src=x onerror=alert(1)>",
        "恶意 JS": "javascript:alert(document.cookie)",
        "路径遍历": "../../etc/passwd",
        "命令注入": "; rm -rf /",
        "超长 URL": "http://" + "a" * 2000 + ".com",
        "非法 JSON": "{invalid json}",

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
100% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/generate_testdata.py (reported line 127)May include surrounding context.

python
"恶意 HTML": "<img src=x onerror=alert(1)>",
        "恶意 JS": "javascript:alert(document.cookie)",
        "路径遍历": "../../etc/passwd",
        "命令注入": "; rm -rf /",
        "超长 URL": "http://" + "a" * 2000 + ".com",
        "非法 JSON": "{invalid json}",
        "编码错误": "\xff\xfe",

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/generate_testdata.py (reported line 127)May include surrounding context.

python
"恶意 HTML": "<img src=x onerror=alert(1)>",
        "恶意 JS": "javascript:alert(document.cookie)",
        "路径遍历": "../../etc/passwd",
        "命令注入": "; rm -rf /",
        "超长 URL": "http://" + "a" * 2000 + ".com",
        "非法 JSON": "{invalid json}",
        "编码错误": "\xff\xfe",

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
100% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/generate_testdata.py (reported line 127)May include surrounding context.

python
"恶意 HTML": "<img src=x onerror=alert(1)>",
        "恶意 JS": "javascript:alert(document.cookie)",
        "路径遍历": "../../etc/passwd",
        "命令注入": "; rm -rf /",
        "超长 URL": "http://" + "a" * 2000 + ".com",
        "非法 JSON": "{invalid json}",
        "编码错误": "\xff\xfe",

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/generate_testdata.py (reported line 127)May include surrounding context.

python
"恶意 HTML": "<img src=x onerror=alert(1)>",
        "恶意 JS": "javascript:alert(document.cookie)",
        "路径遍历": "../../etc/passwd",
        "命令注入": "; rm -rf /",
        "超长 URL": "http://" + "a" * 2000 + ".com",
        "非法 JSON": "{invalid json}",
        "编码错误": "\xff\xfe",

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Using subprocess.run with shell=True is a classic tool-parameter abuse pattern because the shell interprets metacharacters, redirections, and chaining operators. In an agent skill context, test harnesses are often run in automation environments; if command components become configurable, an attacker could execute arbitrary commands on the host.

Content

Scanner excerpt · scripts/run_all_tests.py (reported line 19)May include surrounding context.

python
print(f"命令:{command}")
    
    try:
        result = subprocess.run(
            command,
            shell=True,
            capture_output=True,

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill documentation advertises commands that read files, write output files, and invoke Python scripts, but it declares no explicit tool scope such as allowed tools or permissions. That creates an overbroad trust boundary: an agent may infer it can use shell and filesystem access without user-visible constraints, increasing the chance of unintended file access or command execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The config uses Chinese-only labels and required field names in user-facing values, which indicates the skill is constrained to a specific language/locale. There is no visible opt-in, alternative locale support, or documented justification that this is intended to be region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The markdown instructions are entirely written as mandatory Chinese-language guidance and do not indicate that users may choose another language or locale. Under the policy criteria, a skill that effectively enforces a specific language without opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file title and all instruction text are written in Chinese, establishing a single-language requirement for the skill's behavior. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file includes a natural-language instruction specifying '语言:中文', which imposes a specific language on output. Under the policy rule, language constraints should offer user choice or be clearly justified; here no opt-in or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring is written entirely in Chinese, and the script's user-facing messages are also exclusively Chinese, indicating a fixed language choice. For a general-purpose dependency checker, this appears to impose a locale without offering user opt-in or documenting a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/check_dependencies.py (reported line 15)May include surrounding context.

python
import_name = package_name
    
    try:
        __import__(import_name)
        return True, None
    except ImportError as e:
        return False, str(e)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings and docstrings exclusively in Chinese, including the tool description and CLI usage/help output. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which it is not here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s natural-language interface and descriptions are entirely in Chinese, including the tool name, usage, docstrings, and error messages, with no indication that users may choose another language. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The user-facing usage string is presented only in Chinese, and the script’s returned error messages elsewhere follow the same pattern. This creates a fixed-language interface without offering users a language choice or explaining a justified locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code file contains user-facing natural-language descriptions entirely in Chinese, including the tool description and evaluation dimensions, with no indication that language selection is optional. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

L130 的用法说明声明脚本接受“<测试用例 JSON 文件> [需求 JSON 文件]”,意味着提供第二个位置参数时就会读取需求文件。但实际在 L154 使用 if len(sys.argv) > 3,只有传入额外第三个参数后才会读取 sys.argv[2],这与文档化接口行为直接矛盾,并影响评分功能是否按说明工作。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script's user-visible CLI usage, scoring report, grade labels, and improvement suggestions are all emitted only in Chinese. Because the file does not offer a language option or document a justified region-specific scope, this appears to enforce a single locale contrary to the language-choice policy.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.