T09 · Insecure Skill Coding Practices
- Location
scripts/hive_explore.py:633- Finding
Automatic Persistence of Plaintext Database Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill mostly performs Hive metadata inspection, but it also creates migration artifacts and can persist credentials in ways users should review before installing.
Install only if you intentionally want this skill to prepare migration artifacts, not just inspect metadata. Use least-privilege read-only Metastore credentials, avoid storing passwords in config files or profiles, do not provide broad S3 keys, review generated shell and SQL files before execution, and prefer Kerberos or tightly isolated NOSASL endpoints.
scripts/hive_explore.py:633Automatic Persistence of Plaintext Database Credentials
scripts/generate_rclone_script.py:36S3 Access Keys Written Verbatim into Generated Shell Scripts
scripts/generate_rclone_script.py:41Shell Command Injection in Generated Rclone Migration Script
scripts/generate_paimon_statements.py:111Hive and Paimon SQL Injection Through Unescaped Metadata
scripts/hive_dive_thrift.py:198Path Traversal and Arbitrary File Overwrite Through Metastore Names
scripts/generate_paimon_statements.py:39Database Passwords Exposed in Process Command-Line Arguments
The skill states it is only for exploration and not migration-related work, but later documents generation of rclone migration scripts, Paimon sync SQL, and an orchestrated pipeline. That inconsistency weakens operator understanding and can cause an agent to execute or prepare materially riskier actions than the user expected from a supposedly read-only inspection skill.
The skill states it is only for exploration and not migration-related work, but later documents generation of rclone migration scripts, Paimon sync SQL, and an orchestrated pipeline. That inconsistency weakens operator understanding and can cause an agent to execute or prepare materially riskier actions than the user expected from a supposedly read-only inspection skill.
The skill states it is only for exploration and not migration-related work, but later documents generation of rclone migration scripts, Paimon sync SQL, and an orchestrated pipeline. That inconsistency weakens operator understanding and can cause an agent to execute or prepare materially riskier actions than the user expected from a supposedly read-only inspection skill.
The skill states it is only for exploration and not migration-related work, but later documents generation of rclone migration scripts, Paimon sync SQL, and an orchestrated pipeline. That inconsistency weakens operator understanding and can cause an agent to execute or prepare materially riskier actions than the user expected from a supposedly read-only inspection skill.
The skill states it is only for exploration and not migration-related work, but later documents generation of rclone migration scripts, Paimon sync SQL, and an orchestrated pipeline. That inconsistency weakens operator understanding and can cause an agent to execute or prepare materially riskier actions than the user expected from a supposedly read-only inspection skill.
The skill states it is only for exploration and not migration-related work, but later documents generation of rclone migration scripts, Paimon sync SQL, and an orchestrated pipeline. That inconsistency weakens operator understanding and can cause an agent to execute or prepare materially riskier actions than the user expected from a supposedly read-only inspection skill.
This file generates CREATE TABLE and INSERT OVERWRITE statements for Hive-to-Paimon migration, which materially exceeds the declared inspection-only scope of the skill. In an agent environment, hidden write-capable or migration-capable functionality expands the blast radius from metadata inspection to downstream data modification or destructive overwrite, increasing the chance of unsafe invocation or privilege misuse.
该 skill 的清单明确说明其职责是 Hive 元数据探查,且“不适用于数据迁移执行、DDL 转换、数据写入等场景,这些功能由下游 skill 承担”。但此文件会根据配置生成 HDFS 到 S3 的 rclone config/create 和 copy 命令,属于为数据迁移准备同步脚本,而非元数据探查本身。
这里将 access_key_id 和 secret_access_key 直接拼接进生成的 shell 命令,随后会写入输出脚本文件,导致敏感凭据以明文形式落盘。任何能读取脚本文件、进程参数历史、CI 日志或工件的人都可能获得对象存储访问权限,进而造成数据泄露、篡改或横向移动。
This script exceeds the declared inspection-only scope by orchestrating downstream migration artifacts: it generates rclone sync scripts and Paimon synchronization SQL after metastore inspection. In an agent-skill context, this broadens the blast radius from read-only metadata analysis to producing actionable migration commands, increasing the risk of unintended data movement or unsafe follow-on execution by users or other automation.
The skill documentation describes capabilities that require shell, network, and file read/write access, but it does not declare an explicit tool scope or permission boundary. In agent environments, this can lead to over-broad execution authority and makes it harder to enforce least privilege or prevent unexpected command execution against databases, HMS endpoints, local files, and external systems.
The documentation first reassures users that incremental exploration does not generate rclone or Paimon statements, then later describes an orchestrator that chains those exact steps. Conflicting safety messaging is dangerous because it undermines informed consent and can lead operators to approve a workflow under false assumptions about what artifacts or follow-on actions it may produce.
The example configuration defaults Thrift authentication to NOSASL, which encourages unauthenticated or weakly authenticated connections to the Hive Metastore unless users proactively switch to Kerberos. In environments where the HMS endpoint is reachable beyond a tightly controlled network boundary, this can expose sensitive metadata and increase the risk of unauthorized enumeration.
[thrift]
host = your_hms_host # HMS Thrift service address
port = 9083 # Thrift port
auth = NOSASL # NOSASL or KERBEROS
kerberos_principal = hive/_HOST@YOUR.REALM # only for KERBEROS mode
timeout = 60 # connection timeout (seconds)
size_source = params # table-size source: params / hadoop / skip
The documented suite relationship expands a read-only exploration skill into downstream migration script generation and orchestration, blurring the boundary between inspection and operational change preparation. In agent systems, this kind of scope creep increases the chance that a user invokes a seemingly safe skill that can materially facilitate data transfer or schema-sync actions.
This code file contains natural-language instructions and prompts exclusively in Chinese, including the module description and interactive configuration guidance. Because the file provides no user opt-in, alternate locale, or justification that the skill is region-specific, it violates the language/locale policy criteria.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
has_password = True
break
if has_password:
print(f" 注意: 文件包含密码明文,建议执行: chmod 600 {path}")
def merge_cli_args_into_config(args, base_config=None):
This code presents its natural-language documentation and operational messages exclusively in Chinese, which imposes a specific language on users. The policy for SQP-3 applies to all file types and flags language/locale constraints unless the skill offers a user choice or clearly justifies the restriction.
The code actively invokes Hive CLI/Beeline to derive DDL that is then used for migration and synchronization workflows, which is inconsistent with a read-only inspection skill. Although the immediate commands shown are read-oriented, this capability enables unauthorized operational coupling to production Hive environments and supports generation of write SQL beyond the manifest's stated purpose.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
'--silent=true', '--showHeader=false',
'--outputformat=tsv2', '-e', cmd
]
result = subprocess.check_output(beeline_cmd, stderr=subprocess.PIPE)
else:
result = subprocess.check_output(
['hive', '-S', '-e', cmd], stderr=subprocess.PIPE)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
]
result = subprocess.check_output(beeline_cmd, stderr=subprocess.PIPE)
else:
result = subprocess.check_output(
['hive', '-S', '-e', cmd], stderr=subprocess.PIPE)
else:
result = subprocess.check_output(
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
]
result = subprocess.check_output(beeline_cmd, stderr=subprocess.PIPE)
else:
result = subprocess.check_output(
['hive', '-S', '-e', cmd], stderr=subprocess.PIPE)
else:
result = subprocess.check_output(
脚本要求读取 S3 目标端的 provider、endpoint、access_key_id、secret_access_key 和 bucket,并将这些信息拼接到生成的 rclone 配置命令中。对于一个声明为执行 Hive Metastore 全量/增量探查的 skill,这种面向跨存储数据同步的凭据处理能力并非其直接、显然必要的实现细节。
The program generates rclone copy commands that transfer data from HDFS to S3, which is a safety-relevant network/data movement operation. While this is part of the tool's purpose, the code provides no explicit user disclosure that the generated script will perform bulk data transfer when run, nor any confirmation or caution about reviewing the commands first.
This code file contains natural-language instructions and runtime messages exclusively in Chinese, which effectively forces a specific language for users and operators. The policy allows locale constraints only when the skill offers user choice or clearly documents and justifies the restriction, which is not present here.
The manifest describes Hive metastore inspection via DB direct connection or HMS Thrift API, exporting metadata, sizes, and DDL. While collecting table size is in scope, implementing it by spawning the local hadoop command introduces an extra capability—external process execution against HDFS—that is not stated in the skill purpose or connection model.
No suspicious patterns detected.