Back to skill

Security audit

MySQL Natural Language Query Assistant

Security checks for vulnerabilities and agentic risk

Overview

This skill appears intended for MySQL analysis, but its read-only database safety guard is incomplete enough to warrant Review before installation.

Install only with a dedicated least-privilege MySQL account limited to SELECT and metadata access, with FILE, write, admin, routine execution, and privilege-management permissions revoked. Prefer pinned, reviewed drivers and verify TLS behavior before using this against remote or sensitive databases.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_read_query.py:11
Finding

Read-Only SQL Validation Can Be Bypassed by Side-Effecting SELECT Operations

Content
View full analysis
None: normalized = _normalize_sql(sql) lowered = normalized.lower() if not lowered.startswith(READ_ONLY_PREFIXES): raise ValueError("Query must start with a read-only statement.") tokens = set(re.findall(r"[a-z_]+", lowered)) found = BLOCKED_TOKENS & tokens if found: raise ValueError(f"Blocked non-read-only token(s) found: {', '.join(sorted(found))}") ``` ### Technical Analysis The script attempts to enforce read-only behavior by checking the beginning of the SQL string and searching for a limited set of blocked lexical tokens. This is not equivalent to parsing the statement according to MySQL grammar. A statement beginning with `SELECT` is not necessarily free of side effects. In particular, MySQL supports `SELECT ... INTO OUTFILE` and `SELECT ... INTO DUMPFILE`, which can create files using the database server process and its privileges. Neither `outfile` nor `dumpfile` is blocked. The `LOAD_FILE()` function can also read files accessible to the database server. The tokenizer treats `LOAD_FILE` as the single token `load_file`, whereas the blocklist contains only `load`. Consequently, this function is not rejected. These operations remain subject to MySQL configuration, the database account's `FILE` privilege, filesystem permissions, and server-side path restrictions. Nevertheless, the script itself does not en ...[truncated 1414 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run_read_query.py:67
Finding

Configured TLS Mode Is Ignored When PyMySQL Is Used

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
references/connection-and-safety.md:17
Finding

Database Drivers Are Installed Without Version or Integrity Pinning

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
4. Execute only read-only SQL with `scripts/run_read_query.py`.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
4. Execute only read-only SQL with `scripts/run_read_query.py`.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
4. Execute only read-only SQL with `scripts/run_read_query.py`.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill explicitly uses environment variables for database connection details and invokes scripts that connect to a live MySQL database, but it declares no tool scope or permission boundary. That omission means an agent may be allowed broader-than-necessary access to secrets and networked resources without an explicit policy gate, increasing the risk of unintended data access or exfiltration.

Content

No source excerpt is available for this finding.

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 3)May include surrounding context.

md
---
name: mysql-query-assistant
description: translate natural-language analytics requests into mysql queries, connect to a live mysql database, inspect schema and column comments, execute read-only sql, and validate query correctness against real results. use when chatgpt needs to work with mysql through direct connection details provided by environment variables, especially for ad hoc analysis, sql generation, schema discovery, query debugging, or cautious database workflows that must verify results before presenting them. also use for restricted write workflows that first generate a preview select and never auto-execute the write statement.
---

# Mysql Query Assistant

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 27)May include surrounding context.

md
---
name: mysql-query-assistant
description: translate natural-language analytics requests into mysql queries, connect to a live mysql database, inspect schema and column comments, execute read-only sql, and validate query correctness against real results. use when chatgpt needs to work with mysql through direct connection details provided by environment variables, especially for ad hoc analysis, sql generation, schema discovery, query debugging, or cautious database workflows that must verify results before presenting them. also use for restricted write workflows that first generate a preview select and never auto-execute the write statement.
---

# Mysql Query Assistant

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

This code emits the full inspected schema payload, including table and column names, directly to standard output. While schema introspection is the script's purpose, there is no print/log/comment/docstring warning that potentially sensitive database structure metadata will be exposed in command output.

Content

No source excerpt is available for this finding.