Back to skill

Security audit

huawei-cloud-dws-migration-teradata-to-dws

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches a Teradata-to-DWS migration tool, but one default validation path can execute source Teradata stored procedures despite the skill's source-read-only promise.

Review carefully before installing or running against production. Use a read-only Teradata account with no execute permission on write-capable procedures, run validate_functional.py with --skip-procs unless procedures have been reviewed, avoid --force and --truncate-before-import without backups, and verify all DWS/OBS endpoints and credentials before migration.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/validate_functional.py:486
Finding

Unrestricted Execution of Source-Side Teradata Procedures

Content
View full analysis

Vulnerability Details

File Location: scripts/validate_functional.py, lines 486–493
Vulnerability Type: Source database write-safety bypass
Risk Level: High

Vulnerable code:

python
# --- TD side: CALL invocation ---
try:
    td_sql = _SQL_CALL + ' ' + _qi(td_db) + '.' + _qi(proc_name) + '()'
    td_cols, td_rows = execute_td_query(td_conn, td_sql)
    result['td_status'] = 'success'
    result['td_row_count'] = len(td_rows)
    result['details']['td_columns'] = td_cols

Technical Analysis

Functional validation calls each discovered zero-argument procedure on the source Teradata database. The call is passed to execute_td_query(), which invokes the database driver directly and does not apply TeradataReader._validate_readonly().

Although the database and procedure identifiers are validated, identifier quoting only prevents SQL injection. It does not establish that the selected procedure is read-only. A procedure body may perform DML, DDL, transaction control, or external side effects.

This bypasses the project's stated source-read-only security boundary. The DWS procedure invocation is subsequently rolled back, but no equivalent rollback or technically enforced read-only transaction protects the Teradata invocation.

Trigger conditions:

  • Functional validation is run without --skip-procs, which is the default behavior.
  • The selected source database contains a callable zero-argument procedure.
  • That procedure performs writes or another persistent side effect.
  • The configured Teradata account has sufficient permission to perform that operation.

Attacker-controlled point: A database user able to create or modify a procedure in the selected source database can control its body. Independently of malicious modification, an existing business procedure with legitimate write behavior also triggers the unsafe path.

Trust boundary: Database-resident code crosses from met ...[truncated 1419 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not execute source-side stored procedures during validation by default. Require an explicit opt-in for procedure execution.
  • Require separate, per-procedure confirmation that clearly identifies the source procedure and warns that its body may modify production state.
  • Use a dedicated Teradata account whose privileges are technically restricted to metadata and read-only data access. Do not grant execution rights on write-capable procedures.
  • Inspect and classify procedure definitions before execution, rejecting any procedure that cannot be proven read-only. Static inspection should be treated as defense in depth rather than the sole control.
  • Route all source operations through a common security layer instead of calling the raw driver helper directly.
  • Where supported, enable a database-enforced read-only session or transaction. Do not rely solely on rollback because procedures may commit internally or produce non-transactional external side effects.
  • Change procedure validation to compare definitions or migration artifacts without invoking source procedures when read-only behavior cannot be guaranteed.
  • Add regression tests demonstrating that write-capable procedures are rejected and never invoked on the source system.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (66)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the code is validation-only or partial while the skill markets itself as full migration automation, users may over-trust it and bypass separate verification or change controls. In production data environments, misleading capability claims can indirectly cause integrity loss or incomplete migrations even without overtly malicious logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

If the code is validation-only or partial while the skill markets itself as full migration automation, users may over-trust it and bypass separate verification or change controls. In production data environments, misleading capability claims can indirectly cause integrity loss or incomplete migrations even without overtly malicious logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

If the code is validation-only or partial while the skill markets itself as full migration automation, users may over-trust it and bypass separate verification or change controls. In production data environments, misleading capability claims can indirectly cause integrity loss or incomplete migrations even without overtly malicious logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

If the code is validation-only or partial while the skill markets itself as full migration automation, users may over-trust it and bypass separate verification or change controls. In production data environments, misleading capability claims can indirectly cause integrity loss or incomplete migrations even without overtly malicious logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the code is validation-only or partial while the skill markets itself as full migration automation, users may over-trust it and bypass separate verification or change controls. In production data environments, misleading capability claims can indirectly cause integrity loss or incomplete migrations even without overtly malicious logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the code is validation-only or partial while the skill markets itself as full migration automation, users may over-trust it and bypass separate verification or change controls. In production data environments, misleading capability claims can indirectly cause integrity loss or incomplete migrations even without overtly malicious logic.

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

md
python3 scripts/pre_migration_check.py \

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/pre_migration_check.py \

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/pre_migration_check.py \

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/migrate_schema.py --td-config config/teradata_config.ini --dws-config config/dws_config.ini --schema <schema_name>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/migrate_schema.py --td-config config/teradata_config.ini --dws-config config/dws_config.ini --schema <schema_name>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/migrate_schema.py --td-config config/teradata_config.ini --dws-config config/dws_config.ini --schema <schema_name>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/migrate_schema.py --td-config config/teradata_config.ini --dws-config config/dws_config.ini --schema <schema_name>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
python3 scripts/migrate_schema.py --td-config config/teradata_config.ini --dws-config config/dws_config.ini --schema <schema_name>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`teradata_reader.py` 模块通过以下机制确保不会对源端 Teradata 执行任何写操作:

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`dws_writer.py` 提供三种数据导入方式,性能递增:

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The change log documents automatic target-table truncation before import, which is an irreversible destructive operation if enabled on the wrong table or environment. In a migration tool that connects to production warehouses, this context increases risk because the feature directly affects live target data and could wipe tables before a failed or partial import.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code claims write procedures are safely validated via transaction rollback, but it marks execution exceptions as success in one branch and cannot guarantee rollback undoes all effects. Stored procedures can commit internally, use autonomous transactions, perform DDL, call external systems, or otherwise cause side effects that persist despite client-side rollback, so the safety claim is misleading and unsafe.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill describes operations that inherently require shell execution, file access, and environment-variable handling, but it does not declare any explicit tool scope or permissions boundaries. In an agent setting, missing scope declarations can cause over-broad execution privileges and make destructive or secret-accessing actions possible without clear policy constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest lists generic triggers such as “DWS迁移”, “migrate to DWS”, and “迁移到DWS”, which are broad enough to overlap with many ordinary migration requests not specifically about Teradata-to-DWS workflows. Although some triggers are specific, the mixed list lacks clear scope limits or negative examples to prevent unintended invocation outside this skill's intended domain.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation endorses a --force mode that automatically deletes and recreates existing tables, but the warning about destructive impact is not prominent or explicit enough for a production migration context. Because this skill targets live data warehouse environments, a forceful table-rebuild path can cause immediate data loss or service disruption if invoked accidentally or by automation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This manifest/config template contains user-facing natural-language instructions entirely in Chinese, which effectively forces a specific language for operators of the skill. Under the policy, locale or language constraints should either be optional, user-selectable, or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The script uses Teradata, DWS, and OBS configuration files as inputs to migration steps, which strongly implies access to connection details and movement of database data across systems. While the script logs progress, it does not explicitly warn the user that running it will read potentially sensitive credentials and transfer data to remote services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The change log announces that table drops now use CASCADE, which can silently remove dependent views or other objects if operators apply generated DDL without understanding the blast radius. In a database migration skill, this is especially dangerous because users may trust automation and run schema replacement in production-like environments, causing unintended destructive changes beyond the target table itself.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file mixes English headings with core instructional content in Chinese, and the skill does not indicate that Chinese is optional or that the guide is intended only for a Chinese-speaking or region-specific audience. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.