Back to skill

Security audit

Db Explorer

Security checks for vulnerabilities and agentic risk

Overview

This database skill is useful but needs Review because it can expose credentials, export sensitive data, and run restore/import operations without strong local safeguards.

Install only after reviewing whether agents should have database administration guidance in this skill. Use least-privilege read-only credentials for exploration, avoid passwords in command-line arguments, require explicit confirmation before restore/import or migration, and store any exports or backups in protected locations with cleanup expectations.

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
SKILL.md:50
Finding

Database Credentials Exposed Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 50–52 and 65–71
Vulnerability Type: Command-line credential exposure
Risk Level: Medium

Vulnerable Code

bash
# PostgreSQL
psql "postgresql://user:password@host:5432/dbname" -c "\dt"
psql "postgresql://user:password@host:5432/dbname" -c "\d table_name"
psql "postgresql://user:password@host:5432/dbname" -c "SELECT count(*) FROM table_name;"

# MongoDB
mongosh "mongodb://user:password@host:27017/dbname" --eval "db.getCollectionNames()"
mongosh "mongodb://user:password@host:27017/dbname" --eval "db.collection_name.countDocuments()"

# Redis
redis-cli -h host -p 6379 -a password INFO keyspace
redis-cli -h host -p 6379 -a password DBSIZE
redis-cli -h host -p 6379 -a password KEYS "*"

Technical Analysis

The examples place plaintext database passwords directly in command-line arguments. When an agent replaces the placeholders with real credentials, those secrets may become visible through shell history, command auditing, execution telemetry, debug logs, or process inspection available to other sufficiently privileged local users.

This guidance also conflicts with the safety rule at line 82:

markdown
4. **No passwords in history** — Use environment variables or connection strings, don't echo passwords

A connection string containing an embedded password remains sensitive when passed directly as a command-line argument. Merely using a URI does not prevent its disclosure.

Attack Path

  1. A user supplies valid PostgreSQL, MongoDB, or Redis credentials to the agent.
  2. The agent substitutes those credentials into one of the documented commands.
  3. The command, including its plaintext password, is recorded in shell history, agent logs, audit telemetry, or process metadata.
  4. An attacker with access to those records or sufficient local process-inspection privileges extracts the credential.
  5. The attacker connects t ...[truncated 922 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove all examples that embed passwords in command-line arguments or database URIs passed directly to client programs.
  2. Use each client's protected authentication mechanism:
    • PostgreSQL: use PGPASSFILE or .pgpass with file permissions restricted to 0600.
    • MySQL: use mysql_config_editor and a named login path.
    • Redis: use REDISCLI_AUTH while ensuring the execution environment and logs do not disclose environment variables.
    • MongoDB: use an interactive password prompt or an appropriately protected client configuration mechanism.
  3. Display redacted commands before execution, replacing passwords with a fixed value such as [REDACTED].
  4. Prevent secrets from being written to shell history, agent traces, debug output, or audit logs.
  5. Store any temporary credential files outside shared directories, apply restrictive permissions, and securely remove them after use.
  6. Prefer short-lived, narrowly scoped, read-only database credentials for exploration.
  7. Add an explicit rule that connection strings containing credentials are secrets and must never be printed or passed visibly on the command line.
  8. Update examples to use non-secret references, such as:
bash
PGPASSFILE="$HOME/.pgpass" psql -h host -p 5432 -U user -d dbname -c "\dt"
redis-cli -h host -p 6379 INFO keyspace

For Redis, authentication should be supplied through a protected mechanism rather than the -a command-line option.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
Findings (4)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill states it is read-only by default and requires confirmation for writes, but later provides direct restore and import commands with no confirmation, dry-run, or rollback guidance. This inconsistency is dangerous because downstream agents may follow the concrete executable examples rather than the earlier policy text, resulting in destructive actions against production databases.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill is presented primarily as a database exploration/query/export tool, but it also includes restore and migration commands that can overwrite data or import data into live systems. In an agentic context, bundling destructive or state-changing operations into a broadly-invoked exploration skill increases the chance that a user request intended as read-only analysis leads to unintended modification or recovery actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The activation guidance uses broad phrases like 'check the database' or 'show me the data,' which can trigger this powerful skill in situations where a narrower read-only or application-level diagnostic skill would be safer. Because this skill exposes connection handling, exports, backup, restore, and migration guidance, accidental activation expands the available action surface and increases the chance of sensitive data exposure or unintended state changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The export section provides commands that copy potentially sensitive table contents to local files without prominent warnings about data sensitivity, file permissions, retention, or destination safety. In an agent environment, silent export to /tmp or similar paths can create unintended data exposure, especially on shared systems or when handling regulated or production data.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.