Back to skill

Security audit

Python venv 修复与标准库补齐

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Python troubleshooting guide, but it asks users to make privileged, persistent system changes with limited safeguards.

Review carefully before installing or using. Treat the sudo copy into /usr/local as a system-wide change: confirm package provenance, full ABI compatibility, existing destination files, backups, and rollback steps first. For the venv rebuild path, verify the exact absolute path before any rm -rf command and prefer renaming the old venv to a backup before deleting it.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:43
Finding

Unsafe Privileged Modification of a Shared Python Installation

Content
View full analysis
/bin/python3 -c "import sqlite3; print(sqlite3.sqlite_version)" sudo systemctl restart ``` ### Technical Analysis The instructions use root privileges to copy a native Python extension from an RPM-managed interpreter into a separately built, system-wide Python installation. Compatibility is assessed only through the Python minor version and filename suffix. The procedure does not verify: - The source file's package provenance or integrity. - The target interpreter's complete SOABI and build configuration. - Architecture and compiler compatibility beyond the hard-coded filename. - Linked native library compatibility. - Whether a destination file already exists and will be overwritten. - Destination ownership and permissions. - Whether other applications depend on the shared `/usr/local` interpreter. Native CPython extensions execute within the interpreter process and must match its ABI and linked-library expectations. A mismatch can produce import failures, interpreter crashes, memory corruption, or undefined behavior. Because the destination is shared rather than isolated to the virtual environment, the modification may affect multiple applications. ### Attack Path 1. An operator follows the documented repair procedure with `sudo`. 2. The source extension is incompatible, modified, or otherwise untrusted. 3. `sudo cp` places or overwrites `_sqlite3` in the shared `/usr/local` Python installation. 4. The verification command or restarted service imports `sqlite3`. 5. The interpreter loads the copied native extension into its process. 6. An incompatible module causes ...[truncated 686 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:58
Finding

Unvalidated Recursive Deletion of a User-Supplied Virtual Environment Path

Content
View full analysis
/usr/bin/python3.11 -m venv # 用 rpm 版,自带全套标准库 /bin/pip install -r requirements.txt ``` ``` ### Technical Analysis The repair procedure recursively deletes the path substituted for `` without validating that it is a virtual environment. It does not canonicalize the path, reject empty or system-critical paths, check for expected virtual-environment markers, create a backup, or request confirmation. Although `` is presented as a placeholder rather than directly interpolated shell input, an operator can substitute an incorrect path. Shell expansion, environment variables, typographical errors, or copied automation can make `rm -rf` target unrelated files. ### Attack Path 1. An operator replaces `` with an incorrect, empty, overly broad, or attacker-influenced path. 2. The command is run with the operator's current privileges. 3. `rm -rf` recursively removes every accessible file beneath that path without confirmation. 4. Application files, configuration, user data, or system files are destroyed. 5. The subsequent environment recreation may conceal that the original directory contained unrelated data. ### Impact Assessment The command can delete any files writable by the invoking account. If executed by an administrator, the impact can extend to system files, application installations, service data, and configurations. The primary consequences are data loss and service unavailability; no privilege escalation is required for exploitation. ]]>
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:58
Finding

Installation of Python Dependencies Without Integrity or Source Controls

Content
View full analysis
/usr/bin/python3.11 -m venv # 用 rpm 版,自带全套标准库 /bin/pip install -r requirements.txt ``` ``` ### Technical Analysis The instructions install all packages referenced by an unspecified `requirements.txt` without requiring exact version pins, cryptographic hashes, a trusted package index, or prior dependency review. Python package installation can execute build backend and installation-related code. Consequently, an attacker-controlled requirements file, dependency-confusion package, compromised package release, or unsafe package source can cause code execution during installation. The documentation does correctly use the virtual environment's `pip`, which limits installation scope, but a virtual environment does not sandbox package installation code from the invoking user's filesystem, credentials, network access, or processes. ### Attack Path 1. An attacker modifies `requirements.txt`, introduces a deceptive dependency name, or publishes a higher-priority package to a configured index. 2. The operator follows the repair instructions and runs the provided `pip install` command. 3. Pip resolves and downloads the attacker-controlled package. 4. The package's build or installation process executes arbitrary code. 5. That code accesses data and performs actions available to the invoking user. ### Impact Assessment A malicious dependency can execute code with the full privileges of the account running `pip`. Potential impact includes reading or modifying user-accessible files, accessing environment variables and credentials, making network requests, altering application code, and compromising the rebuilt environment. If the command is run as a privileged account, the impact expands a ...[truncated 121 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (3)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 44)May include surrounding context.

md
ldconfig -p | grep sqlite    # 本例需要 libsqlite3.so.0

# 3. 复制(cpython-311 后缀必须匹配目标 Python 小版本)
sudo cp /usr/lib64/python3.11/lib-dynload/_sqlite3.cpython-311-x86_64-linux-gnu.so \
        /usr/local/lib/python3.11/lib-dynload/

# 4. 验证 + 重启服务

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 49)May include surrounding context.

4. 验证 + 重启服务

/bin/python3 -c "import sqlite3; print(sqlite3.sqlite_version)" sudo systemctl restart

text

**注意:**

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill instructs users to run rm -rf <venv> to rebuild the environment, but it does not explicitly warn that this permanently deletes the virtual environment and anything stored inside it. In a troubleshooting skill, users may copy commands quickly under outage pressure, increasing the risk of accidental data loss if the path is wrong or the venv contains non-reproducible artifacts.

Content

No source excerpt is available for this finding.