[Hardening] F-21: Base64-Encoded User Data Containing Plain Text Passwords in DB.

未关闭 适合新手
#14,530 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java, mysql

调研方向

从 server/src/main/java/com/cloud/api/ApiServer.java 第 825 行附近开始,issue 在这里链接到了 toJson(params) 序列化。阅读相关的 F-18 和 F-19 发现以了解背景,然后追踪 DeployVMCmd 参数如何到达 job_cmd_info。完成标准是存储的命令信息省略或遮蔽完整的 userdata 值;添加或运行针对序列化命令参数的相关测试。

由索引模型根据 Issue 内容生成。

描述

The required feature described as a wish

Description: The userdata parameter supplied to DeployVMCmd is stored base64-encoded (not encrypted) in DB. Base64 does not offer adequate protection for sensitive information, and in practice the decoded cloud-init frequently contains plaintext passwords (plain_text_passwd, passwd, chpasswd). Because user data is opaque to the platform, its contents cannot be selectively filtered. The field must be treated as sensitive in its entirety.

Image

Affected Components: Management API / DB (cloud.async_job, column job_cmd_info).

Impact: Anyone with read access to the database can base64-decode the stored user data and recover any plaintext credentials the user set in their cloud-init, including passwords for accounts configured with passwordless sudo, thereby granting effective root on the guest.

Steps to Reproduce:

  • Deploy an instance with cloud-init userdata that sets a user password (e.g., plain_text_passwd or a chpasswd block).
  • Query the database:
    • mysql> SELECT job_cmd_info FROM async_job WHERE job_cmd LIKE '%DeployVMCmd%' AND job_cmd_info LIKE '%"userdata":%';
  • Base64-decode the userdata value and observe the embedded credentials in cleartext.

Recommended Remediation: Redact or omit the userdata attribute from params before the toJson(params) serialization (this is the same code site that F-18 identifies for the top-level password parameter). It is recommended to treat the whole cloud-init field as sensitive, like in F-19.

https://github.com/apache/cloudstack/blob/4.22.0.0/server/src/main/java/com/cloud/api/ApiServer.java#L825

See more examples:

Image
主要语言
Java
星标
3.1k
派生
1.4k
平均合并
10 天 6 小时
30 天内合并 PR
22

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudstack 的其他 Issue

查看 apache/cloudstack 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。