Back to skill

Security audit

广州日报/融媒云通用测试助手

Security checks for vulnerabilities and agentic risk

Overview

This testing skill is not deceptive, but it can send credentials, security probes, and load-test traffic to user-supplied URLs and can auto-install packages, so it needs careful review before installation.

Install only if you intend to use it in an authorized Guangzhou Daily/Rongmei Cloud test environment. Do not use production tokens or production write endpoints, avoid third-party or internal URLs unless explicitly approved, and install dependencies manually in an isolated environment rather than allowing the scripts to run pip automatically.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/api_test.py:31
Finding

Bearer Tokens and Sensitive Headers Can Be Sent to Arbitrary or Plaintext Destinations

Content
View full analysis

Vulnerability Details

File Location: scripts/api_test.py, lines 31–55 and 249–252
Vulnerability Type: Unrestricted transmission of authentication credentials
Risk Level: High

Vulnerable Code

python
def run_test(url, method="GET", data=None, token=None, headers=None, timeout=10):
    """执行单次接口测试"""
    req_headers = {
        "Content-Type": "application/json",
        "User-Agent": "gz-media-tester/1.0",
        "Accept": "application/json",
    }
    if token:
        req_headers["Authorization"] = f"Bearer {token}"
    if headers:
        req_headers.update(headers)

    body_str = ""
    try:
        start = time.time()
        if method.upper() == "GET":
            resp = requests.get(url, headers=req_headers, timeout=timeout)
        elif method.upper() == "POST":
            body_str = json.dumps(data, ensure_ascii=False) if data else ""
            resp = requests.post(url, headers=req_headers, data=body_str, timeout=timeout)
        elif method.upper() == "PUT":
            body_str = json.dumps(data, ensure_ascii=False) if data else ""
            resp = requests.put(url, headers=req_headers, data=body_str, timeout=timeout)
        elif method.upper() == "DELETE":
            resp = requests.delete(url, headers=req_headers, timeout=timeout)
python
parser.add_argument("url", help="接口URL")
parser.add_argument("method", nargs="?", default="GET", help="HTTP方法(GET/POST/PUT/DELETE)")
parser.add_argument("--data", help="POST请求体(JSON字符串)")
parser.add_argument("--token", help="Bearer Token")

Technical Analysis

The destination URL is entirely caller-controlled. When a token is supplied, the script unconditionally attaches it as an Authorization: Bearer header. Arbitrary additional headers are handled in the same way.

