Back to skill

Security audit

HUDC Bidding Information Capture

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent local SGCC tender-document analyzer, but it can automatically install unpinned Python packages into the user's environment when run.

Review before installing. The skill appears intended to process local SGCC tender documents and create a local Excel report, but run it only in a dedicated virtual environment or after manually installing pinned dependencies; avoid letting it modify a system Python installation automatically.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
scripts/analyze.py:31
Finding

Automatic Runtime Installation of Unpinned Dependencies

Content
View full analysis

Vulnerability Details

File Location: scripts/analyze.py:31-38
Vulnerability Type: Unpinned runtime dependency installation from a mutable package repository
Risk Level: Medium

Vulnerable Code

python
def _ensure(pkg, import_name=None):
    try:
        __import__(import_name or pkg)
    except ImportError:
        print(f"  [安装] 正在安装 {pkg} ...")
        os.system(f"pip3 install {pkg} --break-system-packages -q 2>/dev/null")

_ensure("python-docx", "docx")
_ensure("openpyxl")
_ensure("pdfplumber")

Technical Analysis

When an imported library is unavailable, the script invokes pip3 to download and install the corresponding package automatically. The package versions and artifact hashes are not pinned, so the code installed during any given execution can differ from the code that was originally audited.

Python package installation can execute package build logic and subsequently imports the installed libraries. Consequently, compromise of an upstream package release, transitive dependency, configured package index, or package-delivery path could introduce attacker-controlled code.

The use of --break-system-packages bypasses protections intended to prevent modification of an externally managed system Python environment. Redirecting standard error to /dev/null also conceals installation diagnostics that could reveal repository, certificate, resolution, or build failures.

The package names are fixed literals rather than user-controlled values. Therefore, the reviewed code does not expose a direct shell-command injection path through the pkg argument during its normal execution.

Attack Path

  1. A required library is absent from the Python environment.
  2. The user runs scripts/analyze.py.
  3. _ensure() constructs and executes an external pip3 install command.
  4. pip3 resolves the unpinned package and its transitive dependencies from the active package-index configuration.
  5. An attacker controlling a package re ...[truncated 943 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove automatic dependency installation from application runtime. If a dependency is unavailable, terminate with a clear message and explicit setup instructions.
  2. Declare dependencies in a lock file with exact versions and cryptographic hashes, such as a hash-locked requirements.txt.
  3. Install dependencies during a separate, controlled setup step inside a dedicated virtual environment.
  4. Use a trusted, explicitly configured package index and require TLS verification.
  5. Audit and pin transitive dependencies, not only the three direct dependencies.
  6. Remove --break-system-packages to avoid modifying an externally managed system Python installation.
  7. Do not suppress installation errors. Preserve actionable diagnostics while ensuring logs do not expose credentials embedded in repository URLs.
  8. In higher-assurance environments, install from pre-reviewed internal wheels or a controlled artifact repository and verify package signatures or hashes before installation.

A safer runtime pattern is:

python
def _require(pkg, import_name=None):
    try:
        __import__(import_name or pkg)
    except ImportError as exc:
        raise SystemExit(
            f"Missing dependency: {pkg}. "
            "Install the audited, pinned dependencies in a virtual environment."
        ) from exc

_require("python-docx", "docx")
_require("openpyxl")
_require("pdfplumber")
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

The script executes a shell command to install packages at runtime, which modifies the host environment and executes code fetched from package indexes without explicit user consent. Even though the package names are currently hardcoded, this is risky in a skill context because running the analyzer can trigger arbitrary third-party installation and package setup code on the user's machine.

Content

Scanner excerpt · scripts/analyze.py (reported line 37)May include surrounding context.

python
__import__(import_name or pkg)
    except ImportError:
        print(f"  [安装] 正在安装 {pkg} ...")
        os.system(f"pip3 install {pkg} --break-system-packages -q 2>/dev/null")

_ensure("python-docx", "docx")
_ensure("openpyxl")

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger phrases are broad enough to match common user requests such as analyzing bid documents or files on the desktop, which can cause the skill to activate when the user did not explicitly intend to run this specific local-file processing workflow. Because the skill scans local desktop content and produces structured output, accidental activation could lead to unintended access, processing, or disclosure of sensitive procurement documents.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Installing Python packages at runtime is not necessary for document parsing itself and expands the script's capabilities from analysis into system modification and remote code acquisition. In an agent skill, this is especially dangerous because users may not expect execution to alter the Python environment or run installer-controlled code paths.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script silently runs a package installation shell command after only printing a brief status message, without a clear warning that it will execute system commands and modify the environment. This creates a consent and transparency problem and increases the likelihood that users unknowingly execute risky actions in a trusted analysis workflow.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The script dynamically imports module names derived from function arguments, which reduces auditability and can become dangerous if those values are ever made attacker-controlled or modified in future revisions. In this file the immediate callers are hardcoded, but this pattern is coupled with runtime package installation and materially increases the risk of loading unexpected code from the environment.

Content

Scanner excerpt · scripts/analyze.py (reported line 34)May include surrounding context.

python
# ========== 依赖加载 ==========
def _ensure(pkg, import_name=None):
    try:
        __import__(import_name or pkg)
    except ImportError:
        print(f"  [安装] 正在安装 {pkg} ...")
        os.system(f"pip3 install {pkg} --break-system-packages -q 2>/dev/null")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The README presents the skill exclusively in Chinese, including the title, setup instructions, workflow, and FAQ, without offering an alternative language or noting that the skill is intended only for Chinese-speaking users. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

This markdown file instructs the user to run the analysis script and states that it outputs ~/Desktop/sgcc_result.xlsx, but it does not include any explicit user warning about processing local tender documents or potential overwrite of the output file. For a skill that reads user files and writes a structured report, a brief disclosure about local file access and output-file effects would improve safety transparency.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The comment text is written entirely in Chinese and the configuration values are Chinese-language keywords, with no indication that language selection is optional or that the skill is intentionally restricted to a Chinese-language context. Under the policy rule, a forced language/locale without opt-in or documented justification can be a natural-language policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The entire skill documentation is written in Chinese and does not indicate that other languages are supported or that the language choice is intentional and limited to a specific locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

User-facing strings in the module docstring and runtime output are written exclusively in Chinese, with no indication that another language can be selected. This can violate a language/locale policy when the skill is expected to support user choice rather than impose a fixed language by default.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.