Back to skill

Security audit

Emby Tv Organizer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a mostly coherent Emby TV-folder organizer, but it can mutate files and automatically install an unpinned Python package at runtime, so users should review it before installing.

Install only if you are comfortable with a skill that can rename or move media files after confirmation and generate spreadsheets containing local paths. Prefer preinstalling a pinned openpyxl dependency and disabling runtime pip installs before use; also review generated Excel files carefully when filenames may come from untrusted sources.

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

T08 · Insecure Dependencies

Error
Location
scripts/generate_excel.py:24
Finding
Automatic Installation of an Unpinned Runtime Dependency## Vulnerability Details **File Location**: `scripts/generate_excel.py`, lines 24-32 **Vulnerability Type**: Supply-chain exposure through automatic dependency installation **Risk Level**: High ### Code Evidence ```python try: import openpyxl from openpyxl.styles import Font, PatternFill, Alignment, Border, Side from openpyxl.utils import get_column_letter except ImportError: print("缺少 openpyxl,正在安装...") import subprocess subprocess.check_call([sys.executable, "-m", "pip", "install", "openpyxl", "-q"]) import openpyxl from openpyxl.styles import Font, PatternFill, Alignment, Border, Side from openpyxl.utils import get_column_letter ``` ### Technical Analysis If `openpyxl` cannot be imported, the script automatically invokes pip and installs the package at runtime. The installation does not specify an exact version, verify package hashes, enforce a trusted package index, or require explicit operator approval. Python package installation can execute package-controlled build and installation logic. Consequently, the effective code executed by the Skill is not limited to the reviewed repository. It also depends on whichever package and version the configured pip index returns at execution time. The risk can become exploitable if: - The configured package index or package mirror is compromised. - Local pip configuration redirects requests to an attacker-controlled index. - DNS, proxy, or repository infrastructure is compromised. - A future dependency release is malicious or compromised. - The script is executed in an environment where Python package resolution has been modified. ### Attack Path 1. An attacker compromises or influences the Python package source used by the execution environment. 2. The attacker causes the supplied `openpyxl` package or one of its dependencies to contain malicious installation or import-time code. 3. A user invokes Excel generation ...[truncated 952 chars]
Remediation
## Remediation Suggestions 1. Remove all automatic package installation from runtime application code. 2. Declare `openpyxl` in a project dependency manifest and lock it to a reviewed version. 3. Use a lock file or requirements file with cryptographic hashes, for example pip's `--require-hashes` option. 4. Install dependencies during a controlled deployment or build phase rather than during report generation. 5. Configure an approved package repository and prevent untrusted local pip configuration from overriding it. 6. If the dependency is unavailable, terminate safely with a clear installation instruction instead of invoking pip automatically. 7. Run the script in a least-privileged, network-restricted environment to reduce the impact of a compromised dependency. 8. Add dependency vulnerability and provenance checks to the release process.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_excel.py:106
Finding
Spreadsheet Formula Injection Through Untrusted Workbook Values## Vulnerability Details **File Location**: `scripts/generate_excel.py`, lines 106-108; additional sink at lines 159-169 **Vulnerability Type**: Spreadsheet formula injection **Risk Level**: Medium ### Code Evidence ```python for row_idx, record in enumerate(records, 2): row_data = [record.get(h, "") for h in HEADERS] ws.append(row_data) ``` The show name is also inserted into the summary worksheet without neutralization: ```python summary_data = [ ["统计项目", "数值"], ["文件总数", total], ["已重命名", renamed], ["已移动", moved], ["待确认", pending], ["失败", failed], ["冲突", conflict], ["生成时间", datetime.now().strftime("%Y-%m-%d %H:%M:%S")], ["电视剧名称", show_name], ] for row in summary_data: ws_summary.append(row) ``` ### Technical Analysis The script writes record fields and `show_name` directly into Excel cells. These values can originate from user-controlled JSON and, in the intended workflow, from media filenames, directory names, paths, episode titles, and other externally controlled metadata. With `openpyxl`, a string beginning with `=` can be represented as a spreadsheet formula rather than harmless literal text. The script does not validate or escape formula-like input and does not explicitly force untrusted values to use the string cell type. An attacker who controls a scanned filename, directory name, show name, or JSON record can therefore place a spreadsheet formula into the generated workbook. Exploitation occurs when a user opens the workbook in software that evaluates the formula. The exact consequences depend on spreadsheet-client security controls. Potential payloads include deceptive hyperlinks, external workbook references, network lookup attempts, or functions that expose workbook data. ### Attack Path 1. An attacker creates a media file, directory, episode title, or input record containing a value that begins with `=` and is valid spreadsheet fo ...[truncated 1308 chars]
Remediation
## Remediation Suggestions 1. Centralize workbook-value sanitization before writing any externally derived string. 2. At minimum, neutralize strings beginning with `=` by prefixing them with an apostrophe or otherwise ensuring that Excel treats them as literal text. 3. Consider conservatively neutralizing leading `+`, `-`, and `@` characters for compatibility with other spreadsheet export or conversion workflows. 4. Explicitly set untrusted cells to the string data type instead of relying solely on value inference. 5. Apply the protection to all record fields, `show_name`, output summaries, and any future worksheets—not only filenames. 6. Preserve the original visible value where possible while preventing formula evaluation. 7. Add automated tests using malicious filenames, paths, show names, and JSON values such as `=HYPERLINK(...)` and external-reference formulas. 8. Document that all filesystem metadata and JSON fields must be treated as untrusted input.
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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The documented behavior goes beyond the stated purpose and includes risky side effects such as writing files to a default local path and, per the static finding, potentially installing dependencies at runtime. A skill that claims to organize TV media but can modify the local environment or write output without being tightly coupled to the user's requested input creates a trust gap that can lead to unauthorized filesystem changes.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The README is entirely written as if the skill operates in Chinese and all example invocations and confirmations are Chinese phrases, such as "确认执行" and "开始整理". This constitutes a natural-language locale constraint without any documented user choice, fallback, or opt-in, which can violate organizational language/locale policy for general-purpose skills.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill explicitly instructs the agent to invoke Bash and run a local Python script, but it declares no tool scope or allowed-tools constraints. That means a skill capable of shell execution is presented without an explicit permission boundary, increasing the chance of unintended or overbroad command execution if the skill is triggered or adapted by an agent runtime.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrases are broad enough to match ordinary requests about organizing folders or renaming content, which can cause the skill to activate in contexts the user did not intend. Because this skill can progress toward filesystem inspection and file generation, accidental activation raises the risk of unnecessary access to local paths and unintended file-writing workflows.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The skill defines a default local output directory and instructs the agent to save an Excel file there when the user does not specify a path, but it does not present that default as a strong consent boundary. Writing to a local path by default can surprise users, leak sensitive filenames into a shared sync directory, or create artifacts on systems where that path maps to important storage.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
Installing Python packages at runtime is unsafe for an Excel-generation utility because it performs environment mutation and executes third-party package code outside a vetted installation workflow. If package indexes, mirrors, dependency resolution, or the execution environment are compromised, the script can become a vehicle for unintended code execution.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
except ImportError:
    print("缺少 openpyxl,正在安装...")
    import subprocess
    subprocess.check_call([sys.executable, "-m", "pip", "install", "openpyxl", "-q"])
    import openpyxl
    from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
    from openpyxl.utils import get_column_letter
Confidence
91% confidence
Finding
The script executes a runtime package installation via pip when openpyxl is missing. Although the subprocess arguments are hardcoded and not shell-injected, this still triggers network-dependent code installation and arbitrary package execution during normal use, expanding the trust boundary beyond simple Excel generation.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
The markdown content is entirely written in Chinese and presents the skill reference as the expected operating language for AI handling episode recognition. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is explicitly documented and justified, which is not present here.

Static analysis

No suspicious patterns detected.