Back to skill

Security audit

local-material-batch

Security checks for vulnerabilities and agentic risk

Overview

This local batch-processing skill is mostly coherent, but its script can unintentionally copy files outside the intended inbox and can create risky CSV output from filenames.

Review before installing if you will process files from untrusted archives or shared folders. Run dry-run first, avoid preserving symlinks in Inbox, inspect generated CSV files before opening them in spreadsheet apps, and keep the workflow in a dedicated directory with only files you intend to process.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/local_material_batch.py:31
Finding

Symlink Traversal Allows Reading Files Outside the Inbox

Content
View full analysis
list[Path]: inbox = root / "Inbox" if not inbox.exists(): return [] return sorted(p for p in inbox.rglob("*") if p.is_file()) def process_text(path: Path) -> str: return path.read_text(encoding="utf-8", errors="replace") ``` ### Technical Analysis The recursive discovery function treats every path for which `Path.is_file()` returns true as a valid Inbox file. Symbolic links that resolve to regular files also satisfy this condition. Before reading a discovered file, the implementation does not: - Reject symbolic links. - Resolve the candidate path and verify that it remains under the resolved Inbox directory. - Revalidate the path immediately before opening it. Consequently, a symbolic link with a supported text extension can point to any file readable by the process. `process_text()` follows the link and reads the target. The disclosed content is subsequently written into the generated `text.md`, `text.json`, and batch `manifest.json` artifacts. The use of `path.relative_to(root)` does not prevent this issue because it validates the lexical location of the symbolic link, not the location of its resolved target. ### Attack Path 1. An attacker or untrusted archive gains the ability to place an entry in the workflow's `Inbox` directory. 2. The attacker creates a supported text path such as `Inbox/imported-note.txt` as a symbolic link to a sensitive local file readable by the user running the Skill. 3. The user runs: ```bash python3 scripts/local_material_batch.py run ``` 4. `discover()` includes the symbolic link because `is_file()` follows it and recognizes its target as a regular file. 5. `process_text()` follows the link and reads the external target. 6. The se ...[truncated 942 chars]
Remediation
View remediation
list[Path]: inbox = (root / "Inbox").resolve() if not inbox.is_dir(): return [] items = [] for candidate in inbox.rglob("*"): if candidate.is_symlink(): continue resolved = candidate.resolve(strict=True) if not resolved.is_relative_to(inbox): continue if resolved.is_file(): items.append(resolved) return sorted(items) ``` Additional hardening should include: 1. Revalidate the resolved path immediately before reading it to reduce time-of-check/time-of-use risk. 2. Open files with platform-supported no-follow semantics where available. 3. Document that imported archives must not preserve symbolic links unless explicitly trusted. 4. Add automated tests covering: - A symlink to a file outside `Inbox`. - A symlink to a directory outside `Inbox`. - Nested symlink chains. - Replacement of a validated file with a symlink before reading. 5. Run the workflow under a minimally privileged account that cannot read unrelated sensitive files. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/local_material_batch.py:107
Finding

Attacker-Controlled Filenames Can Trigger Spreadsheet Formula Injection

Content
View full analysis
str: stem = path.stem.lower().replace(" ", "-") digest = hashlib.sha1(str(path).encode("utf-8")).hexdigest()[:8] return f"{stem}-{digest}" ``` ```python record = { "item_id": item_id, "source_path": str(path.relative_to(root)), "source_type": item_type, "status": status, "backend": backend, "text": text, "error": error, } ``` ### Technical Analysis The `item_id` and `source_path` fields contain data derived from attacker-controlled filenames. These values are passed directly to `csv.DictWriter` without neutralizing spreadsheet formula prefixes. CSV quoting only preserves the field structure. It does not prevent spreadsheet applications from interpreting a cell beginning with characters such as `=`, `+`, `-`, or `@` as a formula. Therefore, a specially named Inbox file can produce a formula-bearing cell in `summary.csv`. The exact effects depend on the spreadsheet application and its security settings. Formula execution may display deceptive content, reference external resources, or invoke application-specific functionality. This issue does not constitute Python code execution within the batch processor itself. ### Attack Path 1. An attacker supplies or creates an Inbox file whose name begins with a spreadsheet formula marker, such as `=...`, `+...`, `-...`, or `@...`. 2. The v ...[truncated 1023 chars]
Remediation
View remediation
str: text = str(value) if text.startswith(FORMULA_PREFIXES): return "'" + text return text ``` Apply the function to all exported fields: ```python for record in records: writer.writerow({ field: safe_csv_cell(record.get(field, "")) for field in writer.fieldnames }) ``` Additional hardening should include: 1. Sanitize generated item IDs to a conservative character allowlist. 2. Treat leading tabs, carriage returns, newlines, and whitespace followed by a formula marker as dangerous because spreadsheet behavior varies. 3. Document that CSV artifacts contain untrusted source metadata and should not be opened with formula execution enabled. 4. Add tests for filenames beginning with `=`, `+`, `-`, `@`, tabs, and line breaks. 5. Consider producing a non-executable format such as JSON for automated consumption and retaining CSV only as an explicitly escaped presentation format. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill clearly describes reading from local folders like Inbox/ and writing outputs such as outputs/manifest.json, but it does not declare any tool scope or file access boundaries. That omission weakens least-privilege controls: an agent executing this skill may receive broader implicit filesystem access than intended, increasing the chance of accidental exposure, overwrite, or misuse of local files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The markdown explicitly states that the skill writes text.md, text.json, manifest.json, and summary.csv, which is a user-data-affecting file write operation. However, the README does not include a user-facing warning about where outputs are written, whether existing files may be overwritten, or that users should review paths before running.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language content in the JSON value is entirely in Chinese, with no indication that the user can choose a language or that the locale is intentionally constrained for a documented regional purpose. This can violate the language/locale policy when a skill implicitly assumes a specific language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains user-facing instructions entirely in Chinese, and there is no indication that the skill is region-specific or that users can opt into another language. That can violate language/locale policy requirements when a skill implicitly forces a specific language.

Content

No source excerpt is available for this finding.