Back to skill

Security audit

KWDB Data Migration

Security checks for vulnerabilities and agentic risk

Overview

This database migration skill matches its purpose, but it needs Review because it handles real database credentials and can send them over HTTP while some workflows can execute schema-changing operations without a guaranteed confirmation gate.

Install only after reviewing the database-impacting workflows. Use HTTPS to a trusted KDTS server, avoid pasting production passwords or tokens into chat, prefer secret-manager or environment references, use least-privileged database accounts, and require an explicit human approval step immediately before DDL execution, data migration execution, or task termination.

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/api_client.py:104
Finding

Database Credentials Can Be Transmitted to an Untrusted KDTS Endpoint over Plaintext HTTP

Content
View full analysis
str: """Build full API URL from endpoint path.""" return f"{self.base_url}{self.api_prefix}{endpoint}" def _request(self, method: str, endpoint: str, data: Optional[Dict] = None, params: Optional[Dict] = None) -> Dict[str, Any]: url = self._build_url(endpoint) try: if method == 'GET': response = self.session.get( url, params=params, timeout=(self.connect_timeout, self.timeout) ) elif method == 'POST': response = self.session.post( url, json=data, timeout=(self.connect_timeout, self.timeout) ) ``` The destination is allowed to use HTTP and may be supplied through parameters, environment variables, or configuration files: ```python # scripts/config.py if explicit_url: logger.info(f"Using explicit base_url: {explicit_url}") return self._normalize_url(explicit_url) env_base_url = os.environ.get(ENV_BASE_URL) if env_base_url: logger.info(f"Using base_url from environment: {env_base_url}") return self._normalize_url(env_base_url) if env_host and env_port: url = f"http://{env_host}:{env_port}" logger.info(f"Using host+port from environment: {url}") return self._normalize_url(url) default_url = f"http://{DEFAULT_HOST}:{DEFAULT_PORT}" logger.info(f"Using default base_url: {default_url}") return default_url ``` ```python @staticmethod def _normalize_url(url: str) -> str: """Normalize ...[truncated 3797 chars]
Remediation
View remediation
str: parsed = urlparse(url) if parsed.scheme not in {"https", "http"}: raise ValueError("Only HTTPS endpoints are supported") host = parsed.hostname if not host: raise ValueError("KDTS endpoint must include a hostname") addresses = { ipaddress.ip_address(item[4][0]) for item in socket.getaddrinfo(host, parsed.port or 443) } loopback_only = addresses and all(address.is_loopback for address in addresses) if parsed.scheme != "https" and not loopback_only: raise ValueError("Plaintext HTTP is allowed only for loopback development endpoints") return url.rstrip("/") ``` 2. Change all remote examples and templates to `https://`. 3. Do not silently prepend `http://`; reject URLs without an explicit scheme. 4. Require explicit user confirmation before first sending credentials to a newly configured KDTS hostname. 5. Provide an administrator-configurable hostname or certificate allowlist. 6. Retain TLS certificate verification and optionally support certificate pinning or a private CA bundle. 7. Prevent redirects from forwarding credential-bearing POST bodies to a different host. Configure requests not to follow redirects for sensitive operations or validate every redirect destination. 8. Add authentication between the client and KDTS, such as mutual TLS or a scoped API token. 9. Use database accounts restricted to only the schemas and operations required for migration. 10. Avoid placing passwords in chat transcripts, command-line arguments, examples, logs, or persistent configuration files. Prefer a secret manager or protected environment-based secret reference. 11. Add automated tests proving that remote HTTP endpoints and unsupported URL schemes are rejected. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/migration_task.py:580
Finding

Full and Schema-Only Workflows Execute Destructive DDL When No Confirmation Callback Is Supplied

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:120
Finding

Third-Party HTTP Dependency Is Installed Without Version or Integrity Pinning

