apache / apache/cloudstack

Security: ACS user access to all databases

未关闭
#8,240 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
archive component:database status:needs-investigation type:security
主要语言
Java
星标
3.1k
派生
1.4k
平均合并
6 天 19 小时
30 天内合并 PR
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 授权重现 setup 命令。追踪 ACS 需要哪些数据库和权限;当 CloudStack setup 仅使用所需的数据库范围即可成功,且无法访问不相关的数据库时,即表示完成。

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

评估

技术栈
mysql, sql
领域
databases, security
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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