T09 · Insecure Skill Coding Practices
- Location
SKILL.md:41- Finding
Hard-Coded MySQL Credentials Expose Database and Administrative Access
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill fits a deployment troubleshooting assistant, but it needs review because it embeds database passwords and persistently stores sensitive logs and incident records.
Install only in a controlled deployment-support environment after removing and rotating the embedded MySQL passwords, replacing shell-built SQL with parameterized queries or safe wrapper scripts, making raw-log and Excel/MySQL retention explicit opt-in, redacting secrets before storage, and limiting Docker, database, and /data/scripts access to the minimum needed.
SKILL.md:41Hard-Coded MySQL Credentials Expose Database and Administrative Access
SKILL.md:276Mandatory Unredacted Archival of User Logs Creates Persistent Sensitive-Data Exposure
SKILL.md:487Untrusted Log Keywords Can Be Interpolated into MySQL Query Templates
声明强调的是“故障分析助手”工作流,核心能力应包括:1) 优先查询 MySQL 故障知识库;2) 未命中时检索 /data/scripts/;3) 支持交互式单条更新故障库;4) 生成 Word 报告。代码中仅明显实现了第4项的一部分,并额外实现了日志 JSON 解析、错误模式分类、去重归并、批量多故障报告生成以及向 Excel 文件追加记录。没有任何 MySQL 连接/查询代码,没有对 /data/scripts/ 目录的检索逻辑,也没有交互式更新流程。虽然“生成 Word 分析报告”与声明部分一致,但整体主用途和关键资源访问方式与声明不符,因此应判定为描述与行为不匹配。
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
→ decide_cluster_type(扩容节点类型) → get_expand_type(扩展现有 pool 或新建 pool) → IsEbs001MixNode()(mix 扩容时检查 ebs0001 是否 mix 节点) → ceph-deploy gatherkeys → 新节点 init(装包、拷 keyring、清盘) → DeployOsds() → CheckExpandResult()
The skill documentation includes a database initialization command using root credentials and a root password embedded directly in the instructions. This exceeds the needs of a fault-analysis assistant and normalizes privileged administrative actions that could be abused to alter or destroy database contents if the skill or operator follows them. Because the credentials are hardcoded and broadly exposed in the skill file, compromise of the skill content or outputs could leak database admin access.
The skill describes capabilities that read user files and local paths, but it does not declare an explicit tool/permission scope. That creates an overbroad trust boundary: an agent may access files or paths beyond what users expect, especially because the skill also references absolute host paths like /data/scripts and local home directories. In a log-analysis assistant, undeclared file-read capability is risky because uploaded logs and adjacent files often contain secrets, credentials, and infrastructure details.
The manifest description and the operational guidance are entirely written to require Chinese-centric behavior, including fixed Chinese summary/report templates and trigger phrases, with no indication that users may choose another language. This can violate language or locale policy when the skill implicitly forces a specific language without opt-in.
The skill instructs that all new problems be accumulated into Excel and optionally synchronized to MySQL, again without an upfront warning that user-provided incident data will be persistently stored. Incident reports often include sensitive operational and customer environment details, so turning every interaction into a knowledge-base entry creates unnecessary data collection and secondary-use risk. In this context, persistence is not incidental; it is built into the core workflow, which increases exposure.
The instruction to continuously accumulate new user problems into Excel and optionally a database creates a long-lived repository of sensitive incident data. Over time this aggregates not just isolated secrets but patterns about environments, failures, usernames, versions, and infrastructure, increasing both breach impact and insider misuse risk. The skill context makes this more dangerous because the collection appears automatic and embedded in the normal troubleshooting path.
The skill directs the agent to use docker exec and host-side scripts as a primary mechanism, which broadens it from log analysis into host command execution. Even when intended for troubleshooting, this creates a larger attack surface because adversarial user inputs could influence what paths, queries, or scripts are invoked, and the referenced environment contains production-like infrastructure assets. In context, this makes the skill more dangerous than a pure offline parser because it is coupled to operational tooling on the host.
Requiring archival of all raw user inputs and uploaded logs creates a broad sensitive-data retention surface. The stored content can include secrets, infrastructure topology, stack traces, and customer identifiers, and because the workflow saves the original unfiltered artifacts, any compromise of the host account or skill directory exposes high-value operational data. This is particularly dangerous in a fault-analysis context where users are likely to submit precisely the most sensitive debugging evidence.
The skill mandates archiving every raw user input and uploaded log to local storage before analysis, without clear user-facing notice or consent. Logs and pasted error text commonly contain tokens, passwords, internal hostnames, IPs, stack traces, and customer data, so automatic retention materially increases confidentiality risk and breach impact. The context makes this more dangerous because the retention path is persistent under the operator's home directory rather than ephemeral processing.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
| 配置错误 | 对比配置模板 → 校验参数值 | 修正配置文件、重启服务、验证参数生效 |
| 资源不足 | free/df -h/ulimit -n 检查 → top 定位占用进程 | 清理磁盘、扩容、调大 ulimit、重启服务释放泄漏 |
| 服务异常 | systemctl status → journalctl 查崩溃原因 | 重启服务、检查依赖服务状态、排查 OOM killer |
| 权限问题 | ls -l / id / 检查 sudo | 修正文件权限(chmod/chown)、添加 sudo 授权 |
| 依赖缺失 | rpm -qa / pip list → 对比版本要求 | 安装缺失包、版本降级/升级 |
| 数据异常 | 检查数据完整性 → 对比 schema | 数据修复、迁移、回滚 |
This Python file contains natural-language guidance stating features such as '中文错误模式自动分类', and the implementation later hard-codes Chinese category labels and Chinese-centric parsing behavior. That effectively imposes a specific language/locale on outputs and operation without any user opt-in or documented regional justification, which matches the locale-policy violation criteria.
Manifest 将该技能描述为接收日志/报错文本进行分析,并生成 Word 分析报告;虽然整体技能提到支持单条更新故障库,但这个文件自身的模块说明与 CLI 描述都定位为“报告生成器”。代码却实现了 append_to_excel/batch_append_excel,并在 CLI 中根据 --xlsx 直接写入知识库文件,实际行为不只是报告生成。
技能描述强调的是“交互式单条更新故障库”,而这里的 batch_append_excel 文档字符串明确写的是“批量追加多条记录”,CLI 还会把 faults 整批写入 xlsx。这里不是简单的信息缺失,而是文档/意图强调单条交互更新,但实现提供了批量写库路径。
The documentation states '本流程仅写入 MySQL,不修改 Excel', which strongly suggests the update flow’s side effect is limited to MySQL. However, the very next steps direct saving a draft JSON file under the skill directory, so the documentation understates actual write side effects in a way that contradicts the claimed behavior.
This code performs persistent file writes via json.dump(), doc.save(), and wb.save(), including appending to an Excel knowledge base, but provides no explicit warning message about modifying or creating files other than generic CLI parameter help. For a code file, file-write operations should have some visible disclosure, confirmation, or clearly documented warning, especially for the optional Excel append behavior.
No suspicious patterns detected.