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