The script does not require HTTPS, validate the destination hostname, compare the destination against an approved test envi ...[truncated 1432 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require https:// whenever authentication data is present and reject plaintext HTTP.
  2. Permit credentials only for explicitly approved test and staging hostnames.
  3. Require interactive confirmation before forwarding credentials to a hostname not previously approved by the user.
  4. Reject URLs containing embedded usernames or passwords and reject schemes other than HTTP and HTTPS.
  5. Validate every redirect destination before allowing authentication headers to be forwarded.
  6. Do not accept long-lived secrets directly through command-line arguments. Prefer environment variables, protected files, standard input, or an operating-system credential store.
  7. Use short-lived, least-privileged test tokens and ensure production credentials are not accepted by default.
  8. Redact authentication values from logs, reports, exception messages, and diagnostic output.

T08 · Insecure Dependencies

Warning
Location
scripts/api_test.py:210
Finding

Automatic Installation of an Unpinned Runtime Dependency

Content
View full analysis

Vulnerability Details

File Location: scripts/api_test.py, lines 210–218; scripts/check_url.py, lines 191–196
Vulnerability Type: Unsafe runtime dependency installation
Risk Level: Medium

Vulnerable Code

python
def check_install():
    """检查依赖"""
    if not HAS_REQUESTS:
        print("⚠️ 缺少 requests 库,正在安装...")
        subprocess.run([sys.executable, "-m", "pip", "install", "requests", "-q"], check=True)
        global HAS_REQUESTS
        HAS_REQUESTS = True
        print("✅ requests 安装完成\n")
python
def check_install():
    if not HAS_REQUESTS:
        print("⚠️ 缺少 requests 库,正在安装...")
        subprocess.run([sys.executable, "-m", "pip", "install", "requests", "-q"], check=True)
        global HAS_REQUESTS
        HAS_REQUESTS = True

Technical Analysis

Both network-facing scripts automatically invoke pip when requests is unavailable. The package version is not pinned, no package hash is verified, and no lock file or trusted package-index policy is supplied.

Installation occurs during normal execution rather than through an explicit setup step. It therefore modifies the active Python environment without separate user approval. Pip configuration and index selection may be inherited from the host, so the downloaded artifact can vary between environments and over time.

Python package installation can execute package build or installation logic. Consequently, compromise of the selected package index, an upstream package release, local pip configuration, or dependency resolution path can turn this operation into arbitrary code execution under the account running the Skill.

Attack Path

  1. The script runs in an environment where requests is absent.
  2. check_install automatically invokes the environment's pip executable.
  3. Pip resolves the mutable package name through its configured package index or mirror.
  4. A compromised or malicious artifact is ...[truncated 500 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove automatic dependency installation from runtime code.
  2. Declare dependencies in a version-controlled requirements or lock file.
  3. Pin requests and its transitive dependencies to reviewed versions.
  4. Use package hashes, such as pip's --require-hashes, to verify downloaded artifacts.
  5. Install dependencies during an explicit setup phase in an isolated virtual environment.
  6. Configure an approved package index and disable untrusted extra indexes.
  7. If a dependency is missing, terminate safely and display installation instructions rather than modifying the environment.
  8. Add automated dependency scanning and a controlled update process.

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/check_url.py:29
Finding

Unrestricted URL Fetching Enables Server-Side Request Forgery Against Internal Services

Content
View full analysis

Vulnerability Details

File Location: scripts/check_url.py, lines 29–58, 114–126, and 224–245
Vulnerability Type: Server-side request forgery and internal network access
Risk Level: High

Vulnerable Code

python
def check_url(url, timeout=10, follow_redirects=True, verify_ssl=True):
    """检查单个URL"""
    result = {
        "url": url,
        "status": "unknown",
        "http_code": None,
        "response_time_ms": None,
        "final_url": None,
        "title": None,
        "content_type": None,
        "error": None,
        "ssl": None,
        "recommendations": [],
    }

    headers = {
        "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) "
                      "AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
    }

    try:
        start = time.time()
        resp = requests.get(
            url,
            headers=headers,
            timeout=timeout,
            allow_redirects=follow_redirects,
            verify=verify_ssl,
        )
python
try:
    parsed = urlparse(url)
    if parsed.scheme == "https":
        import ssl
        import socket
        ctx = ssl.create_default_context()
        with socket.create_connection((parsed.netloc, 443), timeout=timeout) as sock:
            with ctx.wrap_socket(sock, server_hostname=parsed.netloc) as ssock:
                cert = ssock.getpeercert()
                result["ssl"] = {
                    "valid": True,
                    "subject": dict(x[0] for x in cert.get("subject", [])),
                    "issuer": dict(x[0] for x in cert.get("issuer", [])),
                }
except Exception:
    pass
python
if args.preset:
    urls = PRESET_URLS.get(args.preset, [])
    print(f"📋 预设测试组:{args.preset}({len(urls)} 个链接)")
elif args.batch:
    with open(args.batch, "r", encoding="utf-8") a
...[truncated 2274 chars]
Remediation
View remediation

Remediation Suggestions

  1. Accept only http and https schemes.
  2. Resolve the hostname before connecting and reject loopback, private, link-local, reserved, multicast, unspecified, and documentation address ranges.
  3. Explicitly block cloud metadata addresses, including 169.254.169.254, and their IPv6 equivalents.
  4. Revalidate the scheme, hostname, port, and resolved addresses after every redirect.
  5. Disable redirects by default or implement a small, validated redirect limit.
  6. Restrict destination ports to those needed for the declared testing function.
  7. Use an explicit approved-domain allowlist when operating as an autonomous agent.
  8. Protect against DNS rebinding by connecting only to the validated resolved address while preserving the expected HTTP host and TLS server name.
  9. Require explicit user authorization before testing internal addresses.
  10. Apply network-level egress controls so the process cannot reach metadata endpoints or sensitive internal management networks.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/api_test.py:132
Finding

Security and Performance Modes Can Send Mutating or Excessive Traffic to Unverified Targets

Content
View full analysis

Vulnerability Details

File Location: scripts/api_test.py, lines 132–200 and 254–290
Vulnerability Type: Unrestricted active security testing and flawed load-rate enforcement
Risk Level: High

Vulnerable Code

python
def run_security_tests(url, token=None):
    """执行安全测试"""
    print("\n" + "=" * 60)
    print("  🔒 安全测试套件")
    print("=" * 60)

    tests = [
        ("SQL注入(OR 1=1)", {"username": "' OR 1=1 --", "password": "any"}),
        ("XSS攻击", {"content": "<script>alert(1)</script>"}),
        ("空Token访问", None),
        ("超长参数(1024字符)", {"content": "A" * 1024}),
    ]

    for name, payload in tests:
        print(f"\n--- {name} ---")
        if payload is None:
            # 空Token测试
            r = run_test(url, "POST", {}, token="invalid_token_abc123")
        else:
            r = run_test(url, "POST", payload, token=token)
        print_result(r)
python
def run_performance_test(url, method="GET", token=None, qps=10, duration=10):
    """简单性能测试"""
    print("\n" + "=" * 60)
    print(f"  ⚡ 性能测试({qps} QPS,持续{duration}秒)")
    print("=" * 60)

    if not HAS_REQUESTS:
        print("⚠️ 需要安装 requests 库:pip3 install requests")
        return

    import threading
    results = {"success": 0, "fail": 0, "slow": 0, "times": []}
    lock = threading.Lock()
    interval = 1.0 / qps
    end_time = time.time() + duration

    def worker():
        while time.time() < end_time:
            r = run_test(url, method, token=token)
            with lock:
                results["times"].append(r.get("elapsed_ms", 0))
                if "FAIL" in r.get("result", ""):
                    results["fail"] += 1
                else:
                    results["success"] += 1
                    if r.get("elapsed_ms", 0) > 1000:
                        results["slow"] += 1
            time.sleep(interval)

    threads 
...[truncated 3006 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict active tests to explicit test and staging environment allowlists.
  2. Require a positive authorization confirmation that identifies the target, environment, test type, maximum rate, and duration.
  3. Add a dry-run mode that prints all planned requests without transmitting them.
  4. Block security mode and mutating HTTP methods for known production domains.
  5. Introduce conservative hard maximums for QPS, duration, thread count, and total request count.
  6. Replace per-thread sleeping with a shared token-bucket or leaky-bucket rate limiter so aggregate traffic cannot exceed the configured rate.
  7. Validate that QPS and duration are positive and within approved bounds.
  8. Add a global cancellation mechanism and stop testing when error rates or latency exceed safety thresholds.
  9. Use dedicated, least-privileged test accounts and disposable test data.
  10. Log authorization and test parameters without recording bearer tokens or sensitive request bodies.
  11. Separate functional API testing from active security and load testing so higher-risk modes require an additional explicit capability.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (24)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

该描述将技能包装为“通用测试助手”,覆盖大量前端与客户端测试场景,但提供的代码仅是一个API测试CLI工具,核心能力集中在HTTP接口请求、响应判断、简单安全探测和简单性能测试。其主要用途与声明中的第(6)项“后端接口自动化测试”基本一致,但不足以支撑所宣称的APP、H5、小程序、CMS后台等广泛测试范围,也不具备测试用例生成、Bug单撰写等能力。因此属于描述明显宽于实际实现、且主能力范围被夸大的不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill declares operational behaviors that imply file access, shell execution, and outbound network activity, but it does not constrain those capabilities with an explicit tool scope. In an agent setting, missing scope boundaries can allow broader-than-expected execution against local files or user-supplied targets, increasing the risk of SSRF, unintended system access, or unsafe command execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger keywords include very common terms such as '测试' and 'test', which can cause the skill to activate in unrelated conversations. Because this skill can lead to network testing actions and script execution, accidental activation increases the chance of unintended requests, data handling, or confusing tool use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to test arbitrary interfaces and URLs supplied by the user without clearly warning that live network requests will be sent. In context, a testing skill is more dangerous because users expect automation; without explicit safeguards, it can be abused for SSRF-style probing, internal endpoint access, or sending requests to production systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file describes Bearer token authentication and later lists login and upload endpoints, but it does not include any warning about protecting tokens, avoiding credential exposure, or the privacy impact of transmitting user files. Under the markdown-specific SQP-2 criteria, documentation that describes behaviors affecting user data or privacy should disclose those risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire skill file is written in Chinese and presents all test case content exclusively in that language, with no indication that users may choose another language or that the skill is limited to a Chinese-only audience. Under the policy provided, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The tool includes an active 'security test' mode that sends SQL injection, XSS, invalid-token, and oversized-input payloads to a target endpoint. This exceeds passive API testing and can be misused to probe or attack systems, especially because the skill is framed as a general testing assistant rather than a dedicated authorized security-testing tool.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code changes the execution environment by auto-installing dependencies, which is not necessary for a normal testing helper and expands the skill's operational capability beyond simple request execution. This can introduce supply-chain and integrity risks and surprises users by performing networked system modification as a side effect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Automatic package installation occurs without prior confirmation, causing unannounced network access and local environment changes. Because pip installation can run setup/build steps and resolve from external indexes, this creates a meaningful supply-chain execution risk on the machine running the script.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The script automatically invokes pip to install a package at runtime, which modifies the host environment and executes package installation logic without explicit user confirmation. In a skill/testing-tool context, this is risky because a simple run of the script can trigger unexpected network access and dependency changes, and if package sources are compromised it can lead to arbitrary code execution during install.

Content

Scanner excerpt · scripts/api_test.py (reported line 215)May include surrounding context.

python
"""检查依赖"""
    if not HAS_REQUESTS:
        print("⚠️ 缺少 requests 库,正在安装...")
        subprocess.run([sys.executable, "-m", "pip", "install", "requests", "-q"], check=True)
        global HAS_REQUESTS
        HAS_REQUESTS = True
        print("✅ requests 安装完成\n")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/api_test.py (reported line 228)May include surrounding context.

python
epilog="""
示例:
  # 单次GET请求
  python3 api_test.py "https://api.example.com/news/list?page=1&size=10"

  # POST登录接口
  python3 api_test.py "https://api.example.com/user/login" POST \\

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/api_test.py (reported line 231)May include surrounding context.

python
epilog="""
示例:
  # 单次GET请求
  python3 api_test.py "https://api.example.com/news/list?page=1&size=10"

  # POST登录接口
  python3 api_test.py "https://api.example.com/user/login" POST \\

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/api_test.py (reported line 235)May include surrounding context.

python
epilog="""
示例:
  # 单次GET请求
  python3 api_test.py "https://api.example.com/news/list?page=1&size=10"

  # POST登录接口
  python3 api_test.py "https://api.example.com/user/login" POST \\

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/api_test.py (reported line 239)May include surrounding context.

python
epilog="""
示例:
  # 单次GET请求
  python3 api_test.py "https://api.example.com/news/list?page=1&size=10"

  # POST登录接口
  python3 api_test.py "https://api.example.com/user/login" POST \\

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/api_test.py (reported line 244)May include surrounding context.

python
epilog="""
示例:
  # 单次GET请求
  python3 api_test.py "https://api.example.com/news/list?page=1&size=10"

  # POST登录接口
  python3 api_test.py "https://api.example.com/user/login" POST \\

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script modifies the local environment by automatically invoking pip to install requests at runtime. Even though the package name is fixed and the stated purpose is usability, silent dependency installation is risky because it performs an unexpected external fetch and code installation, which can change the host environment and execute package install hooks without explicit operator approval.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This is a true security issue because the script runs pip automatically, without prior confirmation, when requests is missing. That introduces unreviewed network activity and package installation into a URL-checking tool, creating supply-chain and environment-integrity risk disproportionate to the tool's stated function.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

A natural-language policy issue exists when a skill or reference forces a specific language without user opt-in or documented locale justification. This file presents all instructions and descriptions only in Chinese, with no note that it is intended for a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file uses only Chinese headings, instructions, and examples, which effectively forces a specific language for users of the skill. Under the policy, a language constraint should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains user-facing natural language exclusively in Chinese, starting from the title and continuing throughout the document. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation, and the file does not indicate that the content is region-specific or provide an alternative language option.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The markdown template is entirely written in Chinese, including the title and all field labels, which implies a fixed language requirement for generated reports. There is no natural-language indication that users may choose another language or that the template is restricted to a Chinese-only organizational context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The natural-language description, usage text, and all user-facing messages are presented only in Chinese, which imposes a specific language choice on users. There is no indication that the tool is region-locked or that users can opt into another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script's user-facing description, help text, and output messages are entirely in Chinese, with no indication that another language can be selected. Under the stated policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The script issues outbound HTTP requests to user-provided targets and follows redirects, which transmits the supplied URLs and request metadata to remote servers. While network access is central to a URL checker, the file's usage/help text does not disclose that entered URLs will be contacted over the network.

Content

No source excerpt is available for this finding.