TMA-POSTGRES-1.7
Verify That the 'PGPASSWORD' Environment Variable is Not in Use
中レベル 1自動postgres
説明
PostgreSQL can read a default database password from an environment variable called PGPASSWORD. Run as root; counts processes whose environment contains PGPASSWORD (including the scanner itself if it was given PGPASSWORD).
チェック方法
監査方法: シェルコマンド
shell
[ "$(id -u)" -eq 0 ] || exit 1; n=$(grep -lsaz '^PGPASSWORD=' /proc/[0-9]*/environ 2>/dev/null | wc -l); echo "$n"- 期待される出力
0
修正方法
修正方法: ガイダンスまたは IaC パッチ
Find the processes (grep -lsaz ^PGPASSWORD= /proc/*/environ) and change the users or scripts that export PGPASSWORD to use ~/.pgpass or another secure method.
プロパティ
- オペレーティングシステム
- すべて
- タグ
- postgresdatabasecredentials
- 参照
- CIS PostgreSQL 18 Benchmark v1.0.0 - 1.7 Verify That the 'PGPASSWORD' Environment Variable is Not in Use
このホストをチェック
監査が許可されているマシンで実行してください。スキャンは読み取り専用です。
shell
tmaegis scan --target postgres