apache / apache/cloudstack

Security: ACS user access to all databases

オープン
#8,240 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
archive component:database status:needs-investigation type:security
主要言語
Java
スター
3.1k
フォーク
1.4k
平均マージ
6日 19時間
マージ済み PR(30日)
32

説明

##### ISSUE TYPE

* Bug Report
* Improvement Request
* Enhancement Request

##### COMPONENT NAME

~~~
Core, MySQL
~~~

##### CLOUDSTACK VERSION

~~~
4.19.0.0-snapshot.20231113
~~~

##### CONFIGURATION

##### OS / ENVIRONMENT

Ubuntu 22.04

##### SUMMARY

ACS requires access to all MySQL databases, which creates a huge security hole for a shared MySQL instance.

Trying to limit the scope of ACS access yields in the access denied error (see below).

##### STEPS TO REPRODUCE

~~~
> `sudo cloudstack-setup-databases cloud:cloud@mysql --deploy-as=root`

/usr/share/cloudstack-management/setup/create-database.sql
lines: 64-65
GRANT process ON *.* TO cloud@`localhost`;
GRANT process ON *.* TO cloud@`%`;

// This works with the full access
GRANT ALL ON *.* TO 'root'@'hyp0' WITH GRANT OPTION

// This yields in an error:
- GRANT ALL ON mysql.* TO 'root'@'hyp0' WITH GRANT OPTION
- GRANT ALL ON billing.* TO 'root'@'hyp0' WITH GRANT OPTION
- GRANT ALL ON cloud.* TO 'root'@'hyp0' WITH GRANT OPTION
- GRANT ALL ON cloud_usage.* TO 'root'@'hyp0' WITH GRANT OPTION
~~~

##### EXPECTED RESULTS

~~~
ACS configs own databases only without an error
~~~

##### ACTUAL RESULTS

~~~
ACS wants a full access and gives an error when a limited db access is provided

We apologize for below error:
table:
/usr/share/cloudstack-management/setup/create-database.sql

Error:
b"ERROR 1045 (28000) at line 64: Access denied for user 'root'@'hyp0' (using password: NO)\n"
~~~

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

/usr/share/cloudstack-management/setup/create-database.sql、特に64-65行目から始め、示されている制限された MySQL grant を使ってセットアップコマンドを再現します。ACS に必要なデータベースと権限を追跡します。必要なデータベース範囲だけで CloudStack setup が成功し、無関係なデータベースへのアクセスがない状態になれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
mysql, sql
領域
databases, security
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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