Back to skill

Security audit

Gangtise 文件列表

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed Gangtise document search and download helper, with expected credential/API use and a local-save caveat users should understand.

Install only if you intend to let the skill use Gangtise credentials and send search terms, filters, and file IDs to Gangtise. Leave GTS_SAVE_FILE unset unless you want local result files, and omit download flags unless you explicitly want files written to disk.

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

T09 · Insecure Skill Coding Practices

Note
Location
scripts/utils.py:46
Finding

Incorrect Boolean Parsing Causes Unintended Local Persistence of Search Results

Content
View full analysis

Vulnerability Details

File Location: scripts/utils.py:46, 1119
Vulnerability Type: Incorrect environment-variable boolean parsing
Risk Level: Low

Vulnerable Code

python
GTS_SAVE_FILE = os.getenv("GTS_SAVE_FILE", False)

The resulting value is later evaluated directly:

python
if GTS_SAVE_FILE:
    if output:
        process_path = output
        if os.path.exists(process_path):
            return_message = "错误信息:文件已存在"
            return return_message
    else:
        extension = GTS_SAVE_EXTENSION
        process_dir = os.path.join(gangtise_workspace_path, method_name)
        if not os.path.exists(process_dir):
            os.makedirs(process_dir, exist_ok=True)

Technical Analysis

Environment-variable values returned by os.getenv() are strings when configured. In Python, every non-empty string is truthy, including "False", "false", and "0".

Consequently, an operator who explicitly configures GTS_SAVE_FILE=False may reasonably expect result persistence to be disabled, but the condition at line 1119 evaluates to true. The application then enters the save branch and writes retrieved search results to Markdown or JSON files under the Gangtise workspace.

This behavior also conflicts with the status-reporting logic elsewhere in the same file, which recognizes only the exact string "True" as enabled and describes other configured values as disabled.

Attack Path

  1. A deployment manifest, shell profile, container configuration, or orchestration system sets GTS_SAVE_FILE=False.
  2. A search script imports scripts/utils.py.
  3. os.getenv() returns the non-empty string "False".
  4. A search request retrieves document metadata, summaries, or content from Gangtise.
  5. format_response() evaluates if GTS_SAVE_FILE:.
  6. The string "False" evaluates as true.
  7. Retrieved results are written to the Gangtise workspace despite the operator's ...[truncated 1049 chars]
Remediation
View remediation

Remediation Suggestions

Parse the environment variable into a real Boolean using a strict allowlist:

python
GTS_SAVE_FILE = os.getenv("GTS_SAVE_FILE", "false").strip().lower() in {
    "1",
    "true",
    "yes",
    "on",
}

For stricter configuration handling, reject unrecognized values rather than silently interpreting them:

python
raw_save_file = os.getenv("GTS_SAVE_FILE", "false").strip().lower()

if raw_save_file not in {"1", "0", "true", "false", "yes", "no", "on", "off"}:
    raise ValueError("Invalid GTS_SAVE_FILE value")

GTS_SAVE_FILE = raw_save_file in {"1", "true", "yes", "on"}

Additional hardening should include:

  • Use the parsed Boolean consistently in both operational and status-reporting logic.
  • Add tests covering unset, empty, true, false, zero, and mixed-case values.
  • Clearly document the directories where search results can be persisted.
  • Create result files with restrictive permissions where supported.
  • Avoid storing full document text unless the user explicitly requests persistence.
  • Consider a retention or cleanup policy for saved result and usage files.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (56)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the actual implementation is limited to meeting summaries, the advertised generic file-center functionality is overstated. The mismatch is dangerous because this skill is intended for locating and downloading evidence artifacts; confusing summary-module IDs with general file IDs can break verification workflows and undermine traceability.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The referenced documentation describes a different capability ('首席观点' search over analyst opinions) than the manifest-declared skill purpose of Gangtise file-center document retrieval and download assistance. This mismatch can misroute user queries, cause the agent to invoke unintended scripts/parameters, and lead to unauthorized or incorrect data access patterns, especially because the documented interface accepts broad search filters and returns metadata unrelated to the declared file workflow.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The implementation performs investment calendar/event retrieval rather than the manifest-declared file-center document search/download behavior. In an agent ecosystem, this capability mismatch is dangerous because it can cause the orchestrator or user to send sensitive search intent to the wrong tool and receive misleading results, breaking security assumptions and enabling data confusion or policy bypass at the workflow level.

Content

No source excerpt is available for this finding.

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/foreign_report.py (reported line 355)May include surrounding context.

python
te": "error", "message": str(e), "data": [], "usage": {}},
            "report",
        )


def _parse_str_list(raw: str) -> Optional[List[str]]:
    if not raw:
        return None
    items = [
        x.strip()
        for x in raw.replace(",", ",").split(",")
        if x.strip()
    ]
    return items or None


