Back to skill

Security audit

tender-similarity-analyzer

Security checks for vulnerabilities and agentic risk

Overview

This is a local document similarity tool, but its generated reports and runtime controls have security flaws that could expose sensitive report contents or disrupt other tools.

Review before installing. Use it only in an isolated Python environment, avoid the auto-install helper unless dependencies are pinned or reviewed, treat generated HTML reports as sensitive, and do not open reports from untrusted documents in a browser with network access. Expect the network-isolation code to affect the current Python process and prefer running the tool in a short-lived subprocess or container.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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/report/report_generator.py:313
Finding

Stored HTML and JavaScript Injection in Generated Reports

Content
View full analysis
str: """ Render the HTML report. @param data: Report data @return: HTML content """ # Attempt to load the template from a file if self.template_path.exists(): with open(self.template_path, 'r', encoding='utf-8') as f: template_content = f.read() template = Template(template_content) else: # Use the built-in template template = Template(self._get_default_template()) return template.render(**data) ``` Untrusted filenames and extracted document content are inserted into HTML contexts: ```html {% for file in file_list %} {{ loop.index }} {{ file.name }} {{ file.char_count }} {{ file.para_count }} {{ file.duplicate_count }} {% endfor %} ``` ```html {% for dup in duplicate_details %}
{% if dup.source_heading %}{{ dup.source_heading }} → {% endif %} {{ dup.source_file }} 第{{ dup.source_index }}段
{% if dup.target_heading %}{{ dup.target_heading }} → {% endif %} {{ dup.target_file }} 第{{ dup.target_index }}段
text
{{ dup.source.text }}
Remediation
View remediation
``` 6. Add regression tests using payloads containing `

T07 · Tool Hijacking and Spoofing

Warning
Location
scripts/security/network_isolator.py:65
Finding

Process-Wide HTTP Client Hijacking Persists After Isolation Is Disabled

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Mutable and Unverified Third-Party Dependency Installation

Content
View full analysis
=1.0.0 pdfplumber>=0.10.0 jieba>=0.42.1 scikit-learn>=1.0.0 sentence-transformers>=2.2.0 lxml>=4.9.0 beautifulsoup4>=4.12.0 simhash>=2.1.2 Jinja2>=3.0.0 ``` The dependency helper explicitly requests upgrades: ```python def install_requirements(packages: list, verbose: bool = True) -> bool: """ Install dependency packages. @param packages: List of package names @param verbose: Whether to show detailed information @return: Whether installation succeeded """ if not packages: return True try: cmd = [sys.executable, '-m', 'pip', 'install', '--upgrade'] + packages if verbose: print(f"[*] 正在安装依赖: {', '.join(packages)}") result = subprocess.run( cmd, capture_output=True, text=True, timeout=300 ) if result.returncode == 0: if verbose: print("[+] 依赖安装成功") return True else: if verbose: print(f"[!] 安装失败: {result.stderr}") return False except subprocess.TimeoutExpired: if verbose: print("[!] 安装超时,请检查网络连接") return False except Exception as e: if verbose: print(f"[!] 安装出错: {e}") return False ``` ### Technical Analysis The dependency specifications permit any future version greater than or equal to the stated minimum. No lock file, package hash, verified artifact set, or trusted repository configuration is provided. As a result, two installations performed at different times can resolve to different packages and transitive dependency trees. The `--upgrade` o ...[truncated 1774 chars]
Remediation
View remediation
python-docx== ``` 2. Generate a lock file that includes all transitive dependencies. 3. Require cryptographic hashes for every downloadable artifact, for example by using `pip-compile --generate-hashes` and: ```bash python -m pip install --require-hashes -r requirements.lock ``` 4. Remove `--upgrade` from the runtime helper. Dependency upgrades should be an explicit maintenance activity accompanied by review and testing. 5. Install dependencies in a dedicated virtual environment rather than the Agent's shared Python environment. 6. Configure an approved package index explicitly and disallow unexpected extra indexes. 7. Run dependency vulnerability and provenance checks in CI, and review lock-file changes before release. 8. Avoid prompting to install optional heavyweight dependencies that are not required by the invoked feature. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/main.py:116
Finding

Broken Security-Incident Handling Path Uses Undefined Symbols

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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (65)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/security/sandbox.py (reported line 22)May include surrounding context.

python
def __init__(self):
        self.system = platform.system()
        self.original_environ = os.environ.copy()
        self.restricted_paths = []
        
    def enforce(self):

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/security/sandbox.py (reported line 63)May include surrounding context.

python
# Linux 下的安全限制
        try:
            # 移除可能危险的 LD_ 前缀环境变量
            for key in list(os.environ.keys()):
                if key.startswith('LD_'):
                    os.environ.pop(key, None)
        except Exception:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill documentation, examples, and command format are presented exclusively in Chinese, including the required invocation phrase "查重 <目录路径>". This indicates a language-specific usage requirement without documenting user choice, opt-in, or a justified region-specific constraint, which matches the language/locale policy violation criteria.

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 and all user-facing prompts/messages are written only in Chinese, including the installation instruction trigger phrase and confirmation prompt. This imposes a specific language on users without presenting a language choice or documenting a justified locale restriction.

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 35)May include surrounding context.

