فحوص أمان SQL Server
تضم وحدة sqlserver_security 9 فحوص. الوضع الأمني لـ SQL Server (متوافق مع CIS، للقراءة فقط). تغذي الاكتشافات مجال أمان قواعد البيانات في درجة الأمان. الإجراءات المقترحة نصوص يتبعها مسؤول قاعدة البيانات (DBA) في نافذة تغيير؛ ولا تنفذها المنصة أبدًا.
تُنشأ هذه الصفحة من كتالوج الفحوص في المنتج عند بناء الوثائق، لذلك تطابق القواعد والفواصل الزمنية والخطورة الافتراضية دائمًا الإصدار الذي تقرؤه. الحدود المعروضة هي القيم الافتراضية، ويمكن للكيانات والموارد تجاوزها.
| الفحص | الفاصل الزمني | الخطورة الافتراضية | القاعدة |
|---|---|---|---|
sqlserver_security.sa_enabledsa login enabled | 3600s | critical | is_disabled = 1 |
sqlserver_security.command_executionOperating-system command execution enabled (xp_cmdshell, OLE Automation) | 3600s | critical | value_in_use = 0 |
sqlserver_security.surface_areaSurface-area features enabled | 3600s | warning | value_in_use = 0 |
sqlserver_security.linked_server_credentialsLinked servers using sa or self credentials | 3600s | critical | warning >= 1 count / critical >= 1 count |
sqlserver_security.sysadmin_membersMembers of sysadmin / securityadmin | 300s | critical | any change |
sqlserver_security.failed_loginsFailed logins per minute | 60s | warning | warning >= 10 per_minute / critical >= 50 per_minute |
sqlserver_security.audit_enabledServer audit enabled and running | 3600s | warning | is_state_enabled = 1 |
sqlserver_security.encryptionTDE and backup encryption | 3600s | warning | backup_encrypted = true |
sqlserver_security.orphaned_usersOrphaned database users | 86400s | info | warning >= 1 count |
الفحوص
sqlserver_security.sa_enabled
sa login enabled
- ما يقيسه
sa_enabled· كل3600s·tsql- القاعدة
is_disabled = 1· الخطورة الافتراضية: critical- الإجراء
- Confirm that no application, job or linked server signs in as sa (the error log and a login trace show it), then disable it in a change window (ALTER LOGIN [sa] DISABLE) and rename it if your policy requires it. Use named logins with only the permissions they need.
- خط الأساس
- CIS Microsoft SQL Server Benchmark: sa must be disabled (and ideally renamed); enforce password policy if it must exist. The well-known sid 0x01 finds it even when renamed. · المصدر
sqlserver_security.command_execution
Operating-system command execution enabled (xp_cmdshell, OLE Automation)
- ما يقيسه
feature_enabled· كل3600s·tsql- القاعدة
value_in_use = 0· الخطورة الافتراضية: critical- الإجراء
- Find what uses the option (search jobs and procedures for xp_cmdshell / sp_OACreate) with its owner. If nothing needs it, turn it off in a change window (EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 0; RECONFIGURE;). If it must stay, restrict who can run it and accept the risk with a reason.
- خط الأساس
- CIS: xp_cmdshell and Ole Automation Procedures must be 0 unless a documented exception exists. · المصدر
sqlserver_security.surface_area
Surface-area features enabled
- ما يقيسه
feature_enabled· كل3600s·tsql- القاعدة
value_in_use = 0· الخطورة الافتراضية: warning- الإجراء
- Ask the owner of the instance whether the option is needed (Database Mail XPs is needed by Database Mail, clr enabled by CLR assemblies). If not, set it to 0 in a change window (EXEC sp_configure '<option>', 0; RECONFIGURE;); if it is, accept the risk with the reason so the next review knows.
- خط الأساس
- CIS 2.1–2.8: each should be 0 unless documented. Command execution (xp_cmdshell, OLE Automation) is checked separately as critical. · المصدر
sqlserver_security.linked_server_credentials
Linked servers using sa or self credentials
- ما يقيسه
risky_linked_logins(count) · كل3600s·tsql- القاعدة
warning >= 1 count / critical >= 1 count· الخطورة الافتراضية: critical- الإجراء
- Create a remote login with only the rights the linked server needs (often read-only), map the local logins that use the linked server to it (sp_addlinkedsrvlogin with @useself = 'FALSE'), then remove the catch-all or sa mapping (sp_droplinkedsrvlogin) in a change window. Test the queries that use the linked server afterwards.
- خط الأساس
- Linked-server mappings must use a least-privilege remote login, never sa or a catch-all self credential. · المصدر
sqlserver_security.sysadmin_members
Members of sysadmin / securityadmin
- ما يقيسه
privileged_members· كل300s·tsql- القاعدة
any change· الخطورة الافتراضية: critical- الإجراء
- Confirm the change with the person who made it (the server audit or the default trace shows who) and that an approved request exists. If it was not approved, remove the member in a change window (ALTER SERVER ROLE [sysadmin] DROP MEMBER [<login>]) and review what the login did meanwhile. Resolve the event once reviewed.
- خط الأساس
- Any change in membership raises an event (the first run only records the baseline); review quarterly. · المصدر
sqlserver_security.failed_logins
Failed logins per minute
- ما يقيسه
failed_logins_per_min(per_minute) · كل60s·tsql- القاعدة
warning >= 10 per_minute / critical >= 50 per_minute· الخطورة الافتراضية: warning- الإجراء
- Read the error log entries (error 18456; the state number says why) to find the login and the client address. A service with an expired or changed password is fixed by its owner; an unknown client is blocked at the firewall. Keep CHECK_POLICY = ON for SQL logins so the Windows lockout policy applies.
- خط الأساس
- Bursts of failed logins from one client indicate brute force or a broken service credential. · المصدر
sqlserver_security.audit_enabled
Server audit enabled and running
- ما يقيسه
audit_state· كل3600s·tsql- القاعدة
is_state_enabled = 1· الخطورة الافتراضية: warning- الإجراء
- Create (or enable) a server audit that writes to a protected location, with a server audit specification for at least FAILED_LOGIN_GROUP, SUCCESSFUL_LOGIN_GROUP, SERVER_ROLE_MEMBER_CHANGE_GROUP and AUDIT_CHANGE_GROUP; turn it on with ALTER SERVER AUDIT [<name>] WITH (STATE = ON). An audit that is defined but disabled on purpose should be dropped or accepted with a reason.
- خط الأساس
- CIS 5.x: at least one server audit capturing login and role changes, enabled and running. · المصدر
sqlserver_security.encryption
TDE and backup encryption
- ما يقيسه
encryption_state· كل3600s·tsql- القاعدة
backup_encrypted = true· الخطورة الافتراضية: warning- الإجراء
- Create a certificate (or asymmetric key) in master, back it up with its private key to a safe place outside the server, then change the backup jobs to BACKUP DATABASE … WITH ENCRYPTION (ALGORITHM = AES_256, SERVER CERTIFICATE = <certificate>). Restore one encrypted backup on another server before relying on it. Consider TDE for databases with regulated data.
- خط الأساس
- Production backups should be encrypted; TDE recommended for regulated data (https://learn.microsoft.com/sql/relational-databases/security/encryption/transparent-data-encryption). · المصدر
sqlserver_security.orphaned_users
Orphaned database users
- ما يقيسه
orphaned_users(count) · كل86400s·tsql- القاعدة
warning >= 1 count· الخطورة الافتراضية: info- الإجراء
- For each user listed in the evidence, map it to its login when the login exists (ALTER USER [<user>] WITH LOGIN = [<login>]); otherwise confirm with the database owner that it is no longer needed and drop it (DROP USER [<user>]). On availability groups, create logins with the same SID on every replica.
- خط الأساس
- Orphaned users are a sign of restores without login sync; clean up or remap. · المصدر
المحتوى ذو الصلة
- أمان SQL Server: المتطلبات الأساسية وكيفية إضافة الموارد
- الحدود وخطوط الأساس: كيفية تجاوز الحد الافتراضي