STIGQter STIGQter: STIG Summary: MS SQL Server 2016 Instance Security Technical Implementation Guide Version: 2 Release: 3 Benchmark Date: 23 Apr 2021:

Access to CLR code must be disabled or restricted, unless specifically required and approved.

DISA Rule

SV-213958r617437_rule

Vulnerability Number

V-213958

Group Title

SRG-APP-000141-DB-000093

Rule Version

SQL6-D0-007300

Severity

CAT II

CCI(s)

Weight

10

Fix Recommendation

Disable use of or remove any CLR code that is not authorized.

To disable the use of CLR, from the query prompt:

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 0;
GO
RECONFIGURE;
GO

For any approved CLR code with Unsafe or External permissions, use the ALTER ASSEMBLY to change the Permission set for the Assembly and ensure a certificate is configured.

Check Contents

The common language runtime (CLR) component of the .NET Framework for Microsoft Windows in SQL Server allows you to write stored procedures, triggers, user-defined types, user-defined functions, user-defined aggregates, and streaming table-valued functions, using any .NET Framework language, including Microsoft Visual Basic .NET and Microsoft Visual C#. CLR packing assemblies can access resources protected by .NET Code Access Security when it runs managed code. Specifying UNSAFE enables the code in the assembly complete freedom to perform operations in the SQL Server process space that can potentially compromise the robustness of SQL Server. UNSAFE assemblies can also potentially subvert the security system of either SQL Server or the common language runtime.

To determine if CLR is enabled, execute the following commands:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'clr enabled';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of CLR code is approved. If it is not approved, this is a finding.

If CLR code is approved, check the database for UNSAFE assembly permission using the following script:

USE [master]
SELECT *
FROM sys.assemblies
WHERE permission_set_desc != 'SAFE'
AND is_user_defined = 1;

If any records are returned, review the system documentation to determine if the use of UNSAFE assemblies is approved. If it is not approved, this is a finding.

Vulnerability Number

V-213958

Documentable

False

Rule Version

SQL6-D0-007300

Severity Override Guidance

The common language runtime (CLR) component of the .NET Framework for Microsoft Windows in SQL Server allows you to write stored procedures, triggers, user-defined types, user-defined functions, user-defined aggregates, and streaming table-valued functions, using any .NET Framework language, including Microsoft Visual Basic .NET and Microsoft Visual C#. CLR packing assemblies can access resources protected by .NET Code Access Security when it runs managed code. Specifying UNSAFE enables the code in the assembly complete freedom to perform operations in the SQL Server process space that can potentially compromise the robustness of SQL Server. UNSAFE assemblies can also potentially subvert the security system of either SQL Server or the common language runtime.

To determine if CLR is enabled, execute the following commands:

EXEC SP_CONFIGURE 'show advanced options', '1';
RECONFIGURE WITH OVERRIDE;
EXEC SP_CONFIGURE 'clr enabled';

If the value of "config_value" is "0", this is not a finding.

If the value of "config_value" is "1", review the system documentation to determine whether the use of CLR code is approved. If it is not approved, this is a finding.

If CLR code is approved, check the database for UNSAFE assembly permission using the following script:

USE [master]
SELECT *
FROM sys.assemblies
WHERE permission_set_desc != 'SAFE'
AND is_user_defined = 1;

If any records are returned, review the system documentation to determine if the use of UNSAFE assemblies is approved. If it is not approved, this is a finding.

Check Content Reference

M

Target Key

3993

Comments