Top Banner
CIS Microsoft SQL Server 2012 Benchmark v1.4.0 - 08-11-2017
99

CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

Nov 09, 2018

Download

Documents

lenga
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

CISMicrosoftSQLServer2012Benchmark

v1.4.0-08-11-2017

Page 2: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

1|P a g e

ThisworkislicensedunderaCreativeCommonsAttribution-NonCommercial-ShareAlike4.0InternationalPublicLicense.Thelinktothelicensetermscanbefoundathttps://creativecommons.org/licenses/by-nc-sa/4.0/legalcodeTofurtherclarifytheCreativeCommonslicenserelatedtoCISBenchmarkcontent,youareauthorizedtocopyandredistributethecontentforusebyyou,withinyourorganizationandoutsideyourorganizationfornon-commercialpurposesonly,providedthat(i)appropriatecreditisgiventoCIS,(ii)alinktothelicenseisprovided.Additionally,ifyouremix,transformorbuildupontheCISBenchmark(s),youmayonlydistributethemodifiedmaterialsiftheyaresubjecttothesamelicensetermsastheoriginalBenchmarklicenseandyourderivativewillnolongerbeaCISBenchmark.CommercialuseofCISBenchmarksissubjecttothepriorapprovaloftheCenterforInternetSecurity.

Page 3: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

2|P a g e

TableofContentsOverview......................................................................................................................................................................5

IntendedAudience..............................................................................................................................................5

ConsensusGuidance...........................................................................................................................................5

TypographicalConventions............................................................................................................................6

ScoringInformation............................................................................................................................................6

ProfileDefinitions................................................................................................................................................7

Acknowledgements.............................................................................................................................................8

Recommendations....................................................................................................................................................9

1Installation,UpdatesandPatches.............................................................................................................9

1.1EnsureLatestSQLServerServicePacksandHotfixesareInstalled(NotScored).9

1.2EnsureSingle-FunctionMemberServersareUsed(NotScored)...............................11

2SurfaceAreaReduction..............................................................................................................................13

2.1Ensure'AdHocDistributedQueries'ServerConfigurationOptionissetto'0'(Scored).......................................................................................................................................................13

2.2Ensure'CLREnabled'ServerConfigurationOptionissetto'0'(Scored)...............15

2.3Ensure'CrossDBOwnershipChaining'ServerConfigurationOptionissetto'0'(Scored).......................................................................................................................................................17

2.4Ensure'DatabaseMailXPs'ServerConfigurationOptionissetto'0'(Scored)...19

2.5Ensure'OleAutomationProcedures'ServerConfigurationOptionissetto'0'(Scored).......................................................................................................................................................21

2.6Ensure'RemoteAccess'ServerConfigurationOptionissetto'0'(Scored)..........23

2.7Ensure'RemoteAdminConnections'ServerConfigurationOptionissetto'0'(Scored).......................................................................................................................................................25

2.8Ensure'ScanForStartupProcs'ServerConfigurationOptionissetto'0'(Scored).........................................................................................................................................................................27

2.9Ensure'Trustworthy'DatabasePropertyissetto'Off'(Scored)...............................29

2.10EnsureUnnecessarySQLServerProtocolsaresetto'Disabled'(NotScored)..31

2.11EnsureSQLServerisconfiguredtousenon-standardports(Scored)..................33

2.12Ensure'HideInstance'optionissetto'Yes'forProductionSQLServerinstances(Scored).......................................................................................................................................................35

Page 4: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

3|P a g e

2.13Ensure'sa'LoginAccountissetto'Disabled'(Scored)................................................37

2.14Ensure'sa'LoginAccounthasbeenrenamed(Scored)...............................................39

2.15Ensure'xp_cmdshell'ServerConfigurationOptionissetto'0'(Scored).............41

2.16Ensure'AUTO_CLOSE'issetto'OFF'oncontaineddatabases(Scored)...............43

2.17Ensurenologinexistswiththename'sa'(Scored).......................................................45

3AuthenticationandAuthorization.........................................................................................................47

ThissectioncontainsrecommendationsrelatedtoSQLServer'sauthenticationandauthorizationmechanisms..................................................................................................................47

3.1Ensure'ServerAuthentication'Propertyissetto'WindowsAuthenticationMode'(Scored).........................................................................................................................................47

3.2EnsureCONNECTpermissionsonthe'guestuser'isRevokedwithinallSQLServerdatabasesexcludingthemaster,msdbandtempdb(Scored)..............................49

3.3Ensure'OrphanedUsers'areDroppedFromSQLServerDatabases(Scored).....51

3.4EnsureSQLAuthenticationisnotusedincontaineddatabases(Scored)..............52

3.5EnsuretheSQLServer'sMSSQLServiceAccountisNotanAdministrator(Scored).......................................................................................................................................................54

3.6EnsuretheSQLServer’sSQLAgentServiceAccountisNotanAdministrator(Scored).......................................................................................................................................................56

3.7EnsuretheSQLServer’sFull-TextServiceAccountisNotanAdministrator(Scored).......................................................................................................................................................58

3.8EnsureonlythedefaultpermissionsspecifiedbyMicrosoftaregrantedtothepublicserverrole(Scored).................................................................................................................60

3.9EnsureWindowsBUILTINgroupsarenotSQLLogins(Scored)................................62

3.10EnsureWindowslocalgroupsarenotSQLLogins(Scored)......................................64

3.11EnsurethepublicroleinthemsdbdatabaseisnotgrantedaccesstoSQLAgentproxies(Scored)......................................................................................................................................66

4PasswordPolicies.........................................................................................................................................68

4.1Ensure'MUST_CHANGE'Optionissetto'ON'forAllSQLAuthenticatedLogins(NotScored)..............................................................................................................................................68

4.2Ensure'CHECK_EXPIRATION'Optionissetto'ON'forAllSQLAuthenticatedLoginsWithintheSysadminRole(Scored).................................................................................70

4.3Ensure'CHECK_POLICY'Optionissetto'ON'forAllSQLAuthenticatedLogins(Scored).......................................................................................................................................................72

Page 5: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

4|P a g e

5AuditingandLogging..................................................................................................................................74

5.1Ensure'Maximumnumberoferrorlogfiles'issettogreaterthanorequalto'12'(Scored).......................................................................................................................................................74

5.2Ensure'DefaultTraceEnabled'ServerConfigurationOptionissetto'1'(Scored).........................................................................................................................................................................77

5.3Ensure'LoginAuditing'issetto'failedlogins'(Scored)................................................79

5.4Ensure'SQLServerAudit'issettocaptureboth'failed'and'successfullogins'(Scored).......................................................................................................................................................81

6ApplicationDevelopment..........................................................................................................................84

6.1EnsureSanitizeDatabaseandApplicationUserInputisSanitized(NotScored)84

6.2Ensure'CLRAssemblyPermissionSet'issetto'SAFE_ACCESS'forAllCLRAssemblies(Scored)..............................................................................................................................86

7Encryption........................................................................................................................................................88

7.1Ensure'SymmetricKeyencryptionalgorithm'issetto'AES_128'orhigherinnon-systemdatabases(Scored)........................................................................................................88

7.2EnsureAsymmetricKeySizeissetto'greaterthanorequalto2048'innon-systemdatabases(Scored).................................................................................................................90

8Appendix:AdditionalConsiderations..................................................................................................92

8.1Ensure'SQLServerBrowserService'isconfiguredcorrectly(NotScored)..........92

Appendix:SummaryTable................................................................................................................................94

Appendix:ChangeHistory.................................................................................................................................97

Page 6: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

5|P a g e

OverviewThisdocument,SecurityConfigurationBenchmarkforMicrosoftSQLServer2012,providesprescriptiveguidanceforestablishingasecureconfigurationpostureforMicrosoftSQLServer2012versions.ThisguidewastestedagainstMicrosoftSQLServer2012.Toobtainthelatestversionofthisguide,pleasevisithttp://benchmarks.cisecurity.org.Ifyouhavequestions,comments,orhaveidentifiedwaystoimprovethisguide,[email protected].

IntendedAudience

Thisbenchmarkisintendedforsystemandapplicationadministrators,securityspecialists,auditors,helpdesk,andplatformdeploymentpersonnelwhoplantodevelop,deploy,assess,orsecuresolutionsthatincorporateMicrosoftSQLServer2012onaMicrosoftWindowsplatform.

ConsensusGuidance

Thisbenchmarkwascreatedusingaconsensusreviewprocesscomprisedofsubjectmatterexperts.Consensusparticipantsprovideperspectivefromadiversesetofbackgroundsincludingconsulting,softwaredevelopment,auditandcompliance,securityresearch,operations,government,andlegal.

EachCISbenchmarkundergoestwophasesofconsensusreview.Thefirstphaseoccursduringinitialbenchmarkdevelopment.Duringthisphase,subjectmatterexpertsconvenetodiscuss,create,andtestworkingdraftsofthebenchmark.Thisdiscussionoccursuntilconsensushasbeenreachedonbenchmarkrecommendations.Thesecondphasebeginsafterthebenchmarkhasbeenpublished.Duringthisphase,allfeedbackprovidedbytheInternetcommunityisreviewedbytheconsensusteamforincorporationinthebenchmark.Ifyouareinterestedinparticipatingintheconsensusprocess,pleasevisithttps://community.cisecurity.org.

Page 7: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

6|P a g e

TypographicalConventions

Thefollowingtypographicalconventionsareusedthroughoutthisguide:

Convention Meaning

Stylized Monospace font Usedforblocksofcode,command,andscriptexamples.Textshouldbeinterpretedexactlyaspresented.

Monospacefont Usedforinlinecode,commands,orexamples.Textshouldbeinterpretedexactlyaspresented.

<italicfontinbrackets> Italictextssetinanglebracketsdenoteavariablerequiringsubstitutionforarealvalue.

Italicfont Usedtodenotethetitleofabook,article,orotherpublication.

Note Additionalinformationorcaveats

ScoringInformation

Ascoringstatusindicateswhethercompliancewiththegivenrecommendationimpactstheassessedtarget'sbenchmarkscore.Thefollowingscoringstatusesareusedinthisbenchmark:

Scored

Failuretocomplywith"Scored"recommendationswilldecreasethefinalbenchmarkscore.Compliancewith"Scored"recommendationswillincreasethefinalbenchmarkscore.

NotScored

Failuretocomplywith"NotScored"recommendationswillnotdecreasethefinalbenchmarkscore.Compliancewith"NotScored"recommendationswillnotincreasethefinalbenchmarkscore.

Page 8: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

7|P a g e

ProfileDefinitions

ThefollowingconfigurationprofilesaredefinedbythisBenchmark:

• Level1-DatabaseEngine

Itemsinthisprofileintendto:

o bepracticalandprudent;o provideaclearsecuritybenefit;ando notinhibittheutilityofthetechnologybeyondacceptablemeans.

Page 9: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

8|P a g e

Acknowledgements

Thisbenchmarkexemplifiesthegreatthingsacommunityofusers,vendors,andsubjectmatterexpertscanaccomplishthroughconsensuscollaboration.TheCIScommunitythankstheentireconsensusteamwithspecialrecognitiontothefollowingindividualswhocontributedgreatlytothecreationofthisguide:

ContributorTimHarrisonCISSP,ICP,CenterforInternetSecurityEditorNancyHidyWilsonBrianKelleyMCSE,CISA,Security+,MicrosoftMVP-SQLServer

Page 10: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

9|P a g e

Recommendations1Installation,UpdatesandPatches

ThissectioncontainsrecommendationsrelatedtoinstallingandpatchingSQLServer.

