Back to skill

Security audit

Zero TiDB(Deprecated)

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward TiDB Cloud Zero quickstart skill with no hidden code, but users should protect the temporary database credentials it generates.

Install only if you intend to let the agent create temporary TiDB Cloud Zero databases. Treat the returned connection details as secrets: avoid committing response files, use restrictive file permissions, delete them when done, and prefer safer MySQL credential handling over putting passwords directly in commands.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:19
Finding
Database credentials stored in a plaintext file without enforced access controls<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 19–22; related credential-storage guidance at lines 64–68 **Vulnerability Type**: Plaintext storage of sensitive credentials and unsafe file permissions **Risk Level**: Medium ### Vulnerable Code ```bash curl -s -X POST https://zero.tidbapi.com/v1alpha1/instances \ -H "Content-Type: application/json" \ -d '{"tag":"sql-smoke-test"}' \ | tee tidb-zero.json ``` Related guidance: ```text Agent note: After provisioning succeeds, save the instance details to a local file (for example, tidb-cloud-zero.json) and remind the user to store the file securely because it contains sensitive credentials. ``` ### Technical Analysis The API response contains the database username, password, host, and complete connection URI. Piping the response through `tee tidb-zero.json` stores all of these credentials in plaintext. The file's permissions depend on the process's current `umask`. The example does not enforce owner-only access, verify the destination, prevent symbolic-link attacks, exclude the file from version control, or remove it when the database is no longer needed. A general reminder to store the file securely does not technically enforce these protections. The database is ephemeral, which limits the exposure period, but the credentials remain usable until the instance expires. Copies may also persist in source-control history, backups, CI artifacts, or logs after expiration. ### Attack Path 1. A user or agent follows the documented smoke-test instructions. 2. The provisioning endpoint returns active database credentials. 3. `tee` writes the complete response to `tidb-zero.json` under ambient filesystem permissions. 4. Another local account, process, CI artifact collector, backup process, or repository user obtains the file. 5. The attacker extracts `instance.connectionString` or the individual username and password. 6. The attacker connects to the database before expiration and accesses ...[truncated 551 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Avoid writing the provisioning response to disk unless persistence is necessary. - If a file is required, enforce restrictive permissions before creation: ```bash umask 077 response_file="$(mktemp "${TMPDIR:-/tmp}/tidb-zero.XXXXXX.json")" chmod 600 "$response_file" curl --fail-with-body --silent --show-error \ -X POST https://zero.tidbapi.com/v1alpha1/instances \ -H "Content-Type: application/json" \ -d '{"tag":"sql-smoke-test"}' > "$response_file" ``` - Register cleanup with `trap` and remove the file as soon as it is no longer required: ```bash trap 'rm -f -- "$response_file"' EXIT ``` - Do not use a predictable filename in a shared temporary directory. - Add credential-response filenames to `.gitignore` and prevent their collection as CI artifacts. - Avoid backups and logging of the response file. - Prefer extracting required values in memory or passing them through a protected secret-management mechanism. - Clearly document that the response is a secret and should be deleted when the instance expires. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:24
Finding
Database passwords exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 24–28 and 113–116 **Vulnerability Type**: Sensitive information exposure through process arguments and shell history **Risk Level**: Medium ### Vulnerable Code ```bash # 2) Extract connection string jq -r '.instance.connectionString // .connectionString' tidb-zero.json # 3) Run SQL query (replace <connectionString> with step 2 output) mysql "<connectionString>" -e "SELECT 1 AS health_check, 2 AS example_value;" ``` The document also provides this password-bearing CLI command: ```bash mysql --connect-timeout=10 --protocol=TCP -h '<HOST>' -P 4000 -u '<USERNAME>' -p'<PASSWORD>' ``` ### Technical Analysis Both examples instruct the user to place credentials directly in command-line arguments. The connection URI contains the username and password, while the second command explicitly supplies the password using `-p'<PASSWORD>'`. Command arguments can be exposed through process-inspection interfaces and operational monitoring tools. They may also be retained in shell history, terminal recordings, debugging output, CI logs, audit telemetry, or copied command transcripts. Quoting a secret protects shell parsing but does not hide it from the process argument vector. Although some operating systems restrict access to other users' process information, the examples cannot safely assume those restrictions. MySQL clients also commonly warn that supplying a password on the command line is insecure. ### Attack Path 1. A user replaces the placeholders with active TiDB connection credentials and executes the documented command. 2. The shell records the command in history, or the operating system exposes the command's argument vector while the client is running. 3. A local user, monitoring agent, CI log reader, support operator, or process with access to the history or telemetry captures the password or full connection URI. 4. The attacker uses the recovered credentials to connect to the ephemeral da ...[truncated 578 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not include passwords or complete credential-bearing connection URIs in command-line arguments. - Prefer a protected, temporary MySQL option file: ```bash umask 077 defaults_file="$(mktemp "${TMPDIR:-/tmp}/tidb-client.XXXXXX.cnf")" trap 'rm -f -- "$defaults_file"' EXIT cat > "$defaults_file" <<'EOF' [client] host=<HOST> port=4000 user=<USERNAME> password=<PASSWORD> protocol=TCP ssl-mode=VERIFY_IDENTITY EOF mysql --defaults-extra-file="$defaults_file" \ -e "SELECT 1 AS health_check, 2 AS example_value;" ``` - Alternatively, omit the password value after `-p` so that the client prompts for it interactively: ```bash mysql --connect-timeout=10 --protocol=TCP \ -h '<HOST>' -P 4000 -u '<USERNAME>' -p ``` - Use an approved credential helper or secret manager for automated workflows. - Disable shell tracing around credential handling and ensure CI systems mask secret values. - Avoid printing the complete `connectionString`; redact its password before displaying or logging it. - Delete temporary credential files immediately after use and enforce mode `0600`. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

External Transmission

Medium
Category
Data Exfiltration
Content
```bash
# 1) Provision instance
curl -s -X POST https://zero.tidbapi.com/v1alpha1/instances \
  -H "Content-Type: application/json" \
  -d '{"tag":"sql-smoke-test"}' \
  | tee tidb-zero.json
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
## Quick Start

```bash
curl -X POST https://zero.tidbapi.com/v1alpha1/instances \
  -H "Content-Type: application/json" \
  -d '{
    "tag": "agent-run"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Static analysis

No suspicious patterns detected.