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

オープン 初心者向け
#14,530 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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
平均マージ
9日 23時間
マージ済み PR(30日)
19

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/cloudstack のほかの issue

apache/cloudstack の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。