1.1EnsureLatestSQLServerServicePacksandHotfixesareInstalled(NotScored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

SQLServerpatchescontainprogramupdatesthatfixsecurityandproductfunctionalityissuesfoundinthesoftware.Thesepatchescanbeinstalledwithahotfixwhichisasinglepatch,acumulativeupdatewhichisasmallgroupofpatchesoraservicepackwhichisalargecollectionofpatches.TheSQLServerversionandpatchlevelsshouldbethemostrecentcompatiblewiththeorganizations'operationalneeds.

Rationale:

UsingthemostrecentSQLServersoftware,alongwithallapplicablepatchescanhelplimitthepossibilitiesforvulnerabilitiesinthesoftware,theinstallationversionand/orpatchesappliedduringsetupshouldbeestablishedaccordingtotheneedsoftheorganization.

Audit:

TodetermineyourSQLServerservicepacklevel,runthefollowingcodesnippet.

SELECT SERVERPROPERTY('ProductLevel') as SP_installed, SERVERPROPERTY('ProductVersion') as Version;

FirstcolumnreturnstheinstalledServicePacklevel,thesecondistheexactbuildnumber.

Remediation:

IdentifythecurrentversionandpatchlevelofyourSQLServerinstancesandensuretheycontainthelatestsecurityfixes.Makesuretotestthesefixesinyourtestenvironmentsbeforeupdatingproductioninstances.

Page 11: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

10|P a g e

ThemostrecentSQLServerpatchescanbefoundhere:

HotfixesandCumulativeupdates:http://blogs.msdn.com/b/sqlreleaseservices/

ServicePacks:https://support.microsoft.com/en-us/kb/2755533

DefaultValue:

Servicepacksandpatchesarenotinstalledbydefault.

References:

1. https://support.microsoft.com/en-us/kb/2755533

CISControls:

4ContinuousVulnerabilityAssessmentandRemediation

Page 12: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

11|P a g e

1.2EnsureSingle-FunctionMemberServersareUsed(NotScored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

ItisrecommendedthatSQLServersoftwarebeinstalledonadedicatedserver.Thisarchitecturalconsiderationaffordssecurityflexibilityinthatthedatabaseservercanbeplacedonaseparatesubnetallowingaccessonlyfromparticularhostsandoverparticularprotocols.Degreesofavailabilityareeasiertoachieveaswell-overtime,anenterprisecanmovefromasingledatabaseservertoafailovertoaclusterusingloadbalancingortosomecombinationthereof.

Rationale:

Itiseasiertomanage(i.e.reduce)theattacksurfaceoftheserverhostingSQLServersoftwareiftheonlysurfacestoconsideraretheunderlyingoperatingsystem,SQLServeritself,andanysecurity/operationaltoolingthatmayadditionallybeinstalled.Asnotedinthedescription,availabilitycanbemoreeasilyaddressedifthedatabaseisonadedicatedserver.

Audit:

Ensurethatnootherrolesareenabledfortheunderlyingoperatingsystemandthatnoexcesstoolingisinstalled,perenterprisepolicy.

Remediation:

Uninstallexcesstoolingand/orremoveunnecessaryrolesfromtheunderlyingoperatingsystem.

Impact:

Itisdifficulttoseeanyreasonablyadverseimpacttomakingthisarchitecturalchange,oncethecostsofmakingthechangehavebeenpaid.Customapplicationsmayneedtobemodifiedtoaccommodatedatabaseconnectionsoverthewireratherthanonthehost(i.e.usingTCP/IPinsteadofNamedPipes).Additionalhardwareandoperatingsystemlicensesmayberequiredtomakethesearchitecturalchanges.

Page 13: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

12|P a g e

CISControls:

9.5OperateCriticalServicesonDedicatedHosts(i.e.DNS,Mail,Web,Database)Operatecriticalservicesonseparatephysicalorlogicalhostmachines,suchasDNS,file,mail,web,anddatabaseservers.

Page 14: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

13|P a g e

2SurfaceAreaReduction

SQLServeroffersvariousconfigurationoptions,someofthemcanbecontrolledbythesp_configurestoredprocedure.Thissectioncontainsthelistingofthecorrespondingrecommendations.

2.1Ensure'AdHocDistributedQueries'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

EnablingAdHocDistributedQueriesallowsuserstoquerydataandexecutestatementsonexternaldatasources.Thisfunctionalityshouldbedisabled.

Rationale:

ThisfeaturecanbeusedtoremotelyaccessandexploitvulnerabilitiesonremoteSQLServerinstancesandtorununsafeVisualBasicforApplicationfunctions.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'Ad Hoc Distributed Queries';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'Ad Hoc Distributed Queries', 0; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

Page 15: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

14|P a g e

DefaultValue:

0(disabled)

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/ad-hoc-distributed-queries-server-configuration-option

CISControls:

9.1LimitOpenPorts,Protocols,andServicesEnsurethatonlyports,protocols,andserviceswithvalidatedbusinessneedsarerunningoneachsystem.

Page 16: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

15|P a g e

2.2Ensure'CLREnabled'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Theclr enabledoptionspecifieswhetheruserassembliescanberunbySQLServer.

Rationale:

EnablinguseofCLRassemblieswidenstheattacksurfaceofSQLServerandputsitatriskfrombothinadvertentandmaliciousassemblies.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'clr enabled';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'clr enabled', 0; RECONFIGURE;

Impact:

IfCLRassembliesareinuse,applicationsmayneedtoberearchitectedtoeliminatetheirusagebeforedisablingthissetting.Alternatively,someorganizationsmayallowthissettingtobeenabled1forassembliescreatedwiththeSAFEpermissionset,butdisallowassembliescreatedwiththeriskierUNSAFEandEXTERNAL_ACCESSpermissionsets.

Page 17: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

16|P a g e

Tofinduser-createdassemblies,runthefollowingqueryinalldatabases,replacing<database_name>witheachdatabasename:

USE [<database_name>] GO SELECT name AS Assembly_Name, permission_set_desc FROM sys.assemblies WHERE is_user_defined = 1; GO

DefaultValue:

Bydefault,thisoptionisdisabled.

References:

1. https://docs.microsoft.com/en-us/sql/t-sql/statements/create-assembly-transact-sql

CISControls:

18.9SanitizeDeployedSoftwareofDevelopmentArtifactsForin-housedevelopedapplications,ensurethatdevelopmentartifacts(sampledataandscripts;unusedlibraries,components,debugcode;ortools)arenotincludedinthedeployedsoftware,oraccessibleintheproductionenvironment.

Page 18: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

17|P a g e

2.3Ensure'CrossDBOwnershipChaining'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Thecross db ownership chainingoptioncontrolscross-databaseownershipchainingacrossalldatabasesattheinstance(orserver)level.

Rationale:

Whenenabled,thisoptionallowsamemberofthedb_ownerroleinadatabasetogainaccesstoobjectsownedbyalogininanyotherdatabase,causinganunnecessaryinformationdisclosure.Whenrequired,cross-databaseownershipchainingshouldonlybeenabledforthespecificdatabasesrequiringitinsteadofattheinstancelevelforalldatabasesbyusingtheALTER DATABASE <database_name> SET DB_CHAINING ONcommand.Thisdatabaseoptionmaynotbechangedonthemaster,model,ortempdbsystemdatabases.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'cross db ownership chaining';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'cross db ownership chaining', 0; RECONFIGURE; GO

DefaultValue:

Bydefault,thisoptionisdisabled(0).

Page 19: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

18|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/cross-db-ownership-chaining-server-configuration-option

CISControls:

14.4ProtectInformationwithAccessControlListsAllinformationstoredonsystemsshallbeprotectedwithfilesystem,networkshare,claims,application,ordatabasespecificaccesscontrollists.Thesecontrolswillenforcetheprinciplethatonlyauthorizedindividualsshouldhaveaccesstotheinformationbasedontheirneedtoaccesstheinformationasapartoftheirresponsibilities.

Page 20: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

19|P a g e

2.4Ensure'DatabaseMailXPs'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

TheDatabase Mail XPsoptioncontrolstheabilitytogenerateandtransmitemailmessagesfromSQLServer.

Rationale:

DisablingDatabase MailreducestheSQLServersurface,eliminatesaDOSattackvectorandchanneltoexfiltratedatafromthedatabaseservertoaremotehost.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'Database Mail XPs';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'Database Mail XPs', 0; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

DefaultValue:

Bydefault,thisoptionisdisabled(0).

Page 21: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

20|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/database-mail/database-mail

CISControls:

18ApplicationSoftwareSecurity

Page 22: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

21|P a g e

2.5Ensure'OleAutomationProcedures'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

TheOle Automation ProceduresoptioncontrolswhetherOLEAutomationobjectscanbeinstantiatedwithinTransact-SQLbatches.TheseareextendedstoredproceduresthatallowSQLServeruserstoexecutefunctionsexternaltoSQLServer.

Rationale:

EnablingthisoptionwillincreasetheattacksurfaceofSQLServerandallowuserstoexecutefunctionsinthesecuritycontextofSQLServer.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'Ole Automation Procedures';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'Ole Automation Procedures', 0; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

DefaultValue:

Bydefault,thisoptionisdisabled(0).

Page 23: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

22|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/ole-automation-procedures-server-configuration-option

CISControls:

18ApplicationSoftwareSecurity

Page 24: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

23|P a g e

2.6Ensure'RemoteAccess'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Theremote accessoptioncontrolstheexecutionoflocalstoredproceduresonremoteserversorremotestoredproceduresonlocalserver.

Rationale:

FunctionalitycanbeabusedtolaunchaDenial-of-Service(DoS)attackonremoteserversbyoff-loadingqueryprocessingtoatarget.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'remote access';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'remote access', 0; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

RestarttheDatabaseEngine.

DefaultValue:

Bydefault,thisoptionisenabled(1).

Page 25: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

24|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-remote-access-server-configuration-option

CISControls:

9.1LimitOpenPorts,Protocols,andServicesEnsurethatonlyports,protocols,andserviceswithvalidatedbusinessneedsarerunningoneachsystem.

Page 26: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

25|P a g e

2.7Ensure'RemoteAdminConnections'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Theremote admin connectionsoptioncontrolswhetheraclientapplicationonaremotecomputercanusetheDedicatedAdministratorConnection(DAC).

Rationale:

TheDedicatedAdministratorConnection(DAC)letsanadministratoraccessarunningservertoexecutediagnosticfunctionsorTransact-SQLstatements,ortotroubleshootproblemsontheserver,evenwhentheserverislockedorrunninginanabnormalstateandnotrespondingtoaSQLServerDatabaseEngineconnection.Inaclusterscenario,theadministratormaynotactuallybeloggedontothesamenodethatiscurrentlyhostingtheSQLServerinstanceandthusisconsidered"remote".Therefore,thissettingshouldusuallybeenabled(1)forSQLServerfailoverclusters;otherwiseitshouldbedisabled(0)whichisthedefault.

Audit:

RunthefollowingT-SQLcommand:

USE master; GO SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'remote admin connections' AND SERVERPROPERTY('IsClustered') = 0;

Ifnodataisreturned,theinstanceisaclusterandthisrecommendationisnotapplicable.Ifdataisreturned,thenboththevaluecolumnsmustshow0tobecompliant.

Remediation:

RunthefollowingT-SQLcommandonnon-clusteredinstallations:

EXECUTE sp_configure 'remote admin connections', 0; RECONFIGURE; GO

Page 27: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

26|P a g e

DefaultValue:

Bydefault,thisoptionisdisabled(0),onlylocalconnectionsmayusetheDAC.

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/remote-admin-connections-server-configuration-option

Notes:

Ifit'saclusteredinstallation,itmustbeenabledasaclusteredSQLServercannotbindtolocalhostandDACwillbeunavailableotherwise.Enableitforclusteredinstallations.Disableitforstandaloneinstallationswherenotrequired.

CISControls:

9.1LimitOpenPorts,Protocols,andServicesEnsurethatonlyports,protocols,andserviceswithvalidatedbusinessneedsarerunningoneachsystem.

Page 28: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

27|P a g e

2.8Ensure'ScanForStartupProcs'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Thescan for startup procsoption,ifenabled,causesSQLServertoscanforandautomaticallyrunallstoredproceduresthataresettoexecuteuponservicestartup.

Rationale:

Enforcingthiscontrolreducesthethreatofanentityleveragingthesefacilitiesformaliciouspurposes.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'scan for startup procs';

Bothvaluecolumnsmustshow0.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'scan for startup procs', 0; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

RestarttheDatabaseEngine.

Impact:

SettingScanforStartupProceduresto0willpreventcertainaudittracesandothercommonlyusedmonitoringSPsfromre-startingonstartup.Additionally,replicationrequiresthissettingtobeenabled(1)andwillautomaticallychangethissettingifneeded.

Page 29: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

28|P a g e

DefaultValue:

Bydefault,thisoptionisdisabled(0).

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-scan-for-startup-procs-server-configuration-option

CISControls:

18ApplicationSoftwareSecurity

Page 30: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

29|P a g e

2.9Ensure'Trustworthy'DatabasePropertyissetto'Off'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

TheTRUSTWORTHYdatabaseoptionallowsdatabaseobjectstoaccessobjectsinotherdatabasesundercertaincircumstances.

Rationale:

ProvidesprotectionfrommaliciousCLRassembliesorextendedprocedures.

Audit:

RunthefollowingT-SQLquerytolistanydatabaseswithaTrustworthydatabasepropertyvalueofON:

SELECT name FROM sys.databases WHERE is_trustworthy_on = 1 AND name != 'msdb';

Norowsshouldbereturned.

Remediation:

ExecutethefollowingT-SQLstatementagainstthedatabases(replace<database_name>below)returnedbytheAuditProcedure:

ALTER DATABASE [<database_name>] SET TRUSTWORTHY OFF;

DefaultValue:

Bydefault,thisdatabasepropertyisOFF(is_trustworthy_on = 0),exceptforthemsdbdatabaseinwhichitisrequiredtobeON.

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/security/trustworthy-database-property

2. https://support.microsoft.com/it-it/help/2183687/guidelines-for-using-the-trustworthy-database-setting-in-sql-server

Page 31: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

30|P a g e

CISControls:

14.4ProtectInformationwithAccessControlListsAllinformationstoredonsystemsshallbeprotectedwithfilesystem,networkshare,claims,application,ordatabasespecificaccesscontrollists.Thesecontrolswillenforcetheprinciplethatonlyauthorizedindividualsshouldhaveaccesstotheinformationbasedontheirneedtoaccesstheinformationasapartoftheirresponsibilities.

Page 32: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

31|P a g e

2.10EnsureUnnecessarySQLServerProtocolsaresetto'Disabled'(NotScored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

SQLServersupportsSharedMemory,NamedPipes,TCP/IPandVIAprotocols.However,SQLServershouldbeconfiguredtousethebareminimumrequiredbasedontheorganization'sneeds.

Rationale:

UsingfewerprotocolsminimizestheattacksurfaceofSQLServerand,insomecases,canprotectitfromremoteattacks.

Audit:

OpenSQLServerConfigurationManager;gototheSQLServerNetworkConfiguration.Ensurethatonlyrequiredprotocolsareenabled.

Remediation:

OpenSQLServerConfigurationManager;gototheSQLServerNetworkConfiguration.Ensurethatonlyrequiredprotocolsareenabled.Disableprotocolsnotnecessary.

Impact:

TheDatabaseEnginemustbestoppedandrestartedforthechangetotakeeffect.

DefaultValue:

Bydefault,TCP/IPandSharedMemoryprotocolsareenabledonallcommercialeditions.

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/enable-or-disable-a-server-network-protocol

Page 33: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

32|P a g e

CISControls:

9.1LimitOpenPorts,Protocols,andServicesEnsurethatonlyports,protocols,andserviceswithvalidatedbusinessneedsarerunningoneachsystem.

Page 34: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

33|P a g e

2.11EnsureSQLServerisconfiguredtousenon-standardports(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Ifenabled,thedefaultSQLServerinstancewillbeassignedadefaultportofTCP:1433forTCP/IPcommunication.AdministratorscanalsoconfigurenamedinstancestouseTCP:1433forcommunication.TCP:1433isawidelyknownSQLServerportandthisportassignmentshouldbechanged.

Rationale:

Usinganon-defaultporthelpsprotectthedatabasefromattacksdirectedtothedefaultport.

Audit:

RunthefollowingT-SQLscript:

DECLARE @value nvarchar(256); EXECUTE master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp\IPAll', N'TcpPort', @value OUTPUT, N'no_output'; SELECT @value AS TCP_Port WHERE @value = '1433';

Thisshouldreturnnorows.

Remediation:

1. InSQLServerConfigurationManager,intheconsolepane,expandSQLServerNetworkConfiguration,expandProtocolsfor<InstanceName>,andthendouble-clicktheTCP/IPorVIAprotocol

2. IntheTCP/IPPropertiesdialogbox,ontheIPAddressestab,severalIPaddressesappearintheformatIP1,IP2,uptoIPAll.OneoftheseisfortheIPaddressoftheloopbackadapter,127.0.0.1.AdditionalIPaddressesappearforeachIPAddressonthecomputer

3. ChangetheTCPPortfieldfrom1433toanothernon-standardportorleavetheTCPPortfieldemptyandsettheTCPDynamicPortsvalueto0toenabledynamicportassignmentandthenclickOK.

Page 35: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

34|P a g e

4. Intheconsolepane,clickSQLServerServices.5. Inthedetailspane,right-clickSQLServer(<InstanceName>)andthenclick

Restart,tostopandrestartSQLServer.

Impact:

ChangingthedefaultportwillforcetheDAC(DedicatedAdministratorConnection)tolistenonarandomport.Also,itmightmakebenignapplications,suchasapplicationfirewalls,requirespecialconfiguration.Ingeneral,youshouldsetastaticportforconsistentusagebyapplications,includingfirewalls,insteadofusingdynamicportswhichwillbechosenrandomlyateachSQLServerstartup.

DefaultValue:

Bydefault,defaultSQLServerinstanceslistenontoTCP/IPtrafficonTCPport1433andnamedinstancesusedynamicports.

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-a-server-to-listen-on-a-specific-tcp-port

CISControls:

9LimitationandControlofNetworkPorts,Protocols,andServices

Page 36: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

35|P a g e

2.12Ensure'HideInstance'optionissetto'Yes'forProductionSQLServerinstances(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Non-clusteredSQLServerinstanceswithinproductionenvironmentsshouldbedesignatedashiddentopreventadvertisementbytheSQLServerBrowserservice.

Rationale:

DesignatingproductionSQLServerinstancesashiddenleadstoamoresecureinstallationbecausetheycannotbeenumerated.However,clusteredinstancesmaybreakifthisoptionisselected.

Audit:

PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. InSQLServerConfigurationManager,expandSQLServerNetworkConfiguration,right-clickProtocolsfor<serverinstance>,andthenselectProperties.

2. OntheFlagstab,intheHideInstancebox,verifyYesisselected.

T-SQLMethodExecutethefollowingT-SQL.Avalueof1shouldbereturned.

DECLARE @getValue INT; EXEC master..xp_instance_regread @rootkey = N'HKEY_LOCAL_MACHINE', @key = N'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib', @value_name = N'HideInstance', @value = @getValue OUTPUT; SELECT @getValue;

Page 37: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

36|P a g e

Remediation:

PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. InSQLServerConfigurationManager,expandSQLServerNetworkConfiguration,right-clickProtocolsfor<serverinstance>,andthenselectProperties.

2. OntheFlagstab,intheHideInstancebox,selectYes,andthenclickOKtoclosethedialogbox.Thechangetakeseffectimmediatelyfornewconnections.

T-SQLMethodExecutethefollowingT-SQLtoremediate:

EXEC master..xp_instance_regwrite @rootkey = N'HKEY_LOCAL_MACHINE', @key = N'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib', @value_name = N'HideInstance', @type = N'REG_DWORD', @value = 1;

Impact:

Thismethodonlypreventstheinstancefrombeinglistedonthenetwork.Iftheinstanceishidden(notexposedbySQLBrowser),thenconnectionswillneedtospecifytheserverandportinordertoconnect.Itdoesnotpreventusersfromconnectingtoserveriftheyknowtheinstancenameandport.

Ifyouhideaclusterednamedinstance,theclusterservicemaynotbeabletoconnecttotheSQLServer.PleaserefertotheMicrosoftdocumentationreference.

DefaultValue:

Bydefault,SQLServerinstancesarenothidden.

References:

1. http://msdn.microsoft.com/en-us/library/ms179327(v=sql.110).aspx

CISControls:

9LimitationandControlofNetworkPorts,Protocols,andServices

Page 38: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

37|P a g e

2.13Ensure'sa'LoginAccountissetto'Disabled'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

ThesaaccountisawidelyknownandoftenwidelyusedSQLServeraccountwithsysadminprivileges.Thisistheoriginallogincreatedduringinstallationandalwayshastheprincipal_id=1andsid=0x01.

Rationale:

Enforcingthiscontrolreducestheprobabilityofanattackerexecutingbruteforceattacksagainstawell-knownprincipal.

Audit:

Usethefollowingsyntaxtodetermineifthesaaccountisdisabled.Checkingforsid=0x01ensuresthattheoriginalsaaccountisbeingcheckedincaseithasbeenrenamedperbestpractices.

SELECT name, is_disabled FROM sys.server_principals WHERE sid = 0x01 AND is_disabled = 0;

Norowsshouldbereturnedtobecompliant.Anis_disabledvalueof0indicatestheloginiscurrentlyenabledandthereforeneedsremediation.

Remediation:

ExecutethefollowingT-SQLquery:

USE [master] GO DECLARE @tsql nvarchar(max) SET @tsql = 'ALTER LOGIN ' + SUSER_NAME(0x01) + ' DISABLE' EXEC (@tsql) GO

Page 39: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

38|P a g e

Impact:

Itisnotagoodsecuritypracticetocodeapplicationsorscriptstousethesaaccount.However,ifthishasbeendone,disablingthesaaccountwillpreventscriptsandapplicationsfromauthenticatingtothedatabaseserverandexecutingrequiredtasksorfunctions.

DefaultValue:

Bydefault,thesaloginaccountisdisabledatinstalltimewhenWindowsAuthenticationModeisselected.Ifmixedmode(SQLServerandWindowsAuthentication)isselectedatinstall,thedefaultforthesaloginisenabled.

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-server-principals-transact-sql

2. https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-login-transact-sql3. https://docs.microsoft.com/en-us/sql/relational-databases/security/choose-an-

authentication-mode

CISControls:

5.1MinimizeandSparinglyUseAdministrativePrivilegesMinimizeadministrativeprivilegesandonlyuseadministrativeaccountswhentheyarerequired.Implementfocusedauditingontheuseofadministrativeprivilegedfunctionsandmonitorforanomalousbehavior.

Page 40: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

39|P a g e

2.14Ensure'sa'LoginAccounthasbeenrenamed(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

ThesaaccountisawidelyknownandoftenwidelyusedSQLServerloginwithsysadminprivileges.Thesaloginistheoriginallogincreatedduringinstallationandalwayshasprincipal_id=1andsid=0x01.

Rationale:

Itismoredifficulttolaunchpassword-guessingandbrute-forceattacksagainstthesaloginifthenameisnotknown.

Audit:

Usethefollowingsyntaxtodetermineifthesaaccountisrenamed.

SELECT name FROM sys.server_principals WHERE sid = 0x01;

Anameofsaindicatestheaccounthasnotbeenrenamed.

Remediation:

Replacethe<different_user>valuewithinthebelowsyntaxandexecutetorenamethesalogin.

ALTER LOGIN sa WITH NAME = <different_user>;

Impact:

Itisnotagoodsecuritypracticetocodeapplicationsorscriptstousethesaaccount.However,ifthishasbeendonerenamingthesaaccountwillpreventscriptsandapplicationsforauthenticatingtothedatabaseserverandexecutingrequiredtasksorfunctions.

DefaultValue:

Bydefault,thesaloginnameis'sa'.

Page 41: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

40|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/security/choose-an-authentication-mode

CISControls:

5ControlledUseofAdministrationPrivileges

Page 42: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

41|P a g e

2.15Ensure'xp_cmdshell'ServerConfigurationOptionissetto'0'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Thexp_cmdshelloptioncontrolswhetherthexp_cmdshellextendedstoredprocedurecanbeusedbyanauthenticatedSQLServerusertoexecuteoperating-systemcommandshellcommandsandreturnresultsasrowswithintheSQLclient.

Rationale:

Thexp_cmdshellprocedureiscommonlyusedbyattackerstoreadorwritedatato/fromtheunderlyingOperatingSystemofadatabaseserver.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'xp_cmdshell';

Bothvaluecolumnsmustshow0tobecompliant.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'xp_cmdshell', 0; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

DefaultValue:

Bydefault,thisoptionisdisabled(0).

Page 43: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

42|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/xp-cmdshell-transact-sql

2. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/xp-cmdshell-server-configuration-option

CISControls:

18ApplicationSoftwareSecurity

Page 44: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

43|P a g e

2.16Ensure'AUTO_CLOSE'issetto'OFF'oncontaineddatabases(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

AUTO_CLOSEdeterminesifagivendatabaseisclosedornotafteraconnectionterminates.Ifenabled,subsequentconnectionstothegivendatabasewillrequirethedatabasetobereopenedandrelevantprocedurecachestoberebuilt.

Rationale:

Becauseauthenticationofusersforcontaineddatabasesoccurswithinthedatabasenotattheserver\instancelevel,thedatabasemustbeopenedeverytimetoauthenticateauser.Thefrequentopening/closingofthedatabaseconsumesadditionalserverresourcesandmaycontributetoadenialofservice.

Audit:

Performthefollowingtofindcontaineddatabasesthatarenotconfiguredasprescribed:

SELECT name, containment, containment_desc, is_auto_close_on FROM sys.databases WHERE containment <> 0 and is_auto_close_on = 1;

Norowsshouldbereturned.

Remediation:

ExecutethefollowingT-SQL,replacing<database_name>witheachdatabasenamefoundbytheAuditProcedure:

ALTER DATABASE <database_name> SET AUTO_CLOSE OFF;

DefaultValue:

Bydefault,thedatabasepropertyAUTO_CLOSEisOFFwhichisequivalenttois_auto_close_on = 0.

References:

Page 45: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

44|P a g e

1. https://docs.microsoft.com/en-us/sql/relational-databases/databases/security-best-practices-with-contained-databases

CISControls:

18ApplicationSoftwareSecurity

Page 46: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

45|P a g e

2.17Ensurenologinexistswiththename'sa'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Thesalogin(e.g.principal)isawidelyknownandoftenwidelyusedSQLServeraccount.Therefore,thereshouldnotbealogincalledsaevenwhentheoriginalsalogin(principal_id = 1)hasbeenrenamed.

Rationale:

Enforcingthiscontrolreducestheprobabilityofanattackerexecutingbruteforceattacksagainstawell-knownprincipalname.

Audit:

Usethefollowingsyntaxtodetermineifthereisanaccountnamedsa.

SELECT principal_id, name, FROM sys.server_principals WHERE L.name = 'sa';

Norowsshouldbereturned.

Remediation:

ExecutetheappropriateALTERorDROPstatementbelowbasedontheprincipal_idreturnedfortheloginnamedsa.Replacethe<different_name>valuewithinthebelowsyntaxandexecutetorenamethesalogin.

USE [master] GO -- If principal_id = 1 or the login owns database objects, rename the sa login ALTER LOGIN [sa] WITH NAME = <different_name>; GO -- If the login owns no database objects, then drop it -- Do NOT drop the login if it is principal_id = 1 DROP LOGIN sa

Impact:

Itisnotagoodsecuritypracticetocodeapplicationsorscriptstousethesaaccount.Giventhatitisabestpracticetorenameanddisablethesaaccount,some3rdpartyapplications

Page 47: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

46|P a g e

checkfortheexistenceofaloginnamedsaandifitdoesn'texist,createsone.Removingthesaloginwillpreventthesescriptsandapplicationsfromauthenticatingtothedatabaseserverandexecutingrequiredtasksorfunctions.

DefaultValue:

Theloginwithaprincipal_id = 1isnamedsabydefault.

CISControls:

5.1MinimizeandSparinglyUseAdministrativePrivilegesMinimizeadministrativeprivilegesandonlyuseadministrativeaccountswhentheyarerequired.Implementfocusedauditingontheuseofadministrativeprivilegedfunctionsandmonitorforanomalousbehavior.

Page 48: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

47|P a g e

3AuthenticationandAuthorization

ThissectioncontainsrecommendationsrelatedtoSQLServer'sauthenticationandauthorizationmechanisms.

3.1Ensure'ServerAuthentication'Propertyissetto'WindowsAuthenticationMode'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

UsesWindowsAuthenticationtovalidateattemptedconnections.

Rationale:

WindowsprovidesamorerobustauthenticationmechanismthanSQLServerauthentication.

Audit:

Executethefollowingsyntax:

SELECT SERVERPROPERTY('IsIntegratedSecurityOnly') as [login_mode];

Alogin_modeof1indicatestheServerAuthenticationpropertyissettoWindowsAuthenticationMode.Alogin_modeof0indicatesmixedmodeauthentication.

Remediation:

PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. OpenSQLServerManagementStudio.2. OpentheObjectExplorertabandconnecttothetargetdatabaseinstance.3. RightclicktheinstancenameandselectProperties.4. SelecttheSecuritypagefromtheleftmenu.5. SettheServerauthenticationsettingtoWindowsAuthenticationMode.

Page 49: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

48|P a g e

T-SQLMethodRunthefollowingT-SQLinaQueryWindow:

USE [master] GO EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 1 GO

RestarttheSQLServerserviceforthechangetotakeeffect.

DefaultValue:

WindowsAuthenticationMode

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-properties-security-page

CISControls:

16.9ConfigureAccountAccessCentrallyConfigureaccessforallaccountsthroughacentralizedpointofauthentication,forexampleActiveDirectoryorLDAP.Configurenetworkandsecuritydevicesforcentralizedauthenticationaswell.

Page 50: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

49|P a g e

3.2EnsureCONNECTpermissionsonthe'guestuser'isRevokedwithinallSQLServerdatabasesexcludingthemaster,msdbandtempdb(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

RemovetherightoftheguestusertoconnecttoSQLServerdatabases,exceptformaster,msdb,andtempdb.

Rationale:

AloginassumestheidentityoftheguestuserwhenaloginhasaccesstoSQLServerbutdoesnothaveaccesstoadatabasethroughitsownaccountandthedatabasehasaguestuseraccount.RevokingtheCONNECTpermissionfortheguestuserwillensurethataloginisnotabletoaccessdatabaseinformationwithoutexplicitaccesstodoso.

Audit:

Runthefollowingcodesnippetforeachdatabase(replacing<database_name>asappropriate)intheinstancetodetermineiftheguestuserhasCONNECTpermission.Norowsshouldbereturned.

USE [<database_name>]; GO SELECT DB_NAME() AS DatabaseName, 'guest' AS Database_User, [permission_name], [state_desc] FROM sys.database_permissions WHERE [grantee_principal_id] = DATABASE_PRINCIPAL_ID('guest') AND [state_desc] LIKE 'GRANT%' AND [permission_name] = 'CONNECT' AND DB_NAME() NOT IN ('master','tempdb','msdb');

Remediation:

ThefollowingcodesnippetrevokesCONNECTpermissionsfromtheguestuserinadatabase.Replace<database_name>asappropriate:

USE [<database_name>]; GO REVOKE CONNECT FROM guest;

Page 51: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

50|P a g e

Impact:

WhenCONNECTpermissiontotheguestuserisrevoked,aSQLServerinstanceloginmustbemappedtoadatabaseuserexplicitlyinordertohaveaccesstothedatabase.

DefaultValue:

TheguestuseraccountisaddedtoeachnewdatabasebutwithoutCONNECTpermissionbydefault.

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/policy-based-management/guest-permissions-on-user-databases

Notes:

TheguestaccountcannothavetheCONNECTpermissionrevokedinmaster,msdbandtempdb,butthispermissionshouldberevokedinallotherdatabasesontheSQLServerinstance.

CISControls:

16AccountMonitoringandControl

Page 52: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

51|P a g e

3.3Ensure'OrphanedUsers'areDroppedFromSQLServerDatabases(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

AdatabaseuserforwhichthecorrespondingSQLServerloginisundefinedorisincorrectlydefinedonaserverinstancecannotlogintotheinstanceandisreferredtoasorphanedandshouldberemoved.

Rationale:

Orphanusersshouldberemovedtoavoidpotentialmisuseofthosebrokenusersinanyway.

Audit:

RunthefollowingT-SQLqueryineachdatabasetoidentifyorphanusers.Norowsshouldbereturned.

USE [<database_name>]; GO EXEC sp_change_users_login @Action='Report';

Remediation:

IftheorphanedusercannotorshouldnotbematchedtoanexistingornewloginusingtheMicrosoftdocumentedprocessreferencedbelow,runthefollowingT-SQLqueryintheappropriatedatabasetoremoveanorphanuser:

USE [<database_name>]; GO DROP USER <username>;

References:

1. http://msdn.microsoft.com/en-us/library/ms175475(v=sql.110).aspx

CISControls:

16AccountMonitoringandControl

Page 53: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

52|P a g e

3.4EnsureSQLAuthenticationisnotusedincontaineddatabases(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

ContaineddatabasesdonotenforcepasswordcomplexityrulesforSQLAuthenticatedusers.

Rationale:

Theabsenceofanenforcedpasswordpolicymayincreasethelikelihoodofaweakcredentialbeingestablishedinacontaineddatabase.

Audit:

ExecutethefollowingineachcontaineddatabasetofinddatabaseusersthatareusingSQLauthentication:

SELECT name AS DBUser FROM sys.database_principals WHERE name NOT IN ('dbo','Information_Schema','sys','guest') AND type IN ('U','S','G') AND authentication_type = 2; GO

Remediation:

LeverageWindowsAuthenticatedusersincontaineddatabases.

Impact:

Whilecontaineddatabasesprovideflexibilityinrelocatingdatabasestodifferentinstancesanddifferentenvironments,thismustbebalancedwiththeconsiderationthatnopasswordpolicymechanismexistsforSQLAuthenticatedusersincontaineddatabases.

DefaultValue:

SQLAuthenticatedusers(USER WITH PASSWORDauthentication)areallowedincontaineddatabases.

Page 54: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

53|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/databases/security-best-practices-with-contained-databases

CISControls:

16.12UseLongPasswordsforAllUserAccountsWheremulti-factorauthenticationisnotsupported,useraccountsshallberequiredtouselongpasswordsonthesystem(longerthan14characters).

Page 55: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

54|P a g e

3.5EnsuretheSQLServer'sMSSQLServiceAccountisNotanAdministrator(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Theserviceaccountand/orserviceSIDusedbytheMSSQLSERVERserviceforadefaultinstanceorMSSQL$<InstanceName>foranamedinstanceshouldnotbeamemberoftheWindowsAdministratorgroupeitherdirectlyorindirectly(viaagroup).ThisalsomeansthattheaccountknownasLocalSystem(akaNT AUTHORITY\SYSTEM)shouldnotbeusedfortheMSSQLserviceasthisaccounthashigherprivilegesthantheSQLServerservicerequires.

Rationale:

Followingtheprincipleofleastprivilege,theserviceaccountshouldhavenomoreprivilegesthanrequiredtodoitsjob.ForSQLServerservices,theSQLServerSetupwillassigntherequiredpermissionsdirectlytotheserviceSID.Noadditionalpermissionsorprivilegesshouldbenecessary.

Audit:

Verifythattheserviceaccount(incaseofalocalorADaccount)andserviceSIDarenotmembersoftheWindowsAdministratorsgroup.

Remediation:

InthecasewhereLocalSystemisused,useSQLServerConfigurationManagertochangetoalessprivilegedaccount.Otherwise,removetheaccountorserviceSIDfromtheAdministratorsgroup.YoumayneedtoruntheSQLServerConfigurationManagerifunderlyingpermissionshadbeenchangedorifSQLServerConfigurationManagerwasnotoriginallyusedtosettheserviceaccount.

Impact:

TheSQLServerConfigurationManagertoolshouldalwaysbeusedtochangetheSQLServer’sserviceaccount.Thiswillensurethattheaccounthasthenecessaryprivileges.IftheserviceneedsaccesstoresourcesotherthanthestandardMicrosoft-defineddirectoriesandregistry,thenadditionalpermissionsmayneedtobegrantedseparatelytothoseresources.

Page 56: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

55|P a g e

DefaultValue:

Bydefault,theaccountisnotintheAdministratorsgroup.

References:

1. https://technet.microsoft.com/en-us/library/ms143504(v=sql.110).aspx

CISControls:

5.1MinimizeandSparinglyUseAdministrativePrivilegesMinimizeadministrativeprivilegesandonlyuseadministrativeaccountswhentheyarerequired.Implementfocusedauditingontheuseofadministrativeprivilegedfunctionsandmonitorforanomalousbehavior.

Page 57: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

56|P a g e

3.6EnsuretheSQLServer’sSQLAgentServiceAccountisNotanAdministrator(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Theserviceaccountand/orserviceSIDusedbytheSQLSERVERAGENTserviceforadefaultinstanceorSQLAGENT$<InstanceName>serviceforanamedinstanceshouldnotbeamemberoftheWindowsAdministratorgroupeitherdirectlyorindirectly(viaagroup).ThisalsomeansthattheaccountknownasLocalSystem(akaNT AUTHORITY\SYSTEM)shouldnotbeusedfortheSQLAGENTserviceasthisaccounthashigherprivilegesthantheSQLServerservicerequires.

Rationale:

Followingtheprincipleofleastprivilege,theserviceaccountshouldhavenomoreprivilegesthanrequiredtodoitsjob.ForSQLServerservices,theSQLServerSetupwillassigntherequiredpermissionsdirectlytotheserviceSID.Noadditionalpermissionsorprivilegesshouldbenecessary.

Audit:

Verifythattheserviceaccount(incaseofalocalorADaccount)andserviceSIDarenotmembersoftheWindowsAdministratorsgroup.

Remediation:

InthecasewhereLocalSystemisused,useSQLServerConfigurationManagertochangetoalessprivilegedaccount.Otherwise,removetheaccountorserviceSIDfromtheAdministratorsgroup.YoumayneedtoruntheSQLServerConfigurationManagerifunderlyingpermissionshadbeenchangedorifSQLServerConfigurationManagerwasnotoriginallyusedtosettheserviceaccount.

Impact:

TheSQLServerConfigurationManagertoolshouldalwaysbeusedtochangetheSQLServer’sserviceaccount.Thiswillensurethattheaccounthasthenecessaryprivileges.IftheserviceneedsaccesstoresourcesotherthanthestandardMicrosoft-defineddirectoriesandregistry,thenadditionalpermissionsmayneedtobegrantedseparatelytothoseresources.

Page 58: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

57|P a g e

Ifusingtheautorestartfeature,thentheSQLAGENTservicemustbeanAdministrator.

DefaultValue:

Bydefault,theServiceAccount(orServiceSID)isnotamemberoftheAdministratorsgroup.

References:

1. https://technet.microsoft.com/en-us/library/ms143504(v=sql.110).aspx

CISControls:

5.1MinimizeandSparinglyUseAdministrativePrivilegesMinimizeadministrativeprivilegesandonlyuseadministrativeaccountswhentheyarerequired.Implementfocusedauditingontheuseofadministrativeprivilegedfunctionsandmonitorforanomalousbehavior.

Page 59: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

58|P a g e

3.7EnsuretheSQLServer’sFull-TextServiceAccountisNotanAdministrator(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Theserviceaccountand/orserviceSIDusedbytheMSSQLFDLauncherserviceforadefaultinstanceorMSSQLFDLauncher$<InstanceName>serviceforanamedinstanceshouldnotbeamemberoftheWindowsAdministratorgroupeitherdirectlyorindirectly(viaagroup).ThisalsomeansthattheaccountknownasLocalSystem(akaNT AUTHORITY\SYSTEM)shouldnotbeusedfortheFull-TextserviceasthisaccounthashigherprivilegesthantheSQLServerservicerequires.

Rationale:

Followingtheprincipleofleastprivilege,theserviceaccountshouldhavenomoreprivilegesthanrequiredtodoitsjob.ForSQLServerservices,theSQLServerSetupwillassigntherequiredpermissionsdirectlytotheserviceSID.Noadditionalpermissionsorprivilegesshouldbenecessary.

Audit:

Verifythattheserviceaccount(incaseofalocalorADaccount)andserviceSIDarenotmembersoftheWindowsAdministratorsgroup.

Remediation:

InthecasewhereLocalSystemisused,useSQLServerConfigurationManagertochangetoalessprivilegedaccount.Otherwise,removetheaccountorserviceSIDfromtheAdministratorsgroup.YoumayneedtoruntheSQLServerConfigurationManagerifunderlyingpermissionshadbeenchangedorifSQLServerConfigurationManagerwasnotoriginallyusedtosettheserviceaccount.

Impact:

TheSQLServerConfigurationManagertoolshouldalwaysbeusedtochangetheSQLServer’sserviceaccount.Thiswillensurethattheaccounthasthenecessaryprivileges.IftheserviceneedsaccesstoresourcesotherthanthestandardMicrosoft-defineddirectoriesandregistry,thenadditionalpermissionsmayneedtobegrantedseparatelytothoseresources.

Page 60: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

59|P a g e

DefaultValue:

Bydefault,theServiceAccount(orServiceSID)isnotamemberoftheAdministratorsgroup.

References:

1. https://technet.microsoft.com/en-us/library/ms143504(v=sql.110).aspx

CISControls:

5.1MinimizeandSparinglyUseAdministrativePrivilegesMinimizeadministrativeprivilegesandonlyuseadministrativeaccountswhentheyarerequired.Implementfocusedauditingontheuseofadministrativeprivilegedfunctionsandmonitorforanomalousbehavior.

Page 61: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

60|P a g e

3.8EnsureonlythedefaultpermissionsspecifiedbyMicrosoftaregrantedtothepublicserverrole(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

publicisaspecialfixedserverrolecontainingalllogins.Unlikeotherfixedserverroles,permissionscanbechangedforthepublicrole.Inkeepingwiththeprincipleofleastprivileges,thepublicserverroleshouldnotbeusedtograntpermissionsattheserverscopeasthesewouldbeinheritedbyallusers.

Rationale:

EverySQLServerloginbelongstothepublicroleandcannotberemovedfromthisrole.Therefore,anypermissionsgrantedtothisrolewillbeavailabletoallloginsunlesstheyhavebeenexplicitlydeniedtospecificloginsoruser-definedserverroles.

Audit:

Usethefollowingsyntaxtodetermineifextrapermissionshavebeengrantedtothepublicserverrole.

SELECT * FROM master.sys.server_permissions WHERE (grantee_principal_id = SUSER_SID(N'public') and state_desc LIKE 'GRANT%') AND NOT (state_desc = 'GRANT' and [permission_name] = 'VIEW ANY DATABASE' and class_desc = 'SERVER') AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 2) AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 3) AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 4) AND NOT (state_desc = 'GRANT' and [permission_name] = 'CONNECT' and class_desc = 'ENDPOINT' and major_id = 5);

Thisqueryshouldnotreturnanyrows.

Remediation:

1. AddtheextraneouspermissionsfoundintheAuditqueryresultstothespecificloginstouser-definedserverroleswhichrequiretheaccess.

2. Revokethe<permission_name>fromthepublicroleasshownbelow

Page 62: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

61|P a g e

USE [master] GO REVOKE <permission_name> FROM public; GO

Impact:

Whentheextraneouspermissionsarerevokedfromthepublicserverrole,accessmaybelostunlessthepermissionsaregrantedtotheexplicitloginsortouser-definedserverrolescontainingtheloginswhichrequiretheaccess.

DefaultValue:

Bydefault,thepublicserverroleisgrantedVIEW ANY DATABASEpermissionandtheCONNECTpermissiononthedefaultendpoints(TSQL Local Machine,TSQL Named Pipes,TSQL Default TCP,TSQL Default VIA).TheVIEW ANY DATABASEpermissionallowsallloginstoseedatabasemetadata,unlessexplicitlydenied.

References:

1. https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/server-level-roles

2. https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/server-level-roles#permissions-of-fixed-server-roles

CISControls:

5.1MinimizeandSparinglyUseAdministrativePrivilegesMinimizeadministrativeprivilegesandonlyuseadministrativeaccountswhentheyarerequired.Implementfocusedauditingontheuseofadministrativeprivilegedfunctionsandmonitorforanomalousbehavior.

Page 63: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

62|P a g e

3.9EnsureWindowsBUILTINgroupsarenotSQLLogins(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

PriortoSQLServer2008,theBUILTIN\AdministratorsgroupwasaddedaSQLServerloginwithsysadminprivilegesduringinstallationbydefault.BestpracticespromotecreatinganActiveDirectorylevelgroupcontainingapprovedDBAstaffaccountsandusingthiscontrolledADgroupastheloginwithsysadminprivileges.TheADgroupshouldbespecifiedduringSQLServerinstallationandtheBUILTIN\Administratorsgroupwouldthereforehavenoneedtobealogin.

Rationale:

TheBUILTINgroups(Administrators,Everyone,AuthenticatedUsers,Guests,etc)generallycontainverybroadmembershipswhichwouldnotmeetthebestpracticeofensuringonlythenecessaryusershavebeengrantedaccesstoaSQLServerinstance.ThesegroupsshouldnotbeusedforanylevelofaccessintoaSQLServerDatabaseEngineinstance.

Audit:

UsethefollowingsyntaxtodetermineifanyBUILTINgroupsoraccountshavebeenaddedasSQLServerLogins.

SELECT pr.[name], pe.[permission_name], pe.[state_desc] FROM sys.server_principals pr JOIN sys.server_permissions pe ON pr.principal_id = pe.grantee_principal_id WHERE pr.name like 'BUILTIN%';

Thisqueryshouldnotreturnanyrows.

Remediation:

1. ForeachBUILTINlogin,ifneededcreateamorerestrictiveADgroupcontainingonlytherequireduseraccounts.

2. AddtheADgrouporindividualWindowsaccountsasaSQLServerloginandgrantitthepermissionsrequired.

Page 64: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

63|P a g e

3. DroptheBUILTINloginusingthesyntaxbelowafterreplacing<name>.

USE [master] GO DROP LOGIN [BUILTIN\<name>] GO

Impact:

BeforedroppingtheBUILTINgrouplogins,ensurethatalternativeADGroupsorWindowsloginshavebeenaddedwithequivalentpermissions.Otherwise,theSQLServerinstancemaybecometotallyinaccessible.

DefaultValue:

Bydefault,noBUILTINgroupsareaddedasSQLlogins.

CISControls:

14.4ProtectInformationwithAccessControlListsAllinformationstoredonsystemsshallbeprotectedwithfilesystem,networkshare,claims,application,ordatabasespecificaccesscontrollists.Thesecontrolswillenforcetheprinciplethatonlyauthorizedindividualsshouldhaveaccesstotheinformationbasedontheirneedtoaccesstheinformationasapartoftheirresponsibilities.

Page 65: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

64|P a g e

3.10EnsureWindowslocalgroupsarenotSQLLogins(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

LocalWindowsgroupsshouldnotbeusedasloginsforSQLServerinstances.

Rationale:

AllowinglocalWindowsgroupsasSQLLoginsprovidesaloopholewherebyanyonewithOSleveladministratorrights(andnoSQLServerrights)couldadduserstothelocalWindowsgroupsandtherebygivethemselvesorothersaccesstotheSQLServerinstance.

Audit:

UsethefollowingsyntaxtodetermineifanylocalgroupshavebeenaddedasSQLServerLogins.

USE [master] GO SELECT pr.[name] AS LocalGroupName, pe.[permission_name], pe.[state_desc] FROM sys.server_principals pr JOIN sys.server_permissions pe ON pr.[principal_id] = pe.[grantee_principal_id] WHERE pr.[type_desc] = 'WINDOWS_GROUP' AND pr.[name] like CAST(SERVERPROPERTY('MachineName') AS nvarchar) + '%';

Thisqueryshouldnotreturnanyrows.

Remediation:

1. ForeachLocalGroupNamelogin,ifneededcreateanequivalentADgroupcontainingonlytherequireduseraccounts.

2. AddtheADgrouporindividualWindowsaccountsasaSQLServerloginandgrantitthepermissionsrequired.

3. DroptheLocalGroupNameloginusingthesyntaxbelowafterreplacing<name>.

USE [master] GO DROP LOGIN [<name>] GO

Page 66: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

65|P a g e

Impact:

Beforedroppingthelocalgrouplogins,ensurethatalternativeADGroupsorWindowsloginshavebeenaddedwithequivalentpermissions.Otherwise,theSQLServerinstancemaybecometotallyinaccessible.

DefaultValue:

Bydefault,nolocalgroupsareaddedasSQLlogins.

CISControls:

14.4ProtectInformationwithAccessControlListsAllinformationstoredonsystemsshallbeprotectedwithfilesystem,networkshare,claims,application,ordatabasespecificaccesscontrollists.Thesecontrolswillenforcetheprinciplethatonlyauthorizedindividualsshouldhaveaccesstotheinformationbasedontheirneedtoaccesstheinformationasapartoftheirresponsibilities.

Page 67: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

66|P a g e

3.11EnsurethepublicroleinthemsdbdatabaseisnotgrantedaccesstoSQLAgentproxies(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Thepublicdatabaserolecontainseveryuserinthemsdbdatabase.SQLAgentproxiesdefineasecuritycontextinwhichajobstepcanrun.

Rationale:

GrantingaccesstoSQLAgentproxiesforthepublicrolewouldallowalluserstoutilizetheproxywhichmayhavehighprivileges.Thiswouldlikelybreaktheprincipleofleastprivileges.

Audit:

Usethefollowingsyntaxtodetermineifaccesstoanyproxieshavebeengrantedtothemsdbdatabase'spublicrole.

USE [msdb] GO SELECT sp.name AS proxyname FROM dbo.sysproxylogin spl JOIN sys.database_principals dp ON dp.sid = spl.sid JOIN sysproxies sp ON sp.proxy_id = spl.proxy_id WHERE principal_id = USER_ID('public'); GO

Thisqueryshouldnotreturnanyrows.

Remediation:

1. Ensuretherequiredsecurityprincipalsareexplicitlygrantedaccesstotheproxy(usesp_grant_login_to_proxy).

2. Revokeaccesstothe<proxyname>fromthepublicrole.

USE [msdb] GO EXEC dbo.sp_revoke_login_from_proxy @name = N'public', @proxy_name = N'<proxyname>'; GO

Page 68: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

67|P a g e

Impact:

Beforerevokingthepublicrolefromtheproxy,ensurethatalternativeloginsorappropriateuser-defineddatabaseroleshavebeenaddedwithequivalentpermissions.Otherwise,SQLAgentjobstepsdependentuponthisaccesswillfail.

DefaultValue:

Bydefault,themsdbpublicdatabaseroledoesnothaveaccesstoanyproxy.

References:

1. https://support.microsoft.com/en-us/help/2160741/best-practices-in-configuring-sql-server-agent-proxy-account

CISControls:

14.4ProtectInformationwithAccessControlListsAllinformationstoredonsystemsshallbeprotectedwithfilesystem,networkshare,claims,application,ordatabasespecificaccesscontrollists.Thesecontrolswillenforcetheprinciplethatonlyauthorizedindividualsshouldhaveaccesstotheinformationbasedontheirneedtoaccesstheinformationasapartoftheirresponsibilities.

Page 69: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

68|P a g e

4PasswordPolicies

Thissectioncontainsrecommendationsrelatedtopasswordpolicies.

4.1Ensure'MUST_CHANGE'Optionissetto'ON'forAllSQLAuthenticatedLogins(NotScored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

WheneverthisoptionissettoON,SQLServerwillpromptforanupdatedpasswordthefirsttimetheneworalteredloginisused.

Rationale:

EnforcingapasswordchangeafteraresetornewlogincreationwillpreventtheaccountadministratorsoranyoneaccessingtheinitialpasswordfrommisuseoftheSQLlogincreatedwithoutbeingnoticed.

Audit:

1. OpenSQLServerManagementStudio.2. OpenObjectExplorerandconnecttothetargetinstance.3. NavigatetotheLoginstabinObjectExplorerandexpand.Rightclickonthe

desiredloginandselectProperties.4. VerifytheUsermustchangepasswordatnextlogincheckboxischecked.

Note:Thisauditprocedureisonlyapplicableimmediatelyaftertheloginhasbeencreatedoralteredtoforcethepasswordchange.Oncethepasswordischanged,thereisnowaytoknowspecificallythatthisoptionwastheforcingmechanismbehindapasswordchange.

Remediation:

SettheMUST_CHANGEoptionforSQLAuthenticatedloginswhencreatingalogininitially:

CREATE LOGIN <login_name> WITH PASSWORD = '<password_value>' MUST_CHANGE, CHECK_EXPIRATION = ON, CHECK_POLICY = ON;

SettheMUST_CHANGEoptionforSQLAuthenticatedloginswhenresettingapassword:

ALTER LOGIN <login_name> WITH PASSWORD = '<new_password_value>' MUST_CHANGE;

Page 70: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

69|P a g e

Impact:

CHECK_EXPIRATIONandCHECK_POLICYoptionsmustbothbeON.Endusersmusthavethemeans(application)tochangethepasswordwhenforced.

DefaultValue:

ONwhencreatinganewloginviatheSSMSGUI.

OFFwhencreatinganewloginusingT-SQLCREATE LOGINunlesstheMUST_CHANGEoptionisexplicitlyincludedalongwithCHECK_EXPIRATION = ON.

References:

1. https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-login-transact-sql2. https://docs.microsoft.com/en-us/sql/t-sql/statements/create-login-transact-sql

CISControls:

16AccountMonitoringandControl

Page 71: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

70|P a g e

4.2Ensure'CHECK_EXPIRATION'Optionissetto'ON'forAllSQLAuthenticatedLoginsWithintheSysadminRole(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

AppliesthesamepasswordexpirationpolicyusedinWindowstopasswordsusedinsideSQLServer.

Rationale:

EnsuringSQLloginscomplywiththesecurepasswordpolicyappliedbytheWindowsServerBenchmarkwillensurethepasswordsforSQLauthenticatedloginswithsysadminprivilegesarechangedonafrequentbasistohelppreventcompromiseviaabruteforceattack.CONTROL SERVERisanequivalentpermissiontosysadminandloginswiththatpermissionshouldalsoberequiredtohaveexpiringpasswords.

Audit:

RunthefollowingT-SQLstatementtofindsysadminloginswithCHECK_EXPIRATION OFF.Norowsshouldbereturned.

SELECT l.[name], 'sysadmin membership' AS 'Access_Method' FROM sys.sql_logins AS l WHERE IS_SRVROLEMEMBER('sysadmin',name) = 1 AND l.is_expiration_checked <> 1 UNION ALL SELECT l.[name], 'CONTROL SERVER' AS 'Access_Method' FROM sys.sql_logins AS l JOIN sys.server_permissions AS p ON l.principal_id = p.grantee_principal_id WHERE p.type = 'CL' AND p.state IN ('G', 'W') AND l.is_expiration_checked <> 1;

Remediation:

Foreach<login_name>foundbytheAuditProcedure,executethefollowingT-SQLstatement:

ALTER LOGIN [<login_name>] WITH CHECK_EXPIRATION = ON;

Page 72: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

71|P a g e

Impact:

ThisisamitigatingrecommendationforsystemswhichcannotfollowtherecommendationtouseonlyWindowsAuthenticatedlogins.

RegardinglimitingthisruletoonlyloginswithsysadminandCONTROL SERVERprivileges,therearetoomanycasesofapplicationsthatrunwithlessthansysadminlevelprivilegesthathavehard-codedpasswordsoreffectivelyhard-codedpasswords(whateverissetthefirsttimeisnearlyimpossibletochange).Thereareseverallinesofbusinessapplicationsthatareconsideredbestofbreedwhichhasthisfailing.

Also,keepinmindthatthepasswordpolicyistakenfromthecomputer'slocalpolicy,whichwilltakefromtheDefaultDomainPolicysetting.Manyorganizationshaveadifferentpasswordpolicywithregardstoserviceaccounts.ThesearehandledinADbysettingtheaccount'spasswordnottoexpireandhavingsomeotherprocesstrackwhentheyneedtobechanged.Withthissecondcontrolinplace,thisisperfectlyacceptablefromanauditperspective.IfyoutreataSQLServerloginasaserviceaccount,thenyouhavetodothesame.Thisensuresthatthepasswordchangehappensduringacommunicateddowntimewindowandnotarbitrarily.

DefaultValue:

CHECK_EXPIRATIONisONbydefaultwhenusingSSMStocreateaSQLauthenticatedlogin.

CHECK_EXPIRATIONisOFFbydefaultwhenusingT-SQLCREATE LOGINsyntaxwithoutspecifyingtheCHECK_EXPIRATIONoption.

References:

1. http://msdn.microsoft.com/en-us/library/ms161959(v=sql.110).aspx

CISControls:

16.2AllAccountsHaveaMonitoredExpirationDateEnsurethatallaccountshaveanexpirationdatethatismonitoredandenforced.

Page 73: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

72|P a g e

4.3Ensure'CHECK_POLICY'Optionissetto'ON'forAllSQLAuthenticatedLogins(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

AppliesthesamepasswordcomplexitypolicyusedinWindowstopasswordsusedinsideSQLServer.

Rationale:

EnsureSQLauthenticatedloginpasswordscomplywiththesecurepasswordpolicyappliedbytheWindowsServerBenchmarksothattheycannotbeeasilycompromisedviabruteforceattack.

Audit:

UsethefollowingcodesnippettodeterminethestatusofSQLLoginsandiftheirpasswordcomplexityisenforced.

SELECT name, is_disabled FROM sys.sql_logins WHERE is_policy_checked = 0;

Theis_policy_checkedvalueof0indicatesthattheCHECK_POLICYoptionisOFF;valueof1isON.Ifis_disabledvalueis1,thentheloginisdisabledandunusable.IfnorowsarereturnedtheneithernoSQLAuthenticatedloginsexistortheyallhaveCHECK_POLICY ON.

Remediation:

Foreach<login_name>foundbytheAuditProcedure,executethefollowingT-SQLstatement:

ALTER LOGIN [<login_name>] WITH CHECK_POLICY = ON;

Impact:

ThisisamitigatingrecommendationforsystemswhichcannotfollowtherecommendationtouseonlyWindowsAuthenticatedlogins.

Weakpasswordscanleadtocompromisedsystems.SQLServerauthenticatedloginswillutilizethepasswordpolicysetinthecomputer'slocalpolicy,whichistypicallysetbytheDefaultDomainPolicysetting.

Page 74: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

73|P a g e

Thesettingisonlyenforcedwhenthepasswordischanged.Thissettingdoesnotforceexistingweakpasswordstobechanged.

DefaultValue:

CHECK_POLICYisON

References:

1. http://msdn.microsoft.com/en-us/library/ms161959(v=sql.110).aspx

CISControls:

16AccountMonitoringandControl

Page 75: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

74|P a g e

5AuditingandLogging

ThissectioncontainsrecommendationsrelatedtoSQLServer'sauditandloggingmechanisms.

5.1Ensure'Maximumnumberoferrorlogfiles'issettogreaterthanorequalto'12'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

SQLServererrorlogfilesmustbeprotectedfromloss.Thelogfilesmustbebackedupbeforetheyareoverwritten.Retainingmoreerrorlogshelpspreventlossfromfrequentrecyclingbeforebackupscanoccur.

Rationale:

TheSQLServererrorlogcontainsimportantinformationaboutmajorservereventsandloginattemptinformationaswell.

Audit:

PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. OpenSQLServerManagementStudio.2. OpenObjectExplorerandconnecttothetargetinstance.3. NavigatetotheManagementtabinObjectExplorerandexpand.Rightclickonthe

SQLServerLogsfileandselectConfigure.4. VerifytheLimitthenumberoferrorlogfilesbeforetheyarerecycledcheckbox

ischecked5. VerifytheMaximumnumberoferrorlogfilesisgreaterthanorequalto12

T-SQLMethod

Page 76: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

75|P a g e

RunthefollowingT-SQL.TheNumberOfLogFilesreturnedshouldbegreaterthanorequalto12.

DECLARE @NumErrorLogs int; EXEC master.sys.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', @NumErrorLogs OUTPUT; SELECT ISNULL(@NumErrorLogs, -1) AS [NumberOfLogFiles];

Remediation:

Adjustthenumberoflogstopreventdataloss.Thedefaultvalueof6maybeinsufficientforaproductionenvironment.PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. OpenSQLServerManagementStudio.2. OpenObjectExplorerandconnecttothetargetinstance.3. NavigatetotheManagementtabinObjectExplorerandexpand.Rightclickonthe

SQLServerLogsfileandselectConfigure4. ChecktheLimitthenumberoferrorlogfilesbeforetheyarerecycled5. SettheMaximumnumberoferrorlogfilestogreaterthanorequalto12

T-SQLMethodRunthefollowingT-SQLtochangethenumberoferrorlogfiles,replace<NumberAbove12>withyourdesirednumberoferrorlogfiles:

EXEC master.sys.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', REG_DWORD, <NumberAbove12>;

Impact:

Oncethemaxnumberoferrorlogsisreached,theoldesterrorlogfileisdeletedeachtimeSQLServerrestartsorsp_cycle_errorlogisexecuted.

DefaultValue:

6SQLServererrorlogfilesinadditiontothecurrenterrorlogfileareretainedbydefault.

Page 77: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

76|P a g e

References:

1. http://msdn.microsoft.com/en-us/library/ms177285(v=sql.110).aspx

CISControls:

6.3EnsureAuditLoggingSystemsAreNotSubjecttoLoss(i.e.rotation/archive)Ensurethatallsystemsthatstorelogshaveadequatestoragespaceforthelogsgeneratedonaregularbasis,sothatlogfileswillnotfillupbetweenlogrotationintervals.Thelogsmustbearchivedanddigitallysignedonaperiodicbasis.

Page 78: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

77|P a g e

5.2Ensure'DefaultTraceEnabled'ServerConfigurationOptionissetto'1'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Thedefaulttraceprovidesauditloggingofdatabaseactivityincludingaccountcreations,privilegeelevationandexecutionofDBCCcommands.

Rationale:

Defaulttraceprovidesvaluableauditinformationregardingsecurity-relatedactivitiesontheserver.

Audit:

RunthefollowingT-SQLcommand:

SELECT name, CAST(value as int) as value_configured, CAST(value_in_use as int) as value_in_use FROM sys.configurations WHERE name = 'default trace enabled';

Bothvaluecolumnsmustshow1.

Remediation:

RunthefollowingT-SQLcommand:

EXECUTE sp_configure 'show advanced options', 1; RECONFIGURE; EXECUTE sp_configure 'default trace enabled', 1; RECONFIGURE; GO EXECUTE sp_configure 'show advanced options', 0; RECONFIGURE;

DefaultValue:

1(on)

Page 79: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

78|P a g e

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/default-trace-enabled-server-configuration-option

CISControls:

6.2EnsureAuditLogSettingsSupportAppropriateLogEntryFormattingValidateauditlogsettingsforeachhardwaredeviceandthesoftwareinstalledonit,ensuringthatlogsincludeadate,timestamp,sourceaddresses,destinationaddresses,andvariousotherusefulelementsofeachpacketand/ortransaction.SystemsshouldrecordlogsinastandardizedformatsuchassyslogentriesorthoseoutlinedbytheCommonEventExpressioninitiative.Ifsystemscannotgeneratelogsinastandardizedformat,lognormalizationtoolscanbedeployedtoconvertlogsintosuchaformat.

Page 80: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

79|P a g e

5.3Ensure'LoginAuditing'issetto'failedlogins'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

ThissettingwillrecordfailedauthenticationattemptsforSQLServerloginstotheSQLServerErrorlog.ThisisthedefaultsettingforSQLServer.

Historically,thissettinghasbeenavailableinallversionsandeditionsofSQLServer.PriortotheavailabilityofSQLServerAudit,thiswastheonlyprovidedmechanismforcapturinglogins(successfulorfailed).

Rationale:

Capturingfailedloginsprovideskeyinformationthatcanbeusedtodetect\confirmpasswordguessingattacks.Capturingsuccessfulloginattemptscanbeusedtoconfirmserveraccessduringforensicinvestigations,butusingthisauditlevelsettingtoalsocapturesuccessfulloginscreatesexcessivenoiseintheSQLServerErrorlogwhichcanhamperaDBAtryingtotroubleshootproblems.Elsewhereinthisbenchmark,werecommendusingthenewerlightweightSQLServerAuditfeaturetocapturebothsuccessfulandfailedlogins.

Audit:

EXEC xp_loginconfig 'audit level';

Aconfig_valueoffailureindicatesaserverloginauditingsettingofFailedloginsonly.Ifaconfig_valueofallappears,thenbothfailedandsuccessfulloginsarebeinglogged.Bothsettingsshouldalsobeconsideredvalid,butasmentionedcapturingsuccessfulloginsusingthismethodcreateslotsofnoiseintheSQLServerErrorlog.

Remediation:

PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. OpenSQLServerManagementStudio.2. RightclickthetargetinstanceandselectPropertiesandnavigatetotheSecurity

tab.3. SelecttheoptionFailedloginsonlyundertheLoginAuditingsectionandclickOK.4. RestarttheSQLServerinstance.

Page 81: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

80|P a g e

T-SQLMethod

1. Run:

EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'AuditLevel', REG_DWORD, 2

2. RestarttheSQLServerinstance.

Impact:

Ataminimum,wewanttoensurefailedloginsarecapturedinordertodetectifanadversaryisattemptingtobruteforcepasswordsorotherwiseattemptingtoaccessaSQLServerimproperly.

ChangingthesettingrequiresarestartoftheSQLServerservice.

DefaultValue:

Bydefault,onlyfailedloginattemptsarecaptured.

References:

1. https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/server-properties-security-page

CISControls:

16.10ProfileUserAccountUsageandMonitorforAnomaliesProfileeachuser’stypicalaccountusagebydeterminingnormaltime-of-dayaccessandaccessduration.Reportsshouldbegeneratedthatindicateuserswhohaveloggedinduringunusualhoursorhaveexceededtheirnormalloginduration.Thisincludesflaggingtheuseoftheuser’scredentialsfromacomputerotherthancomputersonwhichtheusergenerallyworks.

Page 82: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

81|P a g e

5.4Ensure'SQLServerAudit'issettocaptureboth'failed'and'successfullogins'(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

SQLServerAuditiscapableofcapturingbothfailedandsuccessfulloginsandwritingthemtooneofthreeplaces:theapplicationeventlog,thesecurityeventlog,orthefilesystem.WewilluseittocaptureanyloginattempttoSQLServer,aswellasanyattemptstochangeauditpolicy.Thiswillalsoservetobeasecondsourcetorecordfailedloginattempts.

Rationale:

ByutilizingAuditinsteadofthetraditionalsettingundertheSecuritytabtocapturesuccessfullogins,wereducethenoiseintheERRORLOG.ThiskeepsitsmallerandeasiertoreadforDBAswhoareattemptingtotroubleshootissueswiththeSQLServer.Also,theAuditobjectcanwritetothesecurityeventlog,thoughthisrequiresoperatingsystemconfiguration.Thisgivesanadditionaloptionforwheretostoreloginevents,especiallyinconjunctionwithanSIEM.

Audit:

SELECT S.name AS 'Audit Name' , CASE S.is_state_enabled WHEN 1 THEN 'Y' WHEN 0 THEN 'N' END AS 'Audit Enabled' , S.type_desc AS 'Write Location' , SA.name AS 'Audit Specification Name' , CASE SA.is_state_enabled WHEN 1 THEN 'Y' WHEN 0 THEN 'N' END AS 'Audit Specification Enabled' , SAD.audit_action_name , SAD.audited_result FROM sys.server_audit_specification_details AS SAD JOIN sys.server_audit_specifications AS SA ON SAD.server_specification_id = SA.server_specification_id JOIN sys.server_audits AS S ON SA.audit_guid = S.audit_guid WHERE SAD.audit_action_id IN ('CNAU', 'LGFL', 'LGSD');

Theresultsetshouldcontain3rows,oneforthefollowingaudit_action_names:• AUDIT_CHANGE_GROUP• FAILED_LOGIN_GROUP• SUCCESSFUL_LOGIN_GROUP

Page 83: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

82|P a g e

BoththeAuditandAuditspecificationshouldbeenabledandtheaudited_resultshouldincludebothsuccessandfailure.

Remediation:

PerformeithertheGUIorT-SQLmethodshown:

GUIMethod

1. ExpandtheSQLServerinObjectExplorer.2. ExpandtheSecurityfolder3. Right-clickontheAuditsfolderandchooseNewAudit...4. SpecifyanamefortheServerAudit.5. SpecifytheauditdestinationdetailsandthenclickOKtosavetheServerAudit.6. Right-clickonServerAuditSpecificationsandchooseNewServerAudit

Specification...7. NametheServerAuditSpecification8. SelectthejustcreatedServerAuditintheAuditdrop-downselection.9. Clickthedrop-downunderAuditActionTypeandselectAUDIT_CHANGE_GROUP.10. Clickthenewdrop-downunderAuditActionTypeandselectFAILED_LOGIN_GROUP.11. Clickthenewdrop-downunderAuditActionTypeandselect

SUCCESSFUL_LOGIN_GROUP.12. ClickOKtosavetheServerAuditSpecification.13. Right-clickonthenewServerAuditSpecificationandselectEnableServerAudit

Specification.14. Right-clickonthenewServerAuditandselectEnableServerAudit.

T-SQLMethod

Executecodesimilarto:

CREATE SERVER AUDIT TrackLogins TO APPLICATION_LOG; GO CREATE SERVER AUDIT SPECIFICATION TrackAllLogins FOR SERVER AUDIT TrackLogins ADD (FAILED_LOGIN_GROUP), ADD (SUCCESSFUL_LOGIN_GROUP), ADD (AUDIT_CHANGE_GROUP) WITH (STATE = ON); GO ALTER SERVER AUDIT TrackLogins WITH (STATE = ON); GO

Note:IfthewritedestinationfortheAuditobjectistobethesecurityeventlog,seetheBooksOnlinetopicWriteSQLServerAuditEventstotheSecurityLogandfollowtheappropriatesteps.

Page 84: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

83|P a g e

Impact:

Withthepreviousrecommendation,onlyfailedloginsarecaptured.IftheAuditobjectisnotimplementedwiththeappropriatesetting,SQLServerwillnotcapturesuccessfullogins,whichmightproveofuseforforensics.

DefaultValue:

Bydefault,thereisnoauditobjecttrackingloginevents.

References:

1. https://msdn.microsoft.com/en-us/library/cc280525(v=sql.110).aspx

CISControls:

5.5LogFailedAdministrativeLoginAttemptsConfiguresystemstoissuealogentryandalertonanyunsuccessfullogintoanadministrativeaccount.

Page 85: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

84|P a g e

6ApplicationDevelopment

ThissectioncontainsrecommendationsrelatedtodevelopingapplicationsthatinterfacewithSQLServer.

6.1EnsureSanitizeDatabaseandApplicationUserInputisSanitized(NotScored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

Alwaysvalidateuserinputreceivedfromadatabaseclientorapplicationbytestingtype,length,format,andrangepriortotransmittingittothedatabaseserver.

Rationale:

SanitizinguserinputdrasticallyminimizesriskofSQLinjection.

Audit:

CheckwiththeapplicationteamstoensureanydatabaseinteractionisthroughtheuseofstoredproceduresandnotdynamicSQL.RevokeanyINSERT,UPDATE,orDELETEprivilegestouserssothatmodificationstodatamustbedonethroughstoredprocedures.Verifythatthere'snoSQLqueryintheapplicationcodeproducedbystringconcatenation.

Remediation:

ThefollowingstepscanbetakentoremediateSQLinjectionvulnerabilities:

• ReviewTSQLandapplicationcodeforSQLInjection• Onlypermitminimallyprivilegedaccountstosenduserinputtotheserver• MinimizetheriskofSQLinjectionattackbyusingparameterizedcommandsand

storedprocedures• Rejectuserinputcontainingbinarydata,escapesequences,andcomment

characters• AlwaysvalidateuserinputanddonotuseitdirectlytobuildSQLstatements

Impact:

Sanitizeuserinputmayrequirechangestoapplicationcodeordatabaseobjectsyntax.Thesechangescanrequireapplicationsordatabasestobetakentemporarilyoff-line.Any

Page 86: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

85|P a g e

changetoTSQLorapplicationcodeshouldbethoroughlytestedintestingenvironmentbeforeproductionimplementation.

References:

1. https://www.owasp.org/index.php/SQL_Injection

CISControls:

18.3SanitizeInputforIn-houseSoftwareForin-housedevelopedsoftware,ensurethatexpliciterrorcheckingisperformedanddocumentedforallinput,includingforsize,datatype,andacceptablerangesorformats.

Page 87: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

86|P a g e

6.2Ensure'CLRAssemblyPermissionSet'issetto'SAFE_ACCESS'forAllCLRAssemblies(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

SettingCLRAssemblyPermissionSetstoSAFE_ACCESSwillpreventassembliesfromaccessingexternalsystemresourcessuchasfiles,thenetwork,environmentvariables,ortheregistry.

Rationale:

AssemblieswithEXTERNAL_ACCESSorUNSAFEpermissionsetscanbeusedtoaccesssensitiveareasoftheoperatingsystem,stealand/ortransmitdataandalterthestateandotherprotectionmeasuresoftheunderlyingWindowsOperatingSystem.

AssemblieswhichareMicrosoft-created(is_user_defined = 0)areexcludedfromthischeckastheyarerequiredforoverallsystemfunctionality.

Audit:

ExecutethefollowingSQLstatement:

SELECT name, permission_set_desc FROM sys.assemblies WHERE is_user_defined = 1;

AllthereturnedassembliesshouldshowSAFE_ACCESSinthepermission_set_desccolumn.

Remediation:

ALTER ASSEMBLY <assembly_name> WITH PERMISSION_SET = SAFE;

Impact:

TheremediationmeasureshouldfirstbetestedwithinatestenvironmentpriortoproductiontoensuretheassemblystillfunctionsasdesignedwithSAFEpermissionsetting.

DefaultValue:

SAFEpermissionset

Page 88: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

87|P a g e

References:

1. http://msdn.microsoft.com/en-us/library/ms345101(v=sql.110).aspx2. http://msdn.microsoft.com/en-us/library/ms189790(v=sql.110).aspx3. http://msdn.microsoft.com/en-us/library/ms186711(v=sql.110).aspx

CISControls:

18ApplicationSoftwareSecurity

Page 89: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

88|P a g e

7Encryption

Theserecommendationspertaintoencryption-relatedaspectsofSQLServer.

7.1Ensure'SymmetricKeyencryptionalgorithm'issetto'AES_128'orhigherinnon-systemdatabases(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

PertheMicrosoftBestPractices,onlytheSQLServerAESalgorithmoptions,AES_128,AES_192,andAES_256,shouldbeusedforasymmetrickeyencryptionalgorithm.

Rationale:

Thefollowingalgorithms(asreferredtobySQLServer)areconsideredweakordeprecatedandshouldnolongerbeusedinSQLServer:DES,DESX,RC2,RC4,RC4_128.

ManyorganizationsmayaccepttheTripleDESalgorithms(TDEA)whichusekeyingoptions1(3keyaka3TDEA)orkeyingoption2(2keyaka2TDEA).InSQLServer,thesearereferredtoasTRIPLE_DES_3KEYandTRIPLE_DESrespectively.Additionally,theSQLServeralgorithmnamedDESXisactuallythesameimplementationastheTRIPLE_DES_3KEYoption.However,usingtheDESXidentifierasthealgorithmtypehasbeendeprecatedanditsusageisnowdiscouraged.

Audit:

Runthefollowingcodeforeachindividualuserdatabase:

USE [<database_name>] GO SELECT db_name() AS Database_Name, name AS Key_Name FROM sys.symmetric_keys WHERE algorithm_desc NOT IN ('AES_128','AES_192','AES_256') AND db_id() > 4; GO

Forcompliance,norowsshouldbereturned.

Page 90: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

89|P a g e

Remediation:

RefertoMicrosoftSQLServerBooksOnlineALTERSYMMETRICKEYentry:https://msdn.microsoft.com/en-US/library/ms189440(v=sql.110).aspx

Impact:

Eliminatesuseofweakanddeprecatedalgorithmswhichmayputasystemathigherriskofanattackerbreakingthekey.

Encrypteddatacannotbecompressed,butcompresseddatacanbeencrypted.Ifyouusecompression,youshouldcompressdatabeforeencryptingit.

DefaultValue:

None

References:

1. https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-symmetric-key-transact-sql

2. http://support.microsoft.com/kb/2162020

CISControls:

14.2EncryptAllSensitiveInformationOverLess-trustedNetworksAllcommunicationofsensitiveinformationoverless-trustednetworksshouldbeencrypted.Wheneverinformationflowsoveranetworkwithalowertrustlevel,theinformationshouldbeencrypted.

Page 91: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

90|P a g e

7.2EnsureAsymmetricKeySizeissetto'greaterthanorequalto2048'innon-systemdatabases(Scored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

MicrosoftBestPracticesrecommendtouseatleasta2048-bitencryptionalgorithmforasymmetrickeys.

Rationale:

TheRSA_2048encryptionalgorithmforasymmetrickeysinSQLServeristhehighestbit-levelprovidedandthereforethemostsecureavailablechoice(otherchoicesareRSA_512andRSA_1024).

Audit:

Runthefollowingcodeforeachindividualuserdatabase:

USE <database_name>; GO SELECT db_name() AS Database_Name, name AS Key_Name FROM sys.asymmetric_keys WHERE key_length < 2048 AND db_id() > 4; GO

Forcompliance,norowsshouldbereturned.

Remediation:

RefertoMicrosoftSQLServerBooksOnlineALTERASYMMETRICKEYentry:https://msdn.microsoft.com/en-us/library/ms187311(v=sql.110).aspx

Impact:

Thehigher-bitlevelmayresultinslowerperformance,butreducesthelikelihoodofanattackerbreakingthekey.

Encrypteddatacannotbecompressed,butcompresseddatacanbeencrypted.Ifyouusecompression,youshouldcompressdatabeforeencryptingit.

Page 92: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

91|P a g e

DefaultValue:

None

References:

1. https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-asymmetric-key-transact-sql

2. http://support.microsoft.com/kb/2162020

CISControls:

14.2EncryptAllSensitiveInformationOverLess-trustedNetworksAllcommunicationofsensitiveinformationoverless-trustednetworksshouldbeencrypted.Wheneverinformationflowsoveranetworkwithalowertrustlevel,theinformationshouldbeencrypted.

Page 93: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

92|P a g e

8Appendix:AdditionalConsiderations

Thisappendixdiscussespossibleconfigurationoptionsforwhichnorecommendationisbeinggiven.

8.1Ensure'SQLServerBrowserService'isconfiguredcorrectly(NotScored)

ProfileApplicability:

• Level1-DatabaseEngine

Description:

NorecommendationisbeinggivenondisablingtheSQLServerBrowserservice.

Rationale:

Inthecaseofadefaultinstanceinstallation,theSQLServerBrowserserviceisdisabledbydefault.Unlessthereisanamedinstanceonthesameserver,thereisnotypicallyreasonfortheSQLServerBrowserservicetoberunning.InthiscaseitisstronglysuggestedthattheSQLServerBrowserserviceremaindisabled.

Whenitcomestonamedinstances,giventhatasecurityscancanfingerprintaSQLServerlisteningonanyport,it'sthereforeoflimitedbenefittodisabletheSQLServerBrowserservice.

However,ifallconnectionsagainstthenamedinstanceareviaapplicationsandarenotvisibletoendusers,thenconfiguringthenamedinstancetolisteningonastaticport,disablingtheSQLServerBrowserservice,andconfiguringtheappstoconnecttothespecifiedportshouldbethedirectiontaken.Thisfollowsthegeneralpracticeofreducingthesurfacearea,especiallyforanunneededfeature.

Ontheotherhand,ifendusersaredirectlyconnectingtodatabasesontheinstance,thentypicallyhavingthemuseServerName\InstanceNameisbest.ThisrequirestheSQLServerBrowserservicetoberunning.DisablingtheSQLServerBrowserservicewouldmeantheenduserswouldhavetorememberportnumbersfortheinstances.Whentheydon'tthatwillgenerateservicecallstoITstaff.Giventhelimitedbenefitofdisablingtheservice,thetrade-offisprobablynotworthit,meaningitmakesmorebusinesssensetoleavetheSQLServerBrowserserviceenabled.

Page 94: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

93|P a g e

Audit:

ChecktheSQLBrowserservice'sstatusviaservices.mscorsimilarmethods.

Remediation:

Enableordisabletheserviceasneededforyourenvironment.

DefaultValue:

TheSQLServerBrowserserviceisdisabledifonlyadefaultinstanceisinstalledontheserver.Ifanamedinstanceisinstalled,thedefaultvalueisfortheSQLServerBrowserservicetobeconfiguredasAutomaticforstartup.

CISControls:

9.1LimitOpenPorts,Protocols,andServicesEnsurethatonlyports,protocols,andserviceswithvalidatedbusinessneedsarerunningoneachsystem.

Page 95: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

94|P a g e

Appendix:SummaryTableControl Set

CorrectlyYes No

1 Installation,UpdatesandPatches1.1 EnsureLatestSQLServerServicePacksandHotfixesare

Installed(NotScored) o o

1.2 EnsureSingle-FunctionMemberServersareUsed(NotScored) o o

2 SurfaceAreaReduction2.1 Ensure'AdHocDistributedQueries'ServerConfiguration

Optionissetto'0'(Scored) o o

2.2 Ensure'CLREnabled'ServerConfigurationOptionissetto'0'(Scored) o o

2.3 Ensure'CrossDBOwnershipChaining'ServerConfigurationOptionissetto'0'(Scored) o o

2.4 Ensure'DatabaseMailXPs'ServerConfigurationOptionissetto'0'(Scored) o o

2.5 Ensure'OleAutomationProcedures'ServerConfigurationOptionissetto'0'(Scored) o o

2.6 Ensure'RemoteAccess'ServerConfigurationOptionissetto'0'(Scored) o o

2.7 Ensure'RemoteAdminConnections'ServerConfigurationOptionissetto'0'(Scored) o o

2.8 Ensure'ScanForStartupProcs'ServerConfigurationOptionissetto'0'(Scored) o o

2.9 Ensure'Trustworthy'DatabasePropertyissetto'Off'(Scored) o o

2.10 EnsureUnnecessarySQLServerProtocolsaresetto'Disabled'(NotScored) o o

2.11 EnsureSQLServerisconfiguredtousenon-standardports(Scored) o o

2.12 Ensure'HideInstance'optionissetto'Yes'forProductionSQLServerinstances(Scored) o o

2.13 Ensure'sa'LoginAccountissetto'Disabled'(Scored) o o2.14 Ensure'sa'LoginAccounthasbeenrenamed(Scored) o o2.15 Ensure'xp_cmdshell'ServerConfigurationOptionissetto

'0'(Scored) o o

2.16 Ensure'AUTO_CLOSE'issetto'OFF'oncontaineddatabases(Scored) o o

2.17 Ensurenologinexistswiththename'sa'(Scored) o o

Page 96: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

95|P a g e

3 AuthenticationandAuthorization3.1 Ensure'ServerAuthentication'Propertyissetto'Windows

AuthenticationMode'(Scored) o o

3.2 EnsureCONNECTpermissionsonthe'guestuser'isRevokedwithinallSQLServerdatabasesexcludingthemaster,msdbandtempdb(Scored)

o o

3.3 Ensure'OrphanedUsers'areDroppedFromSQLServerDatabases(Scored) o o

3.4 EnsureSQLAuthenticationisnotusedincontaineddatabases(Scored) o o

3.5 EnsuretheSQLServer'sMSSQLServiceAccountisNotanAdministrator(Scored) o o

3.6 EnsuretheSQLServer’sSQLAgentServiceAccountisNotanAdministrator(Scored) o o

3.7 EnsuretheSQLServer’sFull-TextServiceAccountisNotanAdministrator(Scored) o o

3.8 EnsureonlythedefaultpermissionsspecifiedbyMicrosoftaregrantedtothepublicserverrole(Scored) o o

3.9 EnsureWindowsBUILTINgroupsarenotSQLLogins(Scored) o o

3.10 EnsureWindowslocalgroupsarenotSQLLogins(Scored) o o3.11 Ensurethepublicroleinthemsdbdatabaseisnotgranted

accesstoSQLAgentproxies(Scored) o o

4 PasswordPolicies4.1 Ensure'MUST_CHANGE'Optionissetto'ON'forAllSQL

AuthenticatedLogins(NotScored) o o

4.2 Ensure'CHECK_EXPIRATION'Optionissetto'ON'forAllSQLAuthenticatedLoginsWithintheSysadminRole(Scored)

o o

4.3 Ensure'CHECK_POLICY'Optionissetto'ON'forAllSQLAuthenticatedLogins(Scored) o o

5 AuditingandLogging5.1 Ensure'Maximumnumberoferrorlogfiles'issettogreater

thanorequalto'12'(Scored) o o

5.2 Ensure'DefaultTraceEnabled'ServerConfigurationOptionissetto'1'(Scored) o o

5.3 Ensure'LoginAuditing'issetto'failedlogins'(Scored) o o5.4 Ensure'SQLServerAudit'issettocaptureboth'failed'and

'successfullogins'(Scored) o o

6 ApplicationDevelopment6.1 EnsureSanitizeDatabaseandApplicationUserInputis

Sanitized(NotScored) o o

Page 97: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

96|P a g e

6.2 Ensure'CLRAssemblyPermissionSet'issetto'SAFE_ACCESS'forAllCLRAssemblies(Scored) o o

7 Encryption7.1 Ensure'SymmetricKeyencryptionalgorithm'issetto

'AES_128'orhigherinnon-systemdatabases(Scored) o o

7.2 EnsureAsymmetricKeySizeissetto'greaterthanorequalto2048'innon-systemdatabases(Scored) o o

8 Appendix:AdditionalConsiderations8.1 Ensure'SQLServerBrowserService'isconfiguredcorrectly

(NotScored) o o

Page 98: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

97|P a g e

Appendix:ChangeHistoryDate Version Changesforthisversion

10-09-2015 1.2.0 ConsideraddingrecommendationtodisableSQLServerBrowser.Ticket#104

10-09-2015 1.2.0 Consideraddingrecommendationtouseuniquedomainserviceaccounts.Ticket#105

10-09-2015 1.2.0 ConsideraddingrecommendationtoDropWindowsloginsfromSQLServerinstanceswhentheyareremovedfromActiveDirectory.Ticket#107

10-09-2015 1.2.0 Add"Setthe'CHECK_EXPIRATION'OptiontoONforAllSQLAuthenticatedLoginsWithintheSysadminRole".Ticket#108

10-09-2015 1.2.0 Exceptioninthread"Thread-5"java.lang.NullPointerException.Ticket#120

10-09-2015 1.2.0 ReviewandupdatelinksinreferencestoensurethepointtothecorrectSQLversiondocs.Ticket#126

10-09-2015 1.2.0 MSSQLBenchmark-RecommendChanging5.3toLeverageSQLServerAudit.Ticket#128

10-09-2015 1.2.0 ReducecomplexityofAuditqueryinSection4.2.Ticket#133

10-09-2015 1.2.0 ReducecomplexityofAuditqueryinSection4.3.Ticket#136

Page 99: CIS Microsoft SQL Server 2012 Benchmark v1.4.0 CC · 5 | Page Overview This document, Security Configuration Benchmark for Microsoft SQL Server 2012, provides prescriptive guidance

98|P a g e

10-09-2015 1.2.0 AddClarificationtoRecommendation6.2.Ticket#140

09-30-2016 1.3.0 RemoveSQLServerserviceaccountasmemberofAdministratorsTicket#142

09-30-2016 1.3.0 Add5.1Setthe'Maximumnumberoferrorlogfiles'settingtogreaterthanorequalto12Ticket#143

09-30-2016 1.3.0 FixSQL2012BenchmarkV1.2Recommendation2.12,AuditandRemediationarethesameTicket#145

09-30-2016 1.3.0 Updated2.12Setthe'HideInstance'optionto'Yes'forProductionSQLServerinstancesTicket#149

09-30-2016 1.3.0 UpdatedTitlestoconformtoCISStandard

08-11-2017 1.4.0 MappedCISControlstorecommendations

08-11-2017 1.4.0 Sync’dwith2016Benchmarkwhereappropriate.Formattedtostandards.

08-11-2017 1.4.0 PlannedUpdate