Back to skill

Security audit

uf2.net URL Shortener

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward uf2.net URL-shortener wrapper, with disclosed API-key use and remote link management, but users should note the credential-storage and input-escaping weaknesses.

Install only if you are comfortable giving the skill a uf2.net API key and having submitted URLs become public short links with public metadata. Prefer a secret store or OS credential manager over shell-profile storage, double-check link codes before deletion, and avoid passing untrusted strings with quotes or control characters until the script uses proper JSON encoding.

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/uf2.sh:47
Finding
Unescaped User Input Allows JSON Request-Body Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/uf2.sh`, lines 47-57 **Vulnerability Type**: Improper JSON encoding of untrusted command-line arguments **Risk Level**: Medium ### Vulnerable Code ```bash local body="{\"url\":\"$url\"" [[ -n "$slug" ]] && body="$body,\"slug\":\"$slug\"" [[ -n "$title" ]] && body="$body,\"title\":\"$title\"" body="$body}" curl -s -X POST "$API_BASE/links" \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d "$body" ``` ### Technical Analysis The `url`, `slug`, and `title` arguments are inserted directly into a JSON string without JSON escaping or structural validation. Characters with special meaning in JSON, including quotation marks, backslashes, and control characters, can terminate a value, corrupt the document, or introduce additional properties. For example, a crafted title resembling the following can alter the generated JSON structure: ```text x","url":"https://attacker.example/ ``` The exact handling of duplicate properties depends on the remote JSON parser, so replacement of an earlier property is not guaranteed. Nevertheless, the wrapper does not preserve the intended boundary between user data and JSON syntax. The shell expansions are quoted, so this flaw does not directly provide local shell-command execution. The vulnerable boundary is the authenticated JSON request sent to the uf2.net API. ### Attack Path 1. An attacker supplies or influences a URL, slug, or title passed to `uf2.sh create`. 2. The attacker includes JSON metacharacters in that value. 3. The script concatenates the value into `body` without escaping it. 4. The script authenticates the request with the user's `UF2_API_KEY`. 5. The remote service receives malformed or structurally modified JSON. 6. Depending on parser behavior and server-side validation, the request can fail or create a link with unintended URL, slug, title, or other accepted properties. ### Impact Assessment Exploita ...[truncated 388 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Construct request bodies with a JSON-aware encoder rather than string concatenation. For example, use `jq`: ```bash local body if [[ -n "$slug" && -n "$title" ]]; then body=$(jq -n \ --arg url "$url" \ --arg slug "$slug" \ --arg title "$title" \ '{url: $url, slug: $slug, title: $title}') elif [[ -n "$slug" ]]; then body=$(jq -n \ --arg url "$url" \ --arg slug "$slug" \ '{url: $url, slug: $slug}') elif [[ -n "$title" ]]; then body=$(jq -n \ --arg url "$url" \ --arg title "$title" \ '{url: $url, title: $title}') else body=$(jq -n --arg url "$url" '{url: $url}') fi ``` Additional hardening should include: - Validate that the URL uses an explicitly permitted scheme such as HTTPS or HTTP. - Enforce the documented URL length limit before sending the request. - Validate custom slugs against the documented character and length constraints. - Reject control characters in arguments where they are not needed. - Add tests covering quotation marks, backslashes, newlines, Unicode, and attempted property injection. - Use `curl --fail-with-body` so HTTP error responses cause the command to fail under `set -e`. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:73
Finding
Documentation Recommends Plaintext API-Key Persistence Without Permission Enforcement<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 73-77 **Vulnerability Type**: Insecure credential-storage guidance **Risk Level**: Low ### Vulnerable Documentation ```bash **Option 1: Shell profile (user-only access)** ```bash echo 'export UF2_API_KEY="uf2_..."' >> ~/.zshrc # or ~/.bashrc for bash ``` ``` ### Technical Analysis The documentation recommends persisting the uf2.net API key directly in a shell initialization file and describes this option as “user-only access.” The command neither verifies nor enforces restrictive permissions on the target file. Shell profiles are plaintext files and may be exposed through permissive filesystem modes, backups, synchronization software, diagnostic bundles, editor recovery files, or other local processes operating under the user's account. The document also recommends stronger alternatives, including a secret store and an operating-system credential manager. However, presenting plaintext profile storage as user-only without a permission check can lead users to assume protections that the command itself does not establish. ### Attack Path 1. A user follows the documented command and writes the API key to `~/.zshrc` or `~/.bashrc`. 2. The profile has permissive access, is copied into a backup or synchronization system, or is collected by local tooling. 3. An unauthorized party or compromised process obtains the plaintext key. 4. The attacker sends authenticated requests to the uf2.net API using the stolen key. 5. The attacker can perform operations authorized for the corresponding account until the key is revoked or rotated. ### Impact Assessment A disclosed API key can allow unauthorized access to the associated uf2.net account capabilities documented by the project. These include viewing account information, listing links, creating links, and deleting owner-controlled links. The impact is limited to the permissions granted by the uf2.net API key; the reviewed material does not establ ...[truncated 42 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Prefer the OpenClaw secret store or an operating-system credential manager and present plaintext shell-profile storage only as a compatibility fallback. If profile-based storage remains documented: - Clearly state that the key is stored in plaintext. - Require the user to inspect and restrict profile permissions before writing the key. - Avoid implying that shell profiles are inherently user-only. - Provide key-revocation and rotation instructions. - Warn that shell profiles may be included in backups or synchronization services. - Consider a small launcher that retrieves the key from the operating-system credential manager only when needed. A safer permission-checking example for the fallback approach would be: ```bash touch ~/.zshrc chmod 600 ~/.zshrc printf '%s\n' 'export UF2_API_KEY="uf2_..."' >> ~/.zshrc ``` File permissions reduce exposure to other local users but do not protect the secret from processes running as the same user, backups, or plaintext disclosure. A dedicated secret manager remains the recommended solution. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Credential Access

