TMAegisBeta
更多 mysql 规则

MySQL

TMA-MYSQL-1.4

Verify That the MYSQL_PWD Environment Variable is Not in Use

中级别 1自动化mysql

说明

MySQL can read a default database password from an environment variable called MYSQL_PWD. Avoiding use of this environment variable can better safeguard the confidentiality of MySQL credentials. Run as root; counts processes whose environment contains MYSQL_PWD (including the scanner itself if it was given MYSQL_PWD).

检查方式

审计方法: Shell 命令

shell
[ "$(id -u)" -eq 0 ] || exit 1; n=$(grep -lsaz '^MYSQL_PWD=' /proc/[0-9]*/environ 2>/dev/null | wc -l); echo "$n"
预期输出
0

修复方式

修复方法: 操作指南或基础设施补丁

Find the processes (grep -lsaz ^MYSQL_PWD= /proc/*/environ) and change the users/scripts that export MYSQL_PWD to use an option file readable only by the user, mysql_config_editor or certificate-based authentication.

属性

操作系统
任意
标签
mysqldatabasecredentials
参考
CIS Oracle MySQL Community Server 8.4 Benchmark v1.1.0 - 1.4 Verify That the MYSQL_PWD Environment Variable is Not in Use

检查本机

请在您有权审计的机器上运行此命令。扫描为只读操作。

shell
tmaegis scan --target mysql