Microsoft SQL Server
TMA-MSSQL2022-7.2
Ensure Asymmetric Key Size is set to 'greater than or equal to 2048' in non-system databases
中级别 1自动化mssql
说明
Microsoft Best Practices recommend to use at least a 2048-bit encryption algorithm for asymmetric keys. The RSA_2048 encryption algorithm for asymmetric keys in SQL Server is the highest bit-level provided and therefore the most secure available choice (other choices are RSA_512 and RSA_1024).
检查方式
审计方法: 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 database_id > 4; 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.asymmetric_keys WHERE key_length < 2048) 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;"- 预期输出
0
修复方式
修复方法: 操作指南或基础设施补丁
Refer to Microsoft SQL Server Books Online ALTER ASYMMETRIC KEY entry: https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-asymmetric-key-transact-sql
属性
- 操作系统
- 任意
- 标签
- cryptomssqlsqlserver-2022
- 参考
- CIS Microsoft SQL Server 2022 Benchmark v1.3.0 - 7.2 Ensure Asymmetric Key Size is set to 'greater than or equal to 2048' in non-system databases
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
shell
tmaegis scan --target mssql