@@ -699,11 +699,18 @@ public static void CollectSecurity(DataSet ds)
699699 // Lanman compatibility Level - affects NTLM connections but not Kerberos connections
700700 //
701701
702- string lanmanCompatibilityLevel = Utility . GetRegistryValueAsString ( @"HKLM\SYSTEM\CurrentControlSet\Control\Lsa" , "LMCompatibilityLevel" , RegistryValueKind . DWord , 0 ) ;
703- string lanmanDesc = Utility . LanmanNames ( lanmanCompatibilityLevel ) ;
704- Security [ "LanmanCompatibilityLevel" ] = lanmanDesc == "" ? lanmanCompatibilityLevel : $ "{ lanmanCompatibilityLevel } ({ lanmanDesc } )";
705- Security . CheckRange ( "LanmanCompatibilityLevel" , lanmanCompatibilityLevel , 0 , 7 ) ;
706- if ( lanmanCompatibilityLevel . CompareTo ( "3" ) < 0 ) Security . LogWarning ( "LanmanCompatibilityLevel: The setting may be too low." ) ;
702+ string lanmanCompatibilityLevel = Utility . GetRegistryValueAsString ( @"HKLM\SYSTEM\CurrentControlSet\Control\Lsa" , "LMCompatibilityLevel" , RegistryValueKind . DWord , "" ) ;
703+ if ( lanmanCompatibilityLevel == "" )
704+ {
705+ Security [ "LanmanCompatibilityLevel" ] = $ "Not specified - default: 5 ({ Utility . LanmanNames ( "5" ) } )";
706+ }
707+ else
708+ {
709+ string lanmanDesc = Utility . LanmanNames ( lanmanCompatibilityLevel ) ;
710+ Security [ "LanmanCompatibilityLevel" ] = lanmanDesc == "" ? lanmanCompatibilityLevel : $ "{ lanmanCompatibilityLevel } ({ lanmanDesc } )";
711+ Security . CheckRange ( "LanmanCompatibilityLevel" , lanmanCompatibilityLevel , 0 , 7 ) ;
712+ if ( lanmanCompatibilityLevel . CompareTo ( "3" ) < 0 ) Security . LogWarning ( "LanmanCompatibilityLevel: The setting may be too low." ) ;
713+ }
707714
708715
709716 //
@@ -926,13 +933,31 @@ public static void CollectProtocolOrder(DataSet ds)
926933 if ( prot != null )
927934 {
928935 string [ ] po = ( string [ ] ) prot ;
936+ // RegStrings is before the annotation
929937 ProtocolOrder [ "RegistryList" ] = string . Join ( "," , po ) ;
930938 }
931939
932940 // From HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002 ! Functions REG_SZ, comma-delimited
933941
934- ProtocolOrder [ "PolicyList" ] = Registry . GetValue ( @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002" , "Functions" , null ) ;
942+ prot = Registry . GetValue ( @"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002" , "Functions" , null ) ;
935943
944+ if ( prot != null )
945+ {
946+ string [ ] po = ( string [ ] ) prot ;
947+ // RegStrings is before the annotation
948+ ProtocolOrder [ "PolicyList" ] = string . Join ( "," , po ) ;
949+
950+ // Warn if the Protocol List has entries that arent in the ReistryList
951+ if ( po . Length > 0 )
952+ {
953+ string [ ] RegStrings = ProtocolOrder . GetString ( "RegistryList" ) . Trim ( ) . Split ( ',' ) ;
954+ string [ ] PolStrings = ProtocolOrder . GetString ( "PolicyList" ) . Trim ( ) . Split ( ',' ) ;
955+ var comp = new StringIgnoreCaseComparer ( ) ;
956+ var ExtraStrings = PolStrings . Except ( RegStrings , comp ) ;
957+ ExtraStrings . ToList ( ) . ForEach ( s => ProtocolOrder . LogWarning ( $ "Cipher Suite '{ s } ' appears in the Protocol List but not in the Registry List.") ) ;
958+ }
959+ }
960+
936961 // Warn if the Protocol List has entries that arent in the ReistryList
937962 if ( ProtocolOrder . GetString ( "PolicyList" ) . Trim ( ) . Length > 0 )
938963 {
@@ -1750,7 +1775,8 @@ public static void CollectProcessDrivers(DataSet ds)
17501775 "msodbcsql11.dll" , "msodbcsql13.dll" , "msodbcsql17.dll" , "msoledbsql.dll" , "sqlnclirda11.dll" ,
17511776 // some non SQL driver DLLs
17521777 "aceodbc.dll" , "aceoledb.dll" , "msolap.dll" , "activeds.dll" , "odbcjt32.dll" ,
1753- "msjetoledb40.dll" , "ibmdadb2.dll" , "ibmdadb264.dll" , "system.data.entity.dll" , "system.data.oracleclient.dll"
1778+ "msjetoledb40.dll" , "ibmdadb2.dll" , "ibmdadb264.dll" , "system.data.entity.dll" , "system.data.oracleclient.dll" ,
1779+ "microsoft.data.sqlclient.dll" , "java.exe" , "jvm.dll" , "javaw.exe"
17541780 } ;
17551781
17561782 // get command results - output the data in CSV format, 3 columns; the last has sub-columns in it
@@ -1859,7 +1885,7 @@ public static void CollectSQLAlias(DataSet ds)
18591885 RegistryKey aliasKey = null ;
18601886 string [ ] aliases = null , parts = null ;
18611887 bool is64bit = Computer [ "CPU64Bit" ] . ToBoolean ( ) ;
1862- string [ ] regPath = new string [ ] { @"SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo" , @"SOFTWARE\WOW6432Node\MSSQLServer\Client\ConnectTo" } ;
1888+ string [ ] regPath = new string [ ] { @"SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo" , @"SOFTWARE\WOW6432Node\Microsoft\ MSSQLServer\Client\ConnectTo" } ;
18631889 int loopCount = is64bit ? 2 : 1 ; // only look to Wow64 registry path if on a 64-bit system
18641890 string redirectsTo = "" ;
18651891
@@ -2271,7 +2297,7 @@ public static void CollectSPNAccount(DataSet ds)
22712297 int NOT_DELEGATED = 1048576 ; // 0x00100000
22722298 int USE_DES_KEY_ONLY = 2097152 ; // 0x00200000
22732299 int PASSWORD_EXPIRED = 8388608 ; // 0x00800000
2274- int TRUSTED_TO_AUTH_FOR_DELEGATION = 16777216 ; // 0x01000000
2300+ int TRUSTED_TO_AUTH_FOR_DELEGATION = 16777216 ; // 0x01000000 allow protocol transition - we aren't distinguishing this right now
22752301
22762302 DataRow Computer = ds . Tables [ "Computer" ] . Rows [ 0 ] ;
22772303 DataRow SPNAccount = null ;
@@ -2401,7 +2427,7 @@ public static void CollectSPNAccount(DataSet ds)
24012427 CollectSPN ( ds , SPNAccount , entry . Path ) ;
24022428
24032429 // Get constrained delegation SPNs for this account
2404- bool constrained = entry . Properties [ "msDS-AllowedToDelegateTo" ] . Count > 0 ;
2430+ bool constrained = ( entry . Properties [ "msDS-AllowedToDelegateTo" ] . Count > 0 ) ;
24052431 SPNAccount [ "ConstrainedDelegationEnabled" ] = constrained ;
24062432 if ( constrained ) // get SPNs for constrained delegation
24072433 {
@@ -3191,14 +3217,14 @@ public static void ProcessSQLPathAndSPNs(DataSet ds, DataRow SQLInstance, DataRo
31913217 SuggestedSPN = dtSuggestedSPN . NewRow ( ) ;
31923218 dtSuggestedSPN . Rows . Add ( SuggestedSPN ) ;
31933219 SuggestedSPN [ "ParentID" ] = SQLServer [ "ID" ] ;
3194- suggestedSPN = $@ "{ spnPrefixF } :{ portNumber } "; // FQDN
3220+ suggestedSPN = $@ "{ spnPrefixF } :{ portNumber . Trim ( ) } "; // FQDN
31953221 SuggestedSPN [ "SPNNAme" ] = suggestedSPN ;
31963222 CheckSPN ( ds , SQLServer , SuggestedSPN , suggestedSPN , SPNServiceAccount ) ;
31973223
31983224 SuggestedSPN = dtSuggestedSPN . NewRow ( ) ;
31993225 dtSuggestedSPN . Rows . Add ( SuggestedSPN ) ;
32003226 SuggestedSPN [ "ParentID" ] = SQLServer [ "ID" ] ;
3201- suggestedSPN = $@ "{ spnPrefixN } :{ portNumber } "; // NETBIOS name
3227+ suggestedSPN = $@ "{ spnPrefixN } :{ portNumber } .Trim() "; // NETBIOS name
32023228 SuggestedSPN [ "SPNNAme" ] = suggestedSPN ;
32033229 CheckSPN ( ds , SQLServer , SuggestedSPN , suggestedSPN , SPNServiceAccount ) ;
32043230 }
0 commit comments