Back to skill

Security audit

Alibabacloud Polardbx Sql

Security checks for vulnerabilities and agentic risk

Overview

This PolarDB-X SQL skill is not overtly malicious, but it includes an out-of-scope Alibaba Cloud CLI guide that expands into cloud credential setup and privileged binary installation.

Review this skill before installing. Its SQL guidance is mostly aligned with PolarDB-X work, but do not use the included Aliyun CLI setup instructions as-is: avoid unverified latest binary downloads, avoid sudo or machine-wide installation unless necessary, do not put cloud secrets on command lines, and use least-privilege short-lived credentials. Treat destructive SQL examples such as partition drops, TTL cleanup, and execution-based EXPLAIN modes as production-impacting operations requiring backups, review, and explicit confirmation.

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

Warning
Location
references/pagination-best-practice.md:169
Finding

Database Credentials May Be Exposed and Transmitted Without Enforced TLS

Content
View full analysis
:3306/" + "?netTimeoutForStreamingResults=0&socketTimeout=600000"; String user = ""; String password = ""; boolean first = true; Object lastGmtCreate = null; long lastId = -1; int totalRows = 0; while (true) { try (Connection conn = DriverManager.getConnection(url, user, password)) { ``` Related MySQL command: ```bash mysql -h -P -u -p -D ``` ### Technical Analysis The JDBC example establishes a network connection using a username and password but does not require certificate-validated TLS. Depending on the JDBC driver configuration and server capabilities, credentials and database traffic may not receive adequate protection against interception or server impersonation. The password is also represented directly in application code. Users who copy the example may hardcode a real password in source files, configuration repositories, compiled artifacts, logs, or debugging output. The related MySQL CLI example places the password directly in a command-line argument. Real passwords supplied this way may be retained in shell history and can potentially be observed through local process inspection. The database connection itself is necessary for the Skill's declared functionality and points to a user-selected database. There is no indication that credentials are sent to an attacker-controlled endpoint. The issue is the absence of secure credential-handling and transport requirements. ### Attack Path 1. A user replaces the placeholders with real database connection information. 2. The password is embedded in Java source or passed as part of the MySQL command l ...[truncated 810 chars]
Remediation
View remediation
-P -u -p -D ``` 5. For automated clients, use a protected option file or credential helper and restrict its permissions. 6. Ensure database accounts follow least privilege and rotate credentials if exposure is suspected. 7. Add an explicit warning not to commit passwords, JDBC URLs containing secrets, or database option files to source control. ]]>

T08 · Insecure Dependencies

Error
Location
references/cli-installation-guide.md:24
Finding

Mutable CLI Binaries Are Downloaded and Installed Without Integrity Verification

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/cli-installation-guide.md:103
Finding

Alibaba Cloud Access Keys Are Supplied Through Command-Line Arguments

Content
View full analysis
\ --access-key-secret \ --region cn-hangzhou ``` The guide explicitly recommends non-interactive flags, and later examples similarly place access-key secrets and STS tokens directly on the command line. ### Technical Analysis Command-line arguments containing real access-key secrets may be stored in interactive shell history. While the command is running, arguments may also be visible through process-inspection interfaces to other users or monitoring software, depending on the operating system and its configuration. The repository contains placeholders rather than confirmed live credentials. The vulnerability arises when users follow the documented workflow and substitute actual secrets. Long-lived Access Key mode increases the consequence of disclosure. Although the guide later recommends RAM users, least privilege, key rotation, STS tokens, and restrictive configuration-file permissions, those controls do not eliminate exposure caused by entering secrets directly into command arguments. ### Attack Path 1. A user copies the example and substitutes a valid Access Key ID and Access Key Secret. 2. The shell records the complete command in its history, or the arguments are exposed through process inspection, terminal logging, CI output, or endpoint-monitoring tools. 3. An attacker with access to one of these sources extracts the credentials. 4. The attacker configures another Alibaba Cloud client with the stolen credentials. 5. The attacker invokes cloud APIs authorized by the associated RAM identity. 6. If the credentials are l ...[truncated 569 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (14)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This file is materially outside the declared purpose of a PolarDB-X SQL design/query skill and instead teaches installation, authentication, and cloud account access for the Aliyun CLI. In an agent skill context, this unnecessary expansion of capability is dangerous because it can prompt users or downstream agents to obtain credentials and perform broader cloud actions unrelated to SQL advisory work, increasing the attack surface and the chance of credential misuse.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The guide walks through credential acquisition, profile management, environment-based auth, and account-level access workflows that are not justified for a SQL advisory skill. In this context, the content normalizes collecting and handling sensitive cloud credentials, which could enable lateral movement from harmless database design assistance into real infrastructure access.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list contains several phrases such as "partitioned table", "partition design", "large table", and "distributed table" that are common technical expressions not uniquely tied to PolarDB-X. In a manifest/markdown trigger field, these broad terms can overlap with ordinary database discussions and invoke the skill outside its intended product scope.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 30)May include surrounding context.

md
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 45)May include surrounding context.

md
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 58)May include surrounding context.

md
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 71)May include surrounding context.

Extract and install

tar -xzf aliyun-cli-linux-latest-arm64.tgz sudo mv aliyun /usr/local/bin/

text

### Windows

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example places long-lived access keys directly on the command line, where they may be exposed through shell history, process listings, terminal logging, support transcripts, or CI job output. In a shared workstation or automated agent environment, that can lead to credential disclosure and subsequent unauthorized cloud access.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 118)May include surrounding context.

md
1. Log in to Aliyun Console: https://ram.console.aliyun.com/
2. Navigate to: AccessKey Management
3. Create a new AccessKey pair
4. Save the secret immediately — it's only shown once

### Configuration Modes

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document recommends storing credentials in environment variables without warning that environments are often exposed to child processes, debugging tools, crash dumps, CI logs, and orchestration metadata. This creates a realistic path for accidental secret leakage, especially in automation contexts the guide explicitly targets.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 404)May include surrounding context.

bash
# Restrict permissions
chmod 600 ~/.aliyun/config.json

Troubleshooting

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The example shows ALTER TABLE ... DROP PARTITION without any warning that dropping a partition permanently deletes all data stored in that partition. In a database-design skill focused on operational SQL for PolarDB-X, users may copy examples directly into production or staging environments, making omission of destructive-operation warnings materially unsafe.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation states that EXPLAIN ANALYZE_EXECUTE actually executes the SQL, but it does not clearly warn that this can trigger real side effects for non-SELECT statements such as INSERT, UPDATE, or DELETE. In a diagnostic skill, users may copy examples or recommendations directly, so insufficient warning can lead to unintended data modification or operational impact in production environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The markdown explains that expired data is 'cleaned up automatically' and later shows removal of TTL and dropping an archive table, but it does not explicitly warn users that these operations can permanently delete data or affect retention. For markdown files, destructive behavior that could affect user data should be accompanied by a clear warning.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.