55 * @problem.severity error
66 * @security-severity 7.5
77 * @precision high
8- * @id powershell/microsoft/security/ deprecated-tls
8+ * @id powershell/deprecated-tls
99 * @tags security
1010 * external/cwe/cwe-327
1111 * external/cwe/cwe-757
@@ -15,13 +15,6 @@ import powershell
1515import semmle.code.powershell.ApiGraphs
1616import semmle.code.powershell.dataflow.DataFlow
1717
18- /**
19- * Holds if `protocolName` is a deprecated TLS/SSL protocol (lowercase).
20- */
21- predicate isDeprecatedProtocol ( string protocolName ) {
22- protocolName = [ "ssl3" , "tls" , "tls11" ]
23- }
24-
2518/**
2619 * Gets the human-readable name for a deprecated protocol.
2720 */
@@ -34,11 +27,15 @@ string getProtocolDisplayName(string protocolName) {
3427 protocolName = "tls11" and result = "TLS 1.1"
3528}
3629
30+ abstract class SecurityProtocol extends Expr {
31+ abstract string getProtocolName ( ) ;
32+ }
33+
3734/**
3835 * A reference to a deprecated SecurityProtocolType enum value, e.g.
3936 * [Net.SecurityProtocolType]::Ssl3
4037 */
41- class DeprecatedSecurityProtocolType extends DataFlow :: Node {
38+ class DeprecatedSecurityProtocolType extends SecurityProtocol {
4239 string protocolName ;
4340
4441 DeprecatedSecurityProtocolType ( ) {
@@ -55,19 +52,18 @@ class DeprecatedSecurityProtocolType extends DataFlow::Node {
5552 .getMember ( "securityprotocoltype" )
5653 .getMember ( protocolName )
5754 ) and
58- this = node .asSource ( ) and
59- isDeprecatedProtocol ( protocolName )
55+ this = node .asSource ( ) .asExpr ( ) .getExpr ( )
6056 )
6157 }
6258
63- string getProtocolName ( ) { result = protocolName }
59+ override string getProtocolName ( ) { result = protocolName }
6460}
6561
6662/**
6763 * A reference to a deprecated SslProtocols enum value, e.g.
6864 * [System.Security.Authentication.SslProtocols]::Tls
6965 */
70- class DeprecatedSslProtocols extends DataFlow :: Node {
66+ class DeprecatedSslProtocols extends SecurityProtocol {
7167 string protocolName ;
7268
7369 DeprecatedSslProtocols ( ) {
@@ -78,21 +74,17 @@ class DeprecatedSslProtocols extends DataFlow::Node {
7874 .getMember ( "authentication" )
7975 .getMember ( "sslprotocols" )
8076 .getMember ( protocolName ) and
81- this = node .asSource ( ) and
82- isDeprecatedProtocol ( protocolName )
77+ this = node .asSource ( ) .asExpr ( ) .getExpr ( )
8378 )
8479 }
8580
86- string getProtocolName ( ) { result = protocolName }
81+ override string getProtocolName ( ) { result = protocolName }
8782}
8883
89- from DataFlow :: Node node , string protocolName
84+ from SecurityProtocol sp , string protocolName
9085where
91- exists ( DeprecatedSecurityProtocolType d |
92- node = d and protocolName = d .getProtocolName ( )
93- )
94- or
95- exists ( DeprecatedSslProtocols d | node = d and protocolName = d .getProtocolName ( ) )
96- select node ,
86+ protocolName = sp .getProtocolName ( ) and
87+ protocolName = [ "ssl3" , "tls" , "tls11" ]
88+ select sp ,
9789 "Use of deprecated protocol " + getProtocolDisplayName ( protocolName ) +
9890 ". Use TLS 1.2 or TLS 1.3 instead."
0 commit comments