def main():
    import argparse

    parser = argparse.ArgumentParser(
        description="研报检索命令行:根据关键词、证券、机构等条件查找研究报告。",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument("-k", "--keyword", default="", help="检索查询关键词,可为空")
    parser.add_argument("-sd", "--start_date", default="", help="开始日期,格式YYYY-MM-DD")
    parser.add_argument("-ed", "--end_date", default="", help="结束日期,格式YYYY-MM-DD")
    parser.add_argument(
        "-l",
        "--limit",
        default=FILE_DEFAULT_LIMIT["report"],
        type=int,
        help

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/report.py (reported line 330)May include surrounding context.

python
te": "error", "message": str(e), "data": [], "usage": {}},
            "report",
        )


def _parse_str_list(raw: str) -> Optional[List[str]]:
    if not raw:
        return None
    items = [
        x.strip()
        for x in raw.replace(",", ",").split(",")
        if x.strip()
    ]
    return items or None


def main():
    import argparse

    parser = argparse.ArgumentParser(
        description="研报检索命令行:根据关键词、证券、机构等条件查找研究报告。",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument("-k", "--keyword", default="", help="检索查询关键词,可为空")
    parser.add_argument("-sd", "--start_date", default="", help="开始日期,格式YYYY-MM-DD")
    parser.add_argument("-ed", "--end_date", default="", help="结束日期,格式YYYY-MM-DD")
    parser.add_argument(
        "-l",
        "--limit",
        default=FILE_DEFAULT_LIMIT["report"],
        type=int,
        help

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/summary.py (reported line 444)May include surrounding context.

python
e": "error", "message": str(e), "data": [], "usage": {}},
            "summary",
        )


def _parse_str_list(raw: str) -> Optional[List[str]]:
    if not raw:
        return None
    items = [
        x.strip()
        for x in raw.replace(",", ",").split(",")
        if x.strip()
    ]
    return items or None


def main():
    import argparse

    parser = argparse.ArgumentParser(
        description="纪要检索命令行:根据关键词、证券、行业、机构等条件查找会议纪要。",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument("-k", "--keyword", default="", help="检索查询关键词,可为空")
    parser.add_argument("-sd", "--start_date", default="", help="开始日期,格式YYYY-MM-DD")
    parser.add_argument("-ed", "--end_date", default="", help="结束日期,格式YYYY-MM-DD")
    parser.add_argument(
        "-l",
        "--limit",
        default=FILE_DEFAULT_LIMIT["summary"],
        type=int,

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares access to environment-based credentials, optional local authorization file, networked API usage, and file download/write behavior, but does not declare any explicit tool scope such as allowed-tools or permissions. That creates an over-privileged and under-documented execution surface where an orchestrator or reviewer cannot easily constrain network, filesystem, or secret access to the minimum necessary.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s user-facing description and operating instructions are entirely in Chinese, and there is no indication that the skill is region-specific or that users may choose another language. This can violate language/locale policy because it implicitly forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This markdown file states that some parameters have no enumerated values and are matched 'intelligently' by the backend, but it does not define boundaries, supported forms, or examples of what should not be used. That ambiguity can cause unintended or overly broad matching behavior when users formulate requests.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The guidance tells users to pass intention-related text directly and rely on backend intelligent matching, but it does not specify precision requirements, exclusions, or disambiguation rules. For a manifest/markdown-style skill description, this leaves the trigger/input scope insufficiently bounded.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file presents all user-facing instructions in Chinese and does not offer an alternative language or indicate that the skill is intentionally limited to a Chinese-speaking audience. Under the policy, language-specific behavior should be opt-in or clearly justified as region- or locale-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file title and all operational instructions are written in Chinese, and line L14 specifically says research directions support Chinese names, indicating a language-specific interaction requirement. There is no indication that users may choose another language or that the Chinese-only constraint is required for a documented regional/compliance reason.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code hard-codes output field names and user-facing messages in Chinese, and the CLI help text is also entirely Chinese. The file does not provide any user opt-in or locale selection, which matches the policy concern for forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% 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/announcement.py (reported line 118)May include surrounding context.

python
data["searchType"] = search_type
        if rank_type:
            data["rankType"] = rank_type
        response = requests.post(COMPANY_ANNOUNCEMENT_URL, headers=headers, json=data)
        if response.status_code != 200:
            if all_results:
                return all_results, response.text.replace("\n", " ").replace("\r", " ").strip()

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file constructs returned data with fixed Chinese field names such as "标题", "中文标题", and "摘要", and the CLI interface text is also hard-coded in Chinese. That creates a language/locale constraint without any visible opt-in or alternative locale handling, which matches the language-policy violation category.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% 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/foreign_report.py (reported line 209)May include surrounding context.

python
if rank_type:
            data["rankType"] = rank_type

        response = requests.post(FOREIGN_REPORT_URL, headers=headers, json=data)
        if response.status_code != 200:
            if all_results:
                return all_results, response.text.replace("\n", " ").replace("\r", " ").strip()