Back to skill

Security audit

4chan-reader

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but its optional save feature can write outside the intended output folder because command arguments are not validated.

Install only if you are comfortable with the agent fetching public 4chan pages and storing their content locally. Avoid passing untrusted board, thread_id, or output_root_dir values, and use a dedicated output folder because the current script does not enforce that saved files stay inside it.

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/chan_extractor.py:99
Finding
Unsanitized Path Components Permit Output Directory Escape<![CDATA[ ## Vulnerability Details **File Location**: `scripts/chan_extractor.py`, lines 99–108 and 140–160 **Vulnerability Type**: Path traversal and arbitrary file overwrite **Risk Level**: Medium ### Vulnerable Code ```python # Write to file if output_root provided if output_root: timestamp = datetime.now().strftime("%Y-%m-%d_%H") output_dir = os.path.join(output_root, f"{board}_{timestamp}") os.makedirs(output_dir, exist_ok=True) file_path = os.path.join(output_dir, f"{thread_id}.txt") try: with open(file_path, 'w', encoding='utf-8') as f: f.write(full_output) print(f"--- Saved to {file_path} ---", file=sys.stderr) ``` The affected values are taken directly from command-line arguments: ```python board = sys.argv[2] thread_id = sys.argv[3] out_root = None word_limit = None if len(sys.argv) > 4: # Check if arg4 is a digit (word_limit) or a directory if sys.argv[4].isdigit(): word_limit = int(sys.argv[4]) else: out_root = sys.argv[4] if len(sys.argv) > 5 and sys.argv[5].isdigit(): word_limit = int(sys.argv[5]) get_thread(board, thread_id, out_root, word_limit) ``` ### Technical Analysis The caller-controlled `board` and `thread_id` values are incorporated into filesystem paths without validation, normalization, or a containment check. `os.path.join()` does not guarantee that the resulting path remains beneath `output_root`. Traversal components such as `..` may resolve outside the intended directory. An absolute path component may also cause preceding path components to be discarded. The program subsequently creates directories with `os.makedirs()` and opens the destination in write mode, which truncates an existing file. The intended output layout is `<output_root>/<board>_<timestamp>/<thread_id>.txt`, but the implementation does not enforce that boundary. Exploitation is constrained because the file-writing logic runs only after the constructed 4chan re ...[truncated 1768 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Strictly validate board identifiers against the expected format and, preferably, an explicit allowlist of supported 4chan boards: ```python if not re.fullmatch(r"[a-z0-9]+", board): raise ValueError("Invalid board identifier") ``` 2. Require thread IDs to contain digits only: ```python if not re.fullmatch(r"[0-9]+", thread_id): raise ValueError("Invalid thread identifier") ``` 3. Resolve and verify filesystem paths before creating directories or writing files: ```python from pathlib import Path root = Path(output_root).expanduser().resolve() output_dir = (root / f"{board}_{timestamp}").resolve() file_path = (output_dir / f"{thread_id}.txt").resolve() if output_dir != root and root not in output_dir.parents: raise ValueError("Output directory escapes the configured root") if root not in file_path.parents: raise ValueError("Output file escapes the configured root") ``` 4. Consider rejecting symbolic-link components or opening files using directory-relative, no-follow operating-system APIs when the output directory may be writable by untrusted users. 5. If replacing existing files is unnecessary, use exclusive creation mode (`'x'`) rather than write mode (`'w'`) to prevent silent truncation. 6. Run the Skill under a minimally privileged account and restrict the permitted output root to a dedicated data directory. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Context Leakage

High
Category
Data Exfiltration
Content
---
name: 4chan-reader
description: Browse 4chan boards and extract thread discussions into structured text files. Use when you need to fetch catalog information or specific thread content (including post text and file metadata) from 4chan boards like /a/, /vg/, /v/, etc.
---

# 4chan Reader
Confidence
75% confidence
Finding
Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Context Leakage

High
Category
Data Exfiltration
Content
---
name: 4chan-reader
description: Browse 4chan boards and extract thread discussions into structured text files. Use when you need to fetch catalog information or specific thread content (including post text and file metadata) from 4chan boards like /a/, /vg/, /v/, etc.
---

# 4chan Reader
Confidence
75% confidence
Finding
Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Context Leakage

High
Category
Data Exfiltration
Content
```
Output format: `ThreadID|PostCount|TeaserText`

### 2. Extract Thread Content
To read a specific thread and optionally save it:
```bash
python3 scripts/chan_extractor.py thread <board> <thread_id> [output_root_dir] [word_limit]
Confidence
75% confidence
Finding
Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill advertises and invokes network access and optional file writes, but it declares no explicit tool scope or permissions boundaries. That increases the chance an agent can use broader capabilities than the user expects, especially when fetching remote content and persisting it locally.

Missing User Warnings

Low
Confidence
91% confidence
Finding
The skill documents saving thread contents to disk but does not clearly warn that local files will be created and retained. This can lead to unexpected storage of untrusted or sensitive content on the host, reducing user awareness and informed consent.

Missing User Warnings

Low
Confidence
84% confidence
Finding
This code writes fetched thread contents into a newly created directory under a user-provided output root, but there is no confirmation prompt or explicit warning in the usage text that running the command may create files and directories. Although the write is part of the script's functionality, the only disclosure appears after the write succeeds, not before it happens.

Static analysis

No suspicious patterns detected.