[go: up one dir, main page]

DHEater crashes on hardened SSH server

Created by: Nothing4You

I just tested this against one of my machines. After bringing my cpu load up to ~70% I tried if I could mitigate this in my sshd by enabling the "modern" hardened configuration as recommended by Mozilla: https://infosec.mozilla.org/guidelines/openssh

Effectively I disabled non-ed25519 hostkeys and enabled the following settings:

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256

Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr

MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com

Once I reloaded my sshd dheater crashes with the following error:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/rsc/dev/dheater/dheater/__main__.py", line 346, in <module>
    main()
  File "/Users/rsc/dev/dheater/dheater/__main__.py", line 259, in main
    enforcer = DHEnforcerThreadSSH(args.uri, args.timeout, pre_check_result)
  File "<attrs generated init __main__.DHEnforcerThreadBase>", line 15, in __init__
  File "/Users/rsc/dev/dheater/dheater/__main__.py", line 93, in __attrs_post_init__
    self.message_bytes = self._prepare_packets()
  File "/Users/rsc/dev/dheater/dheater/__main__.py", line 153, in _prepare_packets
    key_exchange_algorithm_with_greatest_key_size = self._get_algorithm_with_greatest_key_size()
  File "/Users/rsc/dev/dheater/dheater/__main__.py", line 131, in _get_algorithm_with_greatest_key_size
    if self.pre_check_result.key_exchange.kex_algorithms:
AttributeError: 'NoneType' object has no attribute 'kex_algorithms'

command used: python -m dheater --protocol ssh myhost

I haven't bothered looking into this further, but if this disables the required DHE (looks like there's already a check for TLS) this should also be listed as possible mitigation and a message should be shown instead of the exception.