TMAegis
Plus de règles pour tdsql

TMA-TDSQL-1.5

Ensure Passwords Are Not Passed via the Command Line

ÉlevéeNiveau 1Automatiséetdsql

Description

When using the MySQL client or TDSQL tools, passwords should not be specified via the command-line arguments -p<password> or --password=. Counts running MySQL client processes and shell-history entries that pass a password inline (-p<password> or --password=). Restricted to MySQL client tools to avoid false matches such as mkdir -p.

Méthode de vérification

Méthode d'audit: Commande shell

shell
out=$(ps -eo args= 2>/dev/null) || exit 1; p=$(printf '%s\n' "$out" | grep -v tdsql_cli_pw_audit | grep -cE '(mysql|mysqladmin|mysqldump|mysqlbinlog|mysqlsh)[^|;]*[[:space:]](-p[^[:space:]]|--password=)' || true); h=$(cat /root/.bash_history /home/*/.bash_history 2>/dev/null | grep -cE '(mysql|mysqladmin|mysqldump|mysqlbinlog|mysqlsh)[^|;]*[[:space:]](-p[^[:space:]]|--password=)' || true); echo $((p + h)) # tdsql_cli_pw_audit
Sortie attendue
0

Méthode de correction

Méthode de correction: Recommandation ou correctif d'infrastructure

Use a MySQL option file (~/.my.cnf with [client] user/password, mode 600) or the TDSQL encrypted credential system instead of -p<password>; clear affected shell history entries and rotate any exposed passwords.

Propriétés

Systèmes d'exploitation
Tous
Étiquettes
tdsqlcredentials
Référence
CIS Tencent TDSQL 10.3.22 Benchmark v1.0.0 - 1.5 Ensure Passwords Are Not Passed via the Command Line

Vérifier cet hôte

Exécutez cette commande sur une machine que vous êtes autorisé à auditer. L'analyse est en lecture seule.

shell
tmaegis scan --target tdsql