4elta / recon

automate the boring stuff!
GNU General Public License v3.0
8 stars 3 forks source link

TLS analyzer with nmap fails on SSLv3 enabled host with KeyError: 'SSLv3' #55

Closed ikstream closed 1 year ago

ikstream commented 1 year ago

When analyzing tls nmap files it fails on SSLv3 enabled hosts. A KeyError: 'SSLv3' exception is thrown:

python analyze.py -i /logs/recon tls -t nmap        

Traceback (most recent call last):
  File "/recon/./analyze.py", line 178, in <module>
    main()
  File "/recon/./analyze.py", line 175, in main
    process(parser.parse_args())
  File "/recon/./analyze.py", line 127, in process
    analyze_service(
  File "/recon/./analyze.py", line 43, in analyze_service
    services = analyzer.analyze(files)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/recon/analyzers/tls/__init__.py", line 111, in analyze
    services = self.parser.parse_files(files[self.parser_name])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/recon/analyzers/__init__.py", line 25, in parse_files
    self.parse_file(path)
  File "/recon/analyzers/tls/nmap.py", line 109, in parse_file
    self._parse_cipher_suites(script_node, service)
  File "/recon/analyzers/tls/nmap.py", line 231, in _parse_cipher_suites
    self._parse_protocol_node(
  File "/recon/analyzers/tls/nmap.py", line 186, in _parse_protocol_node
    protocol_version = PROTOCOL_VERSIONS[node.get('key')]
                       ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'SSLv3'

Here is the probably relevant excempt from the corresponding file, let me know if you need more.

[...]
</script><script id="ssl-enum-ciphers" output="&#xa;  SSLv3: &#xa;    ciphers: &#xa;      TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C&#xa;    compressors: &#xa;      NULL&#xa;    cipher preference: server&#xa;    warnings: &#xa;      64-bit block cipher 3DES vulnerable to SWEET32 attack&#xa;      Broken cipher RC4 is deprecated by RFC 7465&#xa;      CBC-mode cipher in SSLv3 (CVE-2014-3566)&#xa;      Ciphersuite uses MD5 for message integrity&#xa;      Forward Secrecy not supported by any cipher&#xa;  TLSv1.0: &#xa;    ciphers: &#xa;      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A&#xa;      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A&#xa;      TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 1024) - A&#xa;      TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 1024) - A&#xa;      TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A&#xa;      TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C&#xa;    compressors: &#xa;      NULL&#xa;    cipher preference: server&#xa;    warnings: &#xa;      64-bit block cipher 3DES vulnerable to SWEET32 attack&#xa;      Broken cipher RC4 is deprecated by RFC 7465&#xa;      Ciphersuite uses MD5 for message integrity&#xa;      Key exchange (dh 1024) of lower strength than certificate key&#xa;  TLSv1.1: &#xa;    ciphers: &#xa;      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A&#xa;      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A&#xa;      TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 1024) - A&#xa;      TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 1024) - A&#xa;      TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A&#xa;      TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C&#xa;    compressors: &#xa;      NULL&#xa;    cipher preference: server&#xa;    warnings: &#xa;      64-bit block cipher 3DES vulnerable to SWEET32 attack&#xa;      Broken cipher RC4 is deprecated by RFC 7465&#xa;      Ciphersuite uses MD5 for message integrity&#xa;      Key exchange (dh 1024) of lower strength than certificate key&#xa;  TLSv1.2: &#xa;    ciphers: &#xa;      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (secp256r1) - A&#xa;      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (secp256r1) - A&#xa;      TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (secp256r1) - A&#xa;      TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (secp256r1) - A&#xa;      TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (dh 1024) - A&#xa;      TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (dh 1024) - A&#xa;      TLS_DHE_RSA_WITH_AES_256_CBC_SHA (dh 1024) - A&#xa;      TLS_DHE_RSA_WITH_AES_128_CBC_SHA (dh 1024) - A&#xa;      TLS_RSA_WITH_AES_256_GCM_SHA384 (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_128_GCM_SHA256 (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_256_CBC_SHA256 (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_128_CBC_SHA256 (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_256_CBC_SHA (rsa 2048) - A&#xa;      TLS_RSA_WITH_AES_128_CBC_SHA (rsa 2048) - A&#xa;      TLS_RSA_WITH_3DES_EDE_CBC_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_SHA (rsa 2048) - C&#xa;      TLS_RSA_WITH_RC4_128_MD5 (rsa 2048) - C&#xa;    compressors: &#xa;      NULL&#xa;    cipher preference: server&#xa;    warnings: &#xa;      64-bit block cipher 3DES vulnerable to SWEET32 attack&#xa;      Broken cipher RC4 is deprecated by RFC 7465&#xa;      Ciphersuite uses MD5 for message integrity&#xa;      Key exchange (dh 1024) of lower strength than certificate key&#xa;  least strength: C"><table key="SSLv3">
<table key="ciphers">
<table>
<elem key="name">TLS_RSA_WITH_3DES_EDE_CBC_SHA</elem>
<elem key="strength">C</elem>
<elem key="kex_info">rsa 2048</elem>
</table>
<table>
<elem key="name">TLS_RSA_WITH_RC4_128_SHA</elem>
<elem key="strength">C</elem>
<elem key="kex_info">rsa 2048</elem>
</table>
<table>
<elem key="name">TLS_RSA_WITH_RC4_128_MD5</elem>
<elem key="strength">C</elem>
<elem key="kex_info">rsa 2048</elem>
</table>
</table>
<table key="compressors">
<elem>NULL</elem>
</table>
<elem key="cipher preference">server</elem>
<table key="warnings">
<elem>64-bit block cipher 3DES vulnerable to SWEET32 attack</elem>
<elem>Broken cipher RC4 is deprecated by RFC 7465</elem>
<elem>CBC-mode cipher in SSLv3 (CVE-2014-3566)</elem>
<elem>Ciphersuite uses MD5 for message integrity</elem>
<elem>Forward Secrecy not supported by any cipher</elem>
</table>
</table>
<table key="TLSv1.0">
[...]

BR

4elta commented 1 year ago

thanks for this report. i have updated the transformation for the protocol version string (e.g. SSLv# -> SSL #.0).

please update to version 1.4.3