High
Category
Privilege Escalation
Content
**Option 3: System keychain/credential manager**
```bash
# macOS Keychain, Linux Secret Service, Windows Credential Manager
# Use OS-native secure storage
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
### Delete Link
```http
DELETE /links/{code}
X-API-Key: uf2_...
```
Confidence
80% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Session Persistence

Medium
Category
Rogue Agent
Content
# uf2.net URL Shortener

Create and manage short URLs via the uf2.net API. This skill provides a CLI wrapper for the uf2.net service (https://uf2.net), an API-first URL shortener designed for automation and bots.

## Quick Start
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.

External Transmission

Medium
Category
Data Exfiltration
Content
If you don't have a uf2.net account:

```bash
curl -X POST https://uf2.net/api/v1/accounts/register \
  -H "Content-Type: application/json" \
  -d '{"username":"your-username"}'
```
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
[[ -n "$title" ]] && body="$body,\"title\":\"$title\""
  body="$body}"
  
  curl -s -X POST "$API_BASE/links" \
    -H "X-API-Key: $API_KEY" \
    -H "Content-Type: application/json" \
    -d "$body"
Confidence
94% confidence
Finding
The script builds JSON manually from unescaped user-controlled values and then transmits it to an external service with the user's API key. Special characters in the URL, slug, or title can break JSON structure or alter request fields, causing malformed requests or unintended data submission to the remote API.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The delete command performs an irreversible remote deletion via an HTTP DELETE request, but there is no confirmation prompt, warning message, or explanatory comment/docstring disclosing that action to the user at execution time. For a destructive operation in a code file, this falls under missing user warnings.

Missing User Warnings

Low
Confidence
88% confidence
Finding
This markdown file describes a delete operation but does not explicitly warn that deleting a short link is destructive or potentially irreversible. Under the markdown criteria, behaviors affecting user data or service state should include a clear warning so users understand the impact before invoking the command.

Static analysis

No suspicious patterns detected.