Back to skill

Security audit

Byted Bytehouse Slow Query

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate ByteHouse slow-query purpose, but it runs unpinned remote code with all environment variables and saves potentially sensitive query-log data locally.

Review before installing. Use only in a restricted environment with read-only ByteHouse credentials, remove unrelated secrets from the environment, protect or delete generated output files, and prefer a pinned or preinstalled trusted MCP server instead of fetching from a mutable GitHub branch.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/slow_query_analyzer.py:49
Finding

Runtime Execution of an Unpinned Remote Payload

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/slow_query_analyzer.py:46
Finding

Remote Child Process Inherits the Entire Parent Environment

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The documented behavior does not match the observed capabilities: it omits local persistence of analysis outputs and overstates features like execution-plan viewing and historical trend analysis. This is dangerous because operators may approve or invoke the skill under false assumptions, while the undeclared output files can retain sensitive query text and metadata on disk.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
97% confidence
Finding

Copying the entire process environment and passing it to a child process launched from a remote GitHub-sourced MCP server unnecessarily exposes all available secrets, not just ByteHouse credentials. This is especially risky here because the child executable is fetched from a remote repository at runtime, so any compromise or unexpected behavior in that dependency could harvest unrelated tokens, cloud credentials, or internal configuration from the environment.

Content

Scanner excerpt · scripts/slow_query_analyzer.py (reported line 50)May include surrounding context.

python
print()
    
    # 从环境变量获取配置
    env = os.environ.copy()
    
    # MCP Server参数
    server_params = StdioServerParameters(

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The natural-language instructions and descriptions in this file are entirely Chinese, which effectively forces a specific language for users. Under the stated policy, language restrictions should either provide user choice or be clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill uses environment variables, MCP access, and writes files, but it does not declare any tool scope or permissions boundaries. This weakens least-privilege controls and makes it harder for an agent runtime or reviewer to understand and constrain what the skill may access or modify.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill description and trigger conditions are broad enough that an agent may invoke it for loosely related requests. In this context, accidental invocation is risky because the skill connects to a database-backed MCP service and may process or export sensitive query information unnecessarily.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The keyword trigger list lacks constraints and negative examples, so generic phrases such as '查询优化' or '性能分析' may cause over-triggering. Because this skill can access database telemetry and write reports, ambiguous activation increases the chance of unnecessary sensitive-data handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The documentation states that analysis outputs are saved as JSON files but does not warn that these files may contain sensitive query text, identifiers, timing metadata, and potentially embedded secrets from SQL statements. In a database-analysis skill, that omission is particularly dangerous because query logs often expose business logic, schema details, and user data access patterns.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes capabilities including '查看查询执行计划' and '分析查询历史趋势', which imply EXPLAIN-plan retrieval and trend analysis across time. In code, the script performs three fixed read-only queries over system.query_log limited to the last hour (L78-L173) and then emits hard-coded suggestions; it never invokes EXPLAIN or performs multi-period/history trend analysis.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest says the tool is used for '查询性能优化建议', which suggests recommendations derived from observed slow-query characteristics. However, the code appends three predetermined suggestions without analyzing the returned query data, so the advertised optimization analysis is only superficially implemented.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README explicitly states that analysis results are written to timestamped JSON files in an output directory, but it does not warn users that potentially sensitive query text, execution details, or metadata will persist on disk. In a database performance-analysis context, those artifacts can contain sensitive operational or data-access information and may be retained, copied, or exposed unintentionally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

This code file reads the full process environment via os.environ.copy(), which includes sensitive variables such as BYTEHOUSE_PASSWORD, and passes that environment to a spawned subprocess. While the script tells the user to set the variables, it does not explicitly disclose that credentials will be inherited by the MCP server process.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script persists analysis results that include slow query log contents to a local JSON file, and query text can contain sensitive business logic, identifiers, literals, or even secrets embedded in SQL. In a database analysis skill, this context makes the issue more dangerous because operational query logs frequently contain confidential metadata and are written unredacted to disk.

Content

No source excerpt is available for this finding.