Back to skill

Security audit

URL Shortener CLI

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed local URL-shortener CLI with ordinary local data-management risks, not evidence of hidden or malicious behavior.

Install only if you are comfortable storing URL history in plaintext under your home directory. Avoid putting secrets in URLs, back up mappings before import or cleanup, and be cautious with --overwrite, --force, and cleanup without --dry-run.

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/main.py:17
Finding

URL Mapping Data Is Stored Without Explicitly Restrictive Permissions

Content
View full analysis
Dict[str, Dict[str, Any]]: """Load URL mappings from JSON file""" ensure_config_dir() if not DATA_FILE.exists(): return {} try: with open(DATA_FILE, 'r') as f: return json.load(f) except (json.JSONDecodeError, IOError): return {} def save_mappings(mappings: Dict[str, Dict[str, Any]]): """Save URL mappings to JSON file""" ensure_config_dir() with open(DATA_FILE, 'w') as f: json.dump(mappings, f, indent=2) ``` ### Technical Analysis The application creates `~/.url-shortener` and `mappings.json` without specifying restrictive permissions. Consequently, their modes are determined by the process umask. Under common configurations, the directory may be created as `0755` and the file as `0644`, allowing other local users to traverse the directory and read the mapping database. The database can contain URLs, descriptions, tags, timestamps, click counts, and last-accessed information. URLs may also contain sensitive query parameters, internal hostnames, private document identifiers, or authentication tokens. The implementation also opens an existing path directly without validating that it is a regular file owned by the current user. It therefore does not protect the storage operation against an existing symbolic link or unexpectedly permissive pre-existing file. ### Attack Path 1. A victim runs the CLI and creates or imports one or more URL mappings. 2. `ensure_config_dir()` creates the configuration directory using permissions inherited from the victim's umask. 3. `save ...[truncated 1140 chars]
Remediation
View remediation
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • 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
Findings (12)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 37)May include surrounding context.

md
## Commands

- `shorten` – Create short URL
- `expand` – Get original URL
- `list` – List all mappings
- `info` – Show details for a slug

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill advertises file read/write behavior via local JSON storage but does not declare any tool scope, permissions, or allowed-tools constraints. This creates a trust and containment gap: an agent or reviewer cannot tell from the manifest what filesystem access is expected, making unintended or over-broad file operations harder to detect and govern.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 78)May include surrounding context.

md
## Commands

- `shorten`: Create a new short URL
  - `url`: The long URL to shorten (required)
  - `--slug`: Custom slug (optional, auto‑generated if omitted)
  - `--description`: Optional description

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 78)May include surrounding context.

md
## Commands

- `shorten`: Create a new short URL
  - `url`: The long URL to shorten (required)
  - `--slug`: Custom slug (optional, auto‐generated if omitted)
  - `--description`: Optional description

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 99)May include surrounding context.

md
- `delete`: Delete a mapping
  - `slug`: The short slug to delete (required)
  - `--force`: Skip confirmation

- `search`: Search in URLs, descriptions, or tags
  - `query`: Search term (required)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · scripts/main.py (reported line 304)May include surrounding context.

python
- `delete`: Delete a mapping
  - `slug`: The short slug to delete (required)
  - `--force`: Skip confirmation

- `search`: Search in URLs, descriptions, or tags
  - `query`: Search term (required)

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The manifest frames the skill as a local URL shortener with custom slugs and analytics. In addition to that core purpose, the code implements import/export of arbitrary mapping files and a cleanup feature that can bulk-delete entries, which materially extends the behavior beyond straightforward shortening and analytics.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest emphasizes local storage in a dedicated JSON file, but export_mappings writes the full dataset to any user-supplied path. Arbitrary file output is broader than the described purpose of maintaining local URL mappings and basic analytics.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Importing from any filesystem path and merging or overwriting the existing mapping database is a general data-ingestion capability. That behavior is not evident from the manifest's narrow description of a self-contained local shortener backed by a local JSON file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The import operation can silently merge or overwrite locally persisted mappings with data from an arbitrary JSON file, which can result in integrity loss or unintended data replacement. In a CLI context this is user-triggered, but absent confirmation, validation, or backup, accidental or socially engineered imports could destroy or poison the user's stored mappings.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The cleanup command can delete many stored mappings in bulk without any confirmation, making accidental data loss easy if parameters are mistaken or maliciously suggested. Because deletion persists immediately to disk, users may lose local URL history and metadata with no recovery path.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file documents commands such as delete, export/import, and cleanup, and notes that all mappings are stored in ~/.url-shortener/mappings.json, but it does not warn users that these operations can remove, overwrite, or alter local data. For markdown files, missing disclosure about behaviors affecting user data or system integrity should be flagged when the description omits such warnings.

Content

No source excerpt is available for this finding.