Content
View full analysis
Remediation
View remediation
``` 4. Install with `pip install --require-hashes -r requirements.txt`. 5. Document the expected trusted package index and disallow untrusted extra indexes in production. 6. Run dependency vulnerability scanning in CI and update pins through a reviewed process. 7. Generate and retain a software bill of materials for released Skill packages. 8. Remove bare `pip install requests` instructions or replace them with installation from the reviewed lock file. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (67)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a full-featured heterogeneous database migration skill for KDTS/KaiwuDB, but this code chunk is a support module for client/server configuration only. It reads environment variables and JSON/YAML config files, resolves KDTS connection parameters, and can write a template config file. Those are consistent as helper utilities for a migration tool, but the actual code shown does not implement the core declared behavior. Because the primary purpose of the code chunk is configuration management rather than migration operations, the description materially overstates what this code actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description presents a full automated heterogeneous database migration skill for KaiwuDB/KWDB via KDTS REST API, with broad triggers covering migration creation, configuration, execution, monitoring, and management. The supplied code chunk, however, only implements a migration-related support utility: an error code catalog and formatter. While it is thematically related to KDTS migration, its primary purpose is materially narrower and different from the declared end-user capability. This is not merely an internal helper detail within a larger shown implementation; based on this chunk alone, the behavior is limited to interpreting and formatting error information, with no actual migration, API integration, or operational task handling.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
For complete configuration reference, see `references/api-reference.md` Chapter 11.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
For complete configuration reference, see `references/api-reference.md` Chapter 11.

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
70% confidence
Finding

Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.

Content

Scanner excerpt · assets/prompt-examples.md (reported line 10)May include surrounding context.

md
- **English Version**: This file (`prompt-examples.md`)
- **Chinese Version**: [prompt-examples.zh.md](./prompt-examples.zh.md)

**ALWAYS respond in the same language the user uses.** Both versions contain real user input examples that the AI Agent should handle appropriately.

---

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The examples show exporting and storing migration configurations with plaintext usernames, passwords, and other connection secrets, but do not warn against secret exposure or recommend secure storage. In practice, users and downstream systems may copy this pattern directly, causing credential leakage through files, chat transcripts, logs, backups, or version control.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The configuration export example includes plaintext usernames and passwords in a JSON file while presenting save/load behavior without a prominent warning about secret handling. This can normalize insecure storage of database credentials, leading users or downstream tooling to persist highly sensitive access data to disk, logs, repositories, or shared storage where it may be exposed and reused.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · references/error-codes.md (reported line 496)May include surrounding context.

md
python3 --version  # Should show 3.x

# If not installed (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install python3

# If not installed (CentOS/RHEL)
sudo yum install python3

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill describes capabilities that involve environment access, file reads/writes, shell usage, and network calls, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, that omission can allow overly broad tool access and makes it harder to enforce least privilege or detect unsafe execution paths involving credentials, migration scripts, and remote endpoints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger conditions are very broad, including generic requests to transfer or sync data between different databases, which can cause the skill to activate in unintended contexts. In practice, this may route unrelated user requests into a high-impact workflow that collects credentials, accesses network endpoints, and proposes DDL or migration actions without sufficient relevance checks.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill explicitly instructs the agent to retain and later resurface prior session details including source/target hosts, database names, and progress. Because the workflow also collects usernames and passwords earlier in the document, this pattern increases the risk of exposing sensitive infrastructure and connection information across sessions, to the wrong user, or in an unintended context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document instructs operators to delete existing tables and later to use TRUNCATE TABLE, but the warning about irreversible data loss is only lightweight checklist text rather than a strong procedural safeguard. In an automation-oriented migration skill, users may execute destructive steps quickly or out of order, causing accidental production data loss or service disruption.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger list is overly broad for an auto-invoked skill: generic verbs like 'sync', 'import', 'export', 'transfer', plus common nouns like 'error', 'status', and 'create table' can match many unrelated conversations. This can cause unintended skill activation, leading the agent to solicit or process database connection details and perform migration-oriented actions outside the user's intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger section is broad enough to match very common verbs and generic migration-related phrases, which can cause the skill to activate in contexts the user did not intend. In a skill that handles database connectivity, migration control, and potentially destructive actions, accidental invocation increases the chance of collecting sensitive credentials or initiating risky workflows without clear user intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The scenarios explicitly ask users to provide database passwords and tokens directly in chat and then echo example secrets in plaintext. In an agent setting, chat transcripts may be logged, retained, or exposed to operators and downstream systems, which increases the risk of credential leakage and subsequent unauthorized access to source/target databases or KDTS services.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The scenario instructs users to paste live database credentials directly into the chat and demonstrates those secrets in plaintext, which normalizes unsafe secret handling. In an agent setting, conversational channels are commonly logged, retained, or visible to operators, so this can expose production passwords and materially increase credential leakage risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This InfluxDB migration example similarly collects and displays tokens and target database passwords in plaintext during the dialogue. Because the skill is specifically designed to operate on real infrastructure, the contextual risk is higher: users are likely to provide valid credentials, which could then be stored in transcripts or reused if exposed.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The complex migration scenario continues the same unsafe pattern at larger scale, requesting and replaying a production-style token and database password for a high-value dataset. The operational context makes this more dangerous because large enterprise migrations are likely to involve privileged credentials and sensitive telemetry, so transcript leakage could enable broad unauthorized access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation repeatedly includes plaintext database usernames and passwords in request examples without any accompanying warning about secret handling, redaction, or use of environment-backed placeholders. In a migration skill, users are likely to copy and adapt these examples directly, which increases the chance of credential leakage into chat logs, shell history, source control, tickets, or shared runbooks.

Content

No source excerpt is available for this finding.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/api-reference.md (reported line 44)May include surrounding context.

}

text

| Field    | Type    | Required | Allowed Values                                                                                                                          | Description                         |
|----------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| engine   | String  | Yes      | RELATIONAL, TIMESERIES                                                                                                                  | Database engine type                |
| type     | String  | Yes      | MYSQL, ORACLE, POSTGRESQL, SQLSERVER, CLICKHOUSE, KAIWUDB, TDENGINE2X, TDENGINE3X, INFLUXDB1X, INFLUXDB2X, OPENTSDB, MONGODB, FTP, HDFS | Database product type               |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/api-reference.md (reported line 46)May include surrounding context.

md
| Field    | Type    | Required | Allowed Values                                                                                                                          | Description                         |
|----------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| engine   | String  | Yes      | RELATIONAL, TIMESERIES                                                                                                                  | Database engine type                |
| type     | String  | Yes      | MYSQL, ORACLE, POSTGRESQL, SQLSERVER, CLICKHOUSE, KAIWUDB, TDENGINE2X, TDENGINE3X, INFLUXDB1X, INFLUXDB2X, OPENTSDB, MONGODB, FTP, HDFS | Database product type               |
| url      | String  | No       | -                                                                                                                                       | Full JDBC URL (overrides host:port) |
| host     | String  | No*      | -                                                                                                                                       | Hostname or IP address              |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/api-reference.md (reported line 48)May include surrounding context.

md
|----------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| engine   | String  | Yes      | RELATIONAL, TIMESERIES                                                                                                                  | Database engine type                |
| type     | String  | Yes      | MYSQL, ORACLE, POSTGRESQL, SQLSERVER, CLICKHOUSE, KAIWUDB, TDENGINE2X, TDENGINE3X, INFLUXDB1X, INFLUXDB2X, OPENTSDB, MONGODB, FTP, HDFS | Database product type               |
| url      | String  | No       | -                                                                                                                                       | Full JDBC URL (overrides host:port) |
| host     | String  | No*      | -                                                                                                                                       | Hostname or IP address              |
| port     | Integer | No*      | -                                                                                                                                       | Port number                         |
| username | String  | Yes      | -                                                                                                                                       | Database username                   |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/api-reference.md (reported line 49)May include surrounding context.

md
|----------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| engine   | String  | Yes      | RELATIONAL, TIMESERIES                                                                                                                  | Database engine type                |
| type     | String  | Yes      | MYSQL, ORACLE, POSTGRESQL, SQLSERVER, CLICKHOUSE, KAIWUDB, TDENGINE2X, TDENGINE3X, INFLUXDB1X, INFLUXDB2X, OPENTSDB, MONGODB, FTP, HDFS | Database product type               |
| url      | String  | No       | -                                                                                                                                       | Full JDBC URL (overrides host:port) |
| host     | String  | No*      | -                                                                                                                                       | Hostname or IP address              |
| port     | Integer | No*      | -                                                                                                                                       | Port number                         |
| username | String  | Yes      | -                                                                                                                                       | Database username                   |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/api-reference.md (reported line 50)May include surrounding context.

md
|----------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| engine   | String  | Yes      | RELATIONAL, TIMESERIES                                                                                                                  | Database engine type                |
| type     | String  | Yes      | MYSQL, ORACLE, POSTGRESQL, SQLSERVER, CLICKHOUSE, KAIWUDB, TDENGINE2X, TDENGINE3X, INFLUXDB1X, INFLUXDB2X, OPENTSDB, MONGODB, FTP, HDFS | Database product type               |
| url      | String  | No       | -                                                                                                                                       | Full JDBC URL (overrides host:port) |
| host     | String  | No*      | -                                                                                                                                       | Hostname or IP address              |
| port     | Integer | No*      | -                                                                                                                                       | Port number                         |
| username | String  | Yes      | -                                                                                                                                       | Database username                   |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · references/api-reference.md (reported line 51)May include surrounding context.

md
|----------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| engine   | String  | Yes      | RELATIONAL, TIMESERIES                                                                                                                  | Database engine type                |
| type     | String  | Yes      | MYSQL, ORACLE, POSTGRESQL, SQLSERVER, CLICKHOUSE, KAIWUDB, TDENGINE2X, TDENGINE3X, INFLUXDB1X, INFLUXDB2X, OPENTSDB, MONGODB, FTP, HDFS | Database product type               |
| url      | String  | No       | -                                                                                                                                       | Full JDBC URL (overrides host:port) |
| host     | String  | No*      | -                                                                                                                                       | Hostname or IP address              |
| port     | Integer | No*      | -                                                                                                                                       | Port number                         |
| username | String  | Yes      | -                                                                                                                                       | Database username                   |

Static analysis

No suspicious patterns detected.