python
def check_module_available(module_name: str) -> bool:
    """检查模块是否可用"""
    try:
        __import__(module_name)
        return True
    except ImportError:
        return False

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

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

python
if verbose:
            print(f"[*] 正在安装依赖: {', '.join(packages)}")
        
        result = subprocess.run(
            cmd,
            capture_output=True,
            text=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The main API exposes an auto_install path that can trigger pip-based network downloads and local environment modification with limited user-facing warning at the call site. In an agent/skill context, this is risky because invoking the helper may unexpectedly change the runtime, pull third-party code from the network, and expand supply-chain exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The save_to_file method writes the full edit history, including old_text and new_text contents, to disk. While the docstring states that it saves history to a file, there is no explicit warning or confirmation that potentially sensitive document contents will be persisted externally.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module-level and class-level documentation claim the editor only changes text and preserves formatting, but the implementation includes replace_paragraph(), which explicitly removes existing runs and therefore discards run-level formatting. This mismatch can mislead downstream agents or users into invoking the API in safety-critical or fidelity-sensitive workflows under false assumptions, causing unintended document corruption or policy bypass based on incorrect guarantees.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level docstring presents the skill entirely in Chinese, and there is no indication that users may choose another language or locale. Per the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This Python file contains natural-language docstrings and runtime print messages entirely in Chinese, including the main module description and progress output. Because the skill does not offer a language/locale option or explain that it is intentionally China-specific, it violates the language/locale policy for natural-language content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The print statements shown on execution are user-visible natural-language output, and they are hard-coded in Chinese. This forces a specific language for end users without any configuration, fallback, or documented justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The docstring at L267-L271 says the N-gram prefilter compares only body paragraphs and filters title-vs-title matches. However, the function actually iterates over classified['all_paras'] via all_paras_by_file and merges every paragraph from each file, with no check against classified['body_paras'] or title classification before similarity comparisons. This is an active contradiction between the stated intent and the implemented behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language descriptions and docstrings exclusively in Chinese, which effectively forces a specific language for maintainers or users interacting with the skill's embedded documentation. The file does not provide an opt-in language choice or explain that the skill is intentionally limited to a Chinese-speaking or region-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file contains all natural-language docstrings in Chinese, which effectively forces a specific language for maintainers or users reading generated help/documentation. Under the policy, a fixed language without user opt-in or documented justification is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring states '支持 .docx 和 .doc 格式', implying legacy .doc files are supported. However, all parsing paths call python-docx's Document() or directly read word/document.xml from a ZIP container, both of which apply to OOXML .docx files rather than binary .doc files, so the documentation contradicts actual behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This file contains natural-language docstrings and at least one user-facing ImportError message in Chinese only, which imposes a specific language without offering user choice. That matches the policy category for language or locale constraints lacking opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring says that on first use the tool will automatically detect and install missing dependencies. In reality, the code calls ensure_dependencies(auto_install=False) and, when dependencies are missing, prints a pip install command and exits. This is an active contradiction between documentation and behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The _alert_callback docstring explicitly states alerts are only printed locally and not sent externally. Later, on zero-exfiltration verification failure, the code calls self.alert_manager.send_alert(...), which contradicts the local-only claim in the in-code documentation. Even though the alert manager is undefined here, the intended behavior diverges from the documented intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The auto_fix_document function performs content modification and saves a new DOCX file via editor.save(output_path). While it prints status messages, there is no confirmation prompt or explicit warning that the tool will rewrite document content, and this function's purpose is not exposed with user-facing safeguards in this file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generator writes a full HTML report containing complete duplicated paragraph text and file metadata directly to a caller-supplied output path. In this skill context, the report is explicitly designed to include potentially sensitive bid/procurement document contents, so unrestricted report generation can lead to unintended disclosure if the path points to a shared, web-served, or otherwise unsafe location.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language docstrings and generated report text entirely in Chinese, including the returned audit report content. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the constraint is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The class documentation promises that no reversible sensitive information is logged, but log_operation accepts arbitrary kwargs and only excludes a very small denylist of keys. This means callers can accidentally persist secrets or personal data under different parameter names, creating a confidentiality risk and violating the module’s stated security guarantees.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module advertises '100% zero outbound' and 'complete network isolation', but it only monkey-patches selected Python APIs and explicitly permits localhost traffic. This can create a false sense of security: code can still communicate over loopback, use already-imported/native networking paths, or bypass patched entry points, leading operators to trust isolation guarantees that do not actually hold.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language descriptions and runtime messages entirely in Chinese, including the module docstring and later user-facing alerts/logs. The policy specifically flags language or locale constraints when a skill forces a specific language without user opt-in, and this file provides no alternative language selection or documented regional justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.