bandit/examples/ssl-insecure-version.py
Ian Cordasco 09f0fa9ce7 Remove the check for PROTOCOL_SSLv23
PROTOCOL_SSLv23 is a constant (admittedly poorly named) that will always
negotiate the highest protocol version that both the client and server
support. It will, for example, negotiate TLSv1.2 if both client and
server can use it. Calling it out as "insecure" is patently wrong.

Change-Id: Ie4f16bee35e7e8be2c6e55e28384d2c6c554d249
2015-02-12 11:33:26 -06:00

37 lines
892 B
Python

import ssl
from pyOpenSSL import SSL
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2)
SSL.Context(method=SSL.SSLv2_METHOD)
SSL.Context(method=SSL.SSLv23_METHOD)
herp_derp(ssl_version=ssl.PROTOCOL_SSLv2)
herp_derp(method=SSL.SSLv2_METHOD)
herp_derp(method=SSL.SSLv23_METHOD)
# strict tests
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3)
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1)
SSL.Context(method=SSL.SSLv3_METHOD)
SSL.Context(method=SSL.TLSv1_METHOD)
herp_derp(ssl_version=ssl.PROTOCOL_SSLv3)
herp_derp(ssl_version=ssl.PROTOCOL_TLSv1)
herp_derp(method=SSL.SSLv3_METHOD)
herp_derp(method=SSL.TLSv1_METHOD)
ssl.wrap_socket()
def open_ssl_socket(version=ssl.PROTOCOL_SSLv2):
pass
def open_ssl_socket(version=SSL.SSLv2_METHOD):
pass
def open_ssl_socket(version=SSL.SSLv23_METHOD):
pass
# this one will pass ok
def open_ssl_socket(version=SSL.TLSv1_1_METHOD):
pass