Back to skill

Security audit

Tail Tool

Security checks for vulnerabilities and agentic risk

Overview

This skill is a simple local tail-style file viewer, but its documentation overstates features and its implementation can be inefficient on very large inputs.

Install only if you need a basic last-N-lines viewer. Do not rely on the advertised follow, byte, quiet, or multi-file features unless the implementation is updated, and avoid using it on huge files or never-ending streams.

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/tail.py:14
Finding
Unbounded Input Loading Enables Resource Exhaustion## Vulnerability Details **File Location**: `scripts/tail.py`, lines 14-20 **Vulnerability Type**: Unbounded memory consumption and blocking input **Risk Level**: Medium ```python if args.file: try: lines = open(args.file).readlines() except FileNotFoundError: print(f"Error: File not found: {args.file}", file=sys.stderr) sys.exit(1) else: lines = sys.stdin.readlines() ``` ### Technical Analysis The implementation calls `readlines()` on either the selected file or standard input. Despite only needing the final number of lines requested by the user, it loads the entire input into memory before producing any output. A sufficiently large file can cause excessive memory consumption, process termination, or system degradation. When standard input is used, `sys.stdin.readlines()` also waits for end-of-file, so an unbounded or continuously producing input stream can make the command block indefinitely while its memory usage continues to grow. The file is also opened without a context manager, although resource exhaustion from unbounded reads is the principal security concern. ### Attack Path 1. An attacker creates or identifies a file whose size is large relative to available memory, or supplies a stream that continuously emits data. 2. The attacker causes the tool to process that input, for example by invoking it with the large file path or piping the stream into the command. 3. `readlines()` attempts to retain every line in memory. 4. Memory consumption grows until the process is killed, becomes unresponsive, or adversely affects other processes. For a stream without an end-of-file condition, the tool may never produce output. Exploitation requires the ability to influence the file or standard input processed by the tool. It does not provide privilege escalation or arbitrary code execution. ### Impact Assessment The primary impact is local denial of service against the tool ...[truncated 343 chars]
Remediation
## Remediation Suggestions - For standard input, retain only the requested number of lines with a bounded deque: ```python from collections import deque lines = deque(sys.stdin, maxlen=args.lines) ``` - For regular files, implement bounded reverse reading so that only enough data to recover the requested final lines is loaded. Alternatively, use a well-reviewed tail implementation or invoke a trusted platform API without constructing a shell command. - Open files with a context manager to guarantee closure: ```python with open(args.file, "r", encoding="utf-8", errors="replace") as handle: lines = deque(handle, maxlen=args.lines) ``` - Validate that `args.lines` is non-negative and impose a reasonable upper bound. - Where stdin may be supplied by an untrusted or long-running producer, apply execution timeouts and operating-system memory limits.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The code matches the core 'display last lines of files' behavior, including selecting the number of lines and reading from a file or stdin. However, the description explicitly claims use for 'following file growth in real-time,' which implies functionality like tail -f. The supplied code only reads the current contents once and exits; it does not watch for updates or continuously stream appended lines. This is a material description-behavior mismatch.

Static analysis

No suspicious patterns detected.