Skip to main content

Use of an insecure channel - useSslProtocol()

Description

The application uses useSslProtocol() function, which allows the trust manager to trust all server certificates presented to it, this is convenient for local development, but is not recommended for use in production, as it does not provide protection against man-in-the-middle attacks.

Impact

Intercept sensitive information over an insecure channel.

Recommendation

Preferably make use of useSslProtocol(SSLContext).

Threat

Anonymous attacker on the internal network running a MitM.

Expected Remediation Time

⌚ 15 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: A
  • Attack complexity: H
  • Privileges required: N
  • User interaction: R
  • Scope: U
  • Confidentiality: L
  • Integrity: N
  • Availability: N

Temporal

  • Exploit code madurity: P
  • Remediation level: O
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:A/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N/E:P/RL:O/RC:X
  • Score:
    • Base: 2.6
    • Temporal: 2.4
  • Severity:
    • Base: Low
    • Temporal: Low

Code Examples

Compliant code

The application uses safe communication channels

sock = tcp_connect(host, port, intention)
ssl_ctx = ssl.SSLContext(protocol=TLSv1.3)
ssl_protocol = useSslProtocol(SSLContext = ssl_ctx)
ssl_sock = ssl_ctx.wrap_socket(sock, do_handshake_on_connect=False)
try:
ssl_sock.do_handshake()
except ConnectionResetError as error:
socket_has_errors = True
return None
return ssl_sock

Non compliant code

The application uses unsafe communication channels, like the useSslProtocol without a defined Context

sock = tcp_connect(host, port, intention)
ssl_ctx = ssl.SSLContext()
ssl_protocol = useSslProtocol()
ssl_sock = ssl_ctx.wrap_socket(sock, do_handshake_on_connect=False)
try:
ssl_sock.do_handshake()
except ConnectionResetError as error:
socket_has_errors = True
return None
return ssl_sock

Requirements