Back to skill

Security audit

local-media-cataloger

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local media-folder catalog helper that is purpose-aligned and disclosed, though its CSV output can expose filenames and should be handled carefully.

Install only if you are comfortable letting the skill recursively inventory a folder you choose and create a manifest containing local paths, filenames, sizes, and timestamps. Avoid pointing it at broad personal directories unless that is intended, choose an explicit output location, and treat generated CSV files as untrusted when opening them in spreadsheet apps because crafted filenames could be interpreted as formulas.

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

Warning
Location
scripts/media_manifest.py:16
Finding
CSV Formula Injection Through Untrusted File Names and Paths## Vulnerability Details **File Location**: `scripts/media_manifest.py`, lines 16–17 and 24–27 **Vulnerability Type**: CSV formula injection **Risk Level**: Medium ### Vulnerable Code ```python rows.append({ "path": str(p), "filename": p.name, "ext": p.suffix.lower(), "size_bytes": stat.st_size, "created_at": getattr(stat, "st_ctime", ""), "modified_at": getattr(stat, "st_mtime", "") }) fields = ["path","filename","ext","size_bytes","created_at","modified_at"] with open(args.out, "w", encoding="utf-8", newline="") as f: w = csv.DictWriter(f, fieldnames=fields) w.writeheader() w.writerows(rows) ``` ### Technical Analysis The script recursively collects attacker-influenced file names and paths and writes them directly into CSV cells. A malicious file name beginning with a spreadsheet formula marker such as `=`, `+`, `-`, or `@` can be interpreted as a formula when the generated manifest is opened in spreadsheet software. CSV quoting performed by `csv.DictWriter` preserves CSV structure but does not reliably prevent spreadsheet applications from evaluating cell contents as formulas. The vulnerability therefore crosses a trust boundary between the local filesystem and the spreadsheet application used to inspect the generated artifact. ### Attack Path 1. An attacker creates or supplies a media directory containing a file whose name begins with a formula marker and contains a spreadsheet formula payload. 2. The user runs `media_manifest.py` against that directory. 3. The script reads the malicious name through `p.name` and its corresponding path through `str(p)`. 4. The values are written unchanged to the output CSV. 5. The user opens the manifest in spreadsheet software that evaluates formula-like cells. 6. Depending on the spreadsheet application and its security configuration, the formula may initiate an external request, disclose data represented in accessible cells, or display deceptive content. ### Impact Assessment ...[truncated 506 chars]
Remediation
## Remediation Suggestions 1. Sanitize every string value before writing it to CSV, particularly `path`, `filename`, and `ext`. 2. For values whose first non-whitespace character is `=`, `+`, `-`, or `@`, prefix the value with an apostrophe or use another neutralization strategy compatible with the intended spreadsheet applications. 3. Consider also treating tab, carriage-return, and line-feed prefixes conservatively because spreadsheet import behavior varies. 4. Keep normal CSV escaping through `csv.DictWriter`; formula neutralization complements rather than replaces CSV quoting. 5. Document that generated manifests contain untrusted filesystem metadata and should be imported with formula evaluation disabled where possible. 6. Add regression tests using malicious names such as `=payload.jpg`, `+payload.png`, `-payload.mov`, and `@payload.gif`, then verify that no exported cell begins with an active formula marker. A centralized sanitizer can be applied before serialization: ```python def safe_csv_cell(value): if not isinstance(value, str): return value if value.lstrip().startswith(("=", "+", "-", "@")): return "'" + value return value safe_rows = [ {key: safe_csv_cell(value) for key, value in row.items()} for row in rows ] w.writerows(safe_rows) ```
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The code does perform local file indexing and creates a manifest, which partially aligns with the description. However, it only records basic filesystem metadata for every file under the target folder. It does not analyze media content, derive tags, collect shoot-specific metadata, or generate reuse ideas as declared. The primary behavior is a generic file inventory exporter, not an enriched media asset indexing tool as described.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
This markdown file contains core skill instructions and usage sections primarily in Chinese, while also including English trigger examples and input fields. Because the skill does not state that language is optional or user-selectable, it effectively imposes a locale/language assumption that may conflict with organizational language-choice policy.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill references a local script that generates CSV/JSON manifests, which implies file creation/writes, but the manifest does not declare any explicit tool scope such as permissions or allowed-tools. In an agent environment, undeclared write capability reduces transparency and can allow unexpected filesystem changes, especially when scanning user-supplied paths on local media folders.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The skill description promises indexing local photos, videos, and creative assets into a searchable manifest with tags, dates, shoot information, and reuse ideas. This implementation only recursively lists files and records path, name, extension, size, and filesystem timestamps, with no media-specific analysis, tagging, shoot metadata extraction, or reuse-idea generation.

Missing User Warnings

Low
Confidence
85% confidence
Finding
The workflow indicates that the skill will scan local folders and generate manifest artifacts, but the description does not prominently warn users about this local data processing and file generation. On systems containing sensitive personal media, insufficient upfront disclosure can lead to unintended indexing of private files or creation of metadata inventories the user did not expect.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
This markdown file presents the skill's smoke-test instructions entirely in Chinese, which can impose a language requirement on users or maintainers without explicit opt-in. The policy allows locale-specific constraints only when they are clearly documented and justified, which is not stated here.

Static analysis

No suspicious patterns detected.