Back to skill

Security audit

ImgBB API

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward ImgBB uploader, but users should handle API keys and uploaded images carefully.

Install only if you intend to upload selected images or URLs to ImgBB and receive public/shareable links. Prefer IMGBB_API_KEY over passing keys on the command line, avoid storing sensitive images, and restrict any ~/.imgbb_api_key file permissions if you use 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/imgbb.py:73
Finding
Insecure API Key Handling Through Process Arguments and Plaintext Configuration<![CDATA[ ## Vulnerability Details **File Location**: `scripts/imgbb.py:73-87`; related documentation at `SKILL.md:38-40` and `SKILL.md:68` **Vulnerability Type**: API key exposure through command-line arguments and insecure plaintext storage **Risk Level**: Medium ### Vulnerable Code ```python def main(): parser = argparse.ArgumentParser(description='ImgBB API Client') parser.add_argument('image', nargs='?', help='Path to image file') parser.add_argument('--key', help='ImgBB API key (or use IMGBB_API_KEY env or ~/.imgbb_api_key)') parser.add_argument('--url', help='Upload from URL') parser.add_argument('--base64', help='Upload from Base64 string') parser.add_argument('--name', help='Custom name') parser.add_argument('--expiration', type=int, default=0, help='Expiration in seconds') parser.add_argument('--json', action='store_true', help='JSON output') parser.add_argument('--batch', metavar='FOLDER', help='Batch upload folder') parser.add_argument('--ext', default='.jpg', help='File extension for batch') parser.add_argument('--set-key', metavar='KEY', help='Save API key to config file') args = parser.parse_args() # Save API key if requested if args.set_key: with open(CONFIG_FILE, 'w') as f: f.write(args.set_key) ``` The documentation also recommends secret-bearing commands: ```bash echo "your_api_key" > ~/.imgbb_api_key python imgbb.py image.jpg --key YOUR_KEY ``` ### Technical Analysis The `--key` and `--set-key` options accept an API credential directly as a process argument. Command-line arguments can be exposed through shell history, process inspection utilities, terminal logging, monitoring software, diagnostic collection, and audit infrastructure. This makes process arguments unsuitable for transmitting persistent secrets. The `--set-key` implementation writes the credential to `~/.imgbb_api_key` as plaintext without explicitly applying owner-only permissions. The resul ...[truncated 1834 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove or deprecate the `--key` and `--set-key KEY` interfaces so credentials are not passed through process arguments. 2. Prefer `IMGBB_API_KEY`, an operating-system credential manager, or an interactive prompt implemented with `getpass.getpass()`. 3. If file-based storage must remain, create the file atomically with owner-only mode `0600`, for example with `os.open()` using `O_CREAT | O_WRONLY | O_TRUNC` and an explicit mode. 4. Before writing, verify that an existing path is a regular file owned by the current user and reject symbolic links or unexpected file types. 5. Consider creating a dedicated configuration directory with mode `0700`. 6. Update `SKILL.md` to stop recommending `--key`, `--set-key`, and direct `echo` commands containing secrets. 7. Advise affected users to remove exposed commands from shell history, restrict existing file permissions with `chmod 600 ~/.imgbb_api_key`, and rotate any key that may already have been exposed. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Tainted flow: 'data' from os.environ.get (line 120, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
data = {'key': api_key}
        if name: data['name'] = name
        if expiration > 0: data['expiration'] = expiration
        response = requests.post(API_URL, files=files, data=data, timeout=30)
    return response.json()

def upload_url(image_url, api_key, name=None, expiration=0):
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'data' from os.environ.get (line 38, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
data = {'key': api_key, 'image': image_url}
    if name: data['name'] = name
    if expiration > 0: data['expiration'] = expiration
    response = requests.post(API_URL, data=data, timeout=30)
    return response.json()

def upload_base64(base64_string, api_key, name=None, expiration=0):
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tainted flow: 'data' from os.environ.get (line 38, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Content
data = {'key': api_key, 'image': image_url}
    if name: data['name'] = name
    if expiration > 0: data['expiration'] = expiration
    response = requests.post(API_URL, data=data, timeout=30)
    return response.json()

def upload_base64(base64_string, api_key, name=None, expiration=0):
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Credential Access

High
Category
Privilege Escalation
Content
CONFIG_FILE = os.path.expanduser("~/.imgbb_api_key")

def get_api_key(key_param=None):
    """Get API key from parameter, env, or config file"""
    if key_param:
        return key_param
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The skill description does not warn that local images and source URLs are sent to ImgBB, a third-party service. Users may reasonably assume a local-only transformation or link-generation step, so the missing disclosure can lead to unintended sharing of sensitive images, metadata, or internal URLs.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The activation condition is broad enough to trigger on many ordinary requests about sharing or uploading images, which can cause the skill to activate unexpectedly. In context, that matters because the skill sends user-provided images or URLs to a third-party hosting service, so an overbroad trigger increases the chance of unintended external data disclosure.

External Transmission

Medium
Category
Data Exfiltration
Content
import sys
from pathlib import Path

API_URL = "https://api.imgbb.com/1/upload"
CONFIG_FILE = os.path.expanduser("~/.imgbb_api_key")

def get_api_key(key_param=None):
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
import sys
from pathlib import Path

API_URL = "https://api.imgbb.com/1/upload"
CONFIG_FILE = os.path.expanduser("~/.imgbb_api_key")

def get_api_key(key_param=None):
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This function uploads local image content to a third-party service without any explicit warning, confirmation, or privacy notice at the point of use. In an agent or automation context, that increases the risk of unintentionally disclosing sensitive local files, screenshots, or embedded metadata to an external service.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The script stores the API key in ~/.imgbb_api_key as plaintext and does not set restrictive file permissions or warn the user about the storage risk. On multi-user systems or misconfigured environments, other local users or processes may read the credential and abuse the account.

Static analysis

No suspicious patterns detected.