@@ -40,23 +40,26 @@ class SessionRenegotiationScanResult(ScanCommandResult):
4040 Attributes:
4141 accepts_client_renegotiation: True if the server honors client-initiated renegotiation attempts.
4242 supports_secure_renegotiation: True if the server supports secure renegotiation.
43+ client_renegotiations_success_count: the number of successful client-initiated renegotiation attempts.
4344 """
4445
4546 supports_secure_renegotiation : bool
4647 is_vulnerable_to_client_renegotiation_dos : bool
48+ client_renegotiations_success_count : int
4749
4850
4951class SessionRenegotiationScanResultAsJson (BaseModelWithOrmModeAndForbid ):
5052 supports_secure_renegotiation : bool
5153 is_vulnerable_to_client_renegotiation_dos : bool
54+ client_renegotiations_success_count : int
5255
5356
5457class SessionRenegotiationScanAttemptAsJson (ScanCommandAttemptAsJson ):
5558 result : Optional [SessionRenegotiationScanResultAsJson ]
5659
5760
5861class _ScanJobResultEnum (Enum ):
59- IS_VULNERABLE_TO_CLIENT_RENEG_DOS = 1
62+ CLIENT_RENEG_RESULT = 1
6063 SUPPORTS_SECURE_RENEG = 2
6164
6265
@@ -87,7 +90,9 @@ def result_to_console_output(cls, result: SessionRenegotiationScanResult) -> Lis
8790 return result_txt
8891
8992
90- class SessionRenegotiationImplementation (ScanCommandImplementation [SessionRenegotiationScanResult , None ]):
93+ class SessionRenegotiationImplementation (
94+ ScanCommandImplementation [SessionRenegotiationScanResult , SessionRenegotiationExtraArgument ]
95+ ):
9196 """Test a server for insecure TLS renegotiation and client-initiated renegotiation."""
9297
9398 cli_connector_cls = _SessionRenegotiationCliConnector
@@ -118,11 +123,13 @@ def result_for_completed_scan_jobs(
118123 result_enum , value = job .get_result ()
119124 results_dict [result_enum ] = value
120125
126+ is_vulnerable_to_client_renegotiation_dos , client_renegotiations_success_count = results_dict [
127+ _ScanJobResultEnum .CLIENT_RENEG_RESULT
128+ ]
121129 return SessionRenegotiationScanResult (
122- is_vulnerable_to_client_renegotiation_dos = results_dict [
123- _ScanJobResultEnum .IS_VULNERABLE_TO_CLIENT_RENEG_DOS
124- ],
130+ is_vulnerable_to_client_renegotiation_dos = is_vulnerable_to_client_renegotiation_dos ,
125131 supports_secure_renegotiation = results_dict [_ScanJobResultEnum .SUPPORTS_SECURE_RENEG ],
132+ client_renegotiations_success_count = client_renegotiations_success_count ,
126133 )
127134
128135
@@ -163,9 +170,10 @@ def _test_secure_renegotiation(server_info: ServerConnectivityInfo) -> Tuple[_Sc
163170
164171def _test_client_renegotiation (
165172 server_info : ServerConnectivityInfo , client_renegotiation_attempts : int
166- ) -> Tuple [_ScanJobResultEnum , bool ]:
173+ ) -> Tuple [_ScanJobResultEnum , Tuple [ bool , int ] ]:
167174 """Check whether the server honors session renegotiation requests."""
168175 # Try with TLS 1.2 even if the server supports TLS 1.3 or higher as there is no reneg with TLS 1.3
176+ client_renegotiations_success_count = 0
169177 if server_info .tls_probing_result .highest_tls_version_supported .value >= TlsVersionEnum .TLS_1_3 .value :
170178 tls_version_to_use = TlsVersionEnum .TLS_1_2
171179 downgraded_from_tls_1_3 = True
@@ -198,6 +206,7 @@ def _test_client_renegotiation(
198206 # https://github.com/nabla-c0d3/sslyze/issues/473
199207 for i in range (client_renegotiation_attempts ):
200208 ssl_connection .ssl_client .do_renegotiate ()
209+ client_renegotiations_success_count += 1
201210 accepts_client_renegotiation = True
202211
203212 # Errors caused by a server rejecting the renegotiation
@@ -246,4 +255,4 @@ def _test_client_renegotiation(
246255 finally :
247256 ssl_connection .close ()
248257
249- return _ScanJobResultEnum .IS_VULNERABLE_TO_CLIENT_RENEG_DOS , accepts_client_renegotiation
258+ return _ScanJobResultEnum .CLIENT_RENEG_RESULT , ( accepts_client_renegotiation , client_renegotiations_success_count )
0 commit comments