TMAegisBêta
Plus de règles pour mssql

Microsoft SQL Server

TMA-MSSQL2022-3.4

Ensure SQL Authentication is not used in contained databases

MoyenneNiveau 1Automatiséemssql

Description

Contained databases do not enforce password complexity rules for SQL Authenticated users. The absence of an enforced password policy may increase the likelihood of a weak credential being established in a contained database.

Méthode de vérification

Méthode d'audit: Requête SQL

sql_query
sqlcmd -b -h -1 -W -Q "SET NOCOUNT ON; DECLARE @n int = 0, @k int, @db sysname, @s nvarchar(max); DECLARE c CURSOR LOCAL FAST_FORWARD FOR SELECT name FROM sys.databases WHERE state = 0 AND HAS_DBACCESS(name) = 1 AND containment <> 0; OPEN c; FETCH NEXT FROM c INTO @db; WHILE @@FETCH_STATUS = 0 BEGIN SET @s = N'USE ' + QUOTENAME(@db) + N'; SELECT @k = COUNT(*) FROM (SELECT name FROM sys.database_principals WHERE name NOT IN (''dbo'',''Information_Schema'',''sys'',''guest'') AND type IN (''U'',''S'',''G'') AND authentication_type = 2) AS x;'; EXEC sp_executesql @s, N'@k int OUTPUT', @k = @k OUTPUT; SET @n = @n + @k; FETCH NEXT FROM c INTO @db; END; CLOSE c; DEALLOCATE c; SELECT @n;"
Sortie attendue
0

Méthode de correction

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

Leverage Windows Authenticated users in contained databases.

Propriétés

Systèmes d'exploitation
Tous
Étiquettes
authmssqlsqlserver-2022
Référence
CIS Microsoft SQL Server 2022 Benchmark v1.3.0 - 3.4 Ensure SQL Authentication is not used in contained databases

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 mssql