TMAegis
Thêm quy tắc cho mssql

TMA-MSSQL2022-3.13

Ensure no admin role membership in MSDB database

Trung bìnhCấp 1Tự độngmssql

Mô tả

Based on Microsoft design an account with DB_OWNER can elevate permissions to SYSADMIN MSDBmust be configured with the TRUSTWORTHY flag ON to work properly. If the TRUSTWORTHY setting is set to ON, and if the owner of the database is a member of a group that has administrative credentials, such as the sysadmin group (for example the default sa login), the database owner can then be able to create and run unsafe assemblies that can compromise the instance of the SQL Server, as well as run code to elevate his privileges to SYSADMIN

Cách kiểm tra

Phương pháp kiểm tra: Truy vấn SQL

sql_query
sqlcmd -b -h -1 -W -Q "SET NOCOUNT ON; SELECT COUNT(*) FROM msdb.sys.database_role_members AS drm JOIN msdb.sys.database_principals AS r ON drm.role_principal_id = r.principal_id JOIN msdb.sys.database_principals AS m ON drm.member_principal_id = m.principal_id WHERE r.name IN ('db_owner','db_securityadmin','db_ddladmin','db_datawriter') AND m.name <> 'dbo';"
Đầu ra mong đợi
0

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

USE [msdb] GO ALTER ROLE [db_owner] DROP MEMBER <username>;

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
iammssqlsqlserver-2022
Tham chiếu
CIS Microsoft SQL Server 2022 Benchmark v1.3.0 - 3.13 Ensure no admin role membership in MSDB database

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target mssql