D(HE)ater is a security tool can perform DoS attack by enforcing the DHE key exchange.

Overview

D(HE)ater

D(HE)ater is an attacking tool based on CPU heating in that it forces the ephemeral variant of Diffie-Hellman key exchange (DHE) in given cryptography protocols (e.g. TLS, SSH). It is performed without calculating a cryptographically correct ephemeral key on the client side, but with a significant amount of calculation on the server side. Based on this, D(HE)ater can initiate a denial-of-service (DoS) attack.

Quick start

D(HE)ater can be installed directly via pip from PyPi

pip install dheater
dheat --protocol tls ecc256.badssl.com
dheat --protocol ssh ecc256.badssl.com

or can be used via Docker from Docker Hub

docker pull balasys/dheater
docker run --tty --rm balasys/dheater --protocol tls ecc256.badssl.com
docker run --tty --rm balasys/dheater --protocol ssh ecc256.badssl.com

You can increase load by string extra threads.

dheat --thread-num 4 --protocol tls ecc256.badssl.com
docker run --tty --rm balasys/dheater --thread-num 4 --protocol tls ecc256.badssl.com
docker run --tty --rm balasys/dheater --thread-num 4 --protocol ssh ecc256.badssl.com

Mitigation

Configuration

Diffie-Hellman (DHE) key exchange should be disabled.

TLS

Apache
SSLCipherSuite ...:!kDHE
NGINX
ssl_ciphers ...:!kDHE;
Others

See moz://a SSL Configuration Generator for configuration syntax.

SSH

OpenSSH
KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group1-sha256,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group15-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha256,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha512

Fail2Ban

TLS

Apache

There are no relevant filters.

  1. apache-ssl.conf in fail2ban directory should be copied to the filter.d directory under the fail2ban configuration directory
  2. the followings should be added to the jail.local file in the fail2ban configuration directory
[apache-ssl]

port    = https
logpath = %(apache_error_log)s
maxretry = 1
Postfix

There is a relevant filter, but it is applied only in ddos mode. The followings should be added to jail.local.

[postfix]
mode = ddos
Dovecot

There is a relevant filter, but it is applied only in ddos mode. The followings should be added to jail.local.

[dovecot]
mode = aggressive

or a specific filter can be used without changing the mode of dovecot.

  1. dovecot-ssl.conf in fail2ban directory should be copied to the filter.d directory under the fail2ban configuration directory
  2. the followings should be added to jail.local in tge fail2ban configuration directory
[dovecot-ssl]

port    = pop3,pop3s,imap,imaps,submission,465,sieve
logpath = %(dovecot_log)s
backend = %(dovecot_backend)s
maxretry = 1

SSH

OpenSSH

There is a relevant filter, but it is applied only in ddos mode. The followings should be added to jail.local.

[sshd]
mode = ddos

License

The code is available under the terms of Apache License Version 2.0. A non-comprehensive, but straightforward description and also the full license text can be found at Choose an open source license website.

Comments
  • not able to use

    not able to use

    Hello,

    I'm very new to this cybersecurity field Please anyone help me out with this problem. ### Note I have replace website name with ConfidentialWebsite.com

    When I use tls protocol I'm getting this error :-

    dheat --protocol tls ConfidentialWebsite.com Traceback (most recent call last): File "/usr/local/bin/dheat", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/dheater/main.py", line 512, in main enforcer = DHEnforcerThreadTLS(args.uri, args.timeout, pre_check_result) File "", line 14, in init File "/usr/local/lib/python3.9/dist-packages/dheater/main.py", line 125, in attrs_post_init self._pre_check() File "/usr/local/lib/python3.9/dist-packages/dheater/main.py", line 390, in _pre_check if is_tls_1_3: NameError: name 'is_tls_1_3' is not defined

    When I use ssh protocol I'm getting this error :-

    dheat --protocol ssh ConfidentialWebsite.com
    Network error oocuerd while checking whether Diffie-Hellman ephemeral (DHE) key exchange is supported by the server; uri="ConfidentialWebsite.com", error="connection to target cannot be established"

    AddText_02-02-08 37 54

    bug 
    opened by souravkr529 5
  • It does not run from docker image

    It does not run from docker image

    I have ran the mentioned command: docker run --tty --rm balasys/dheater --protocol ssh ecc256.badssl.com andresulted the following error:

    #docker run --tty --rm balasys/dheater --thread-num 4 --protocol ssh ecc256.badssl.com
    Traceback (most recent call last):
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/common/transfer.py", line 139, in _init_connection
        self._socket = socket.create_connection((self.ip, self.port), self.timeout)
      File "/usr/local/lib/python3.9/socket.py", line 844, in create_connection
        raise err
      File "/usr/local/lib/python3.9/socket.py", line 832, in create_connection
        sock.connect(sa)
    socket.timeout: timed out
     
    The above exception was the direct cause of the following exception:
     
    Traceback (most recent call last):
      File "/usr/local/bin/dheat", line 8, in <module>
        sys.exit(main())
      File "/usr/local/lib/python3.9/site-packages/dheater/__main__.py", line 258, in main
        enforcer = DHEnforcerThreadSSH(args.uri, args.timeout, pre_check_result)
      File "<attrs generated init dheater.__main__.DHEnforcerThreadBase>", line 15, in __init__
      File "/usr/local/lib/python3.9/site-packages/dheater/__main__.py", line 89, in __attrs_post_init__
        self._pre_check()
      File "/usr/local/lib/python3.9/site-packages/dheater/__main__.py", line 117, in _pre_check
        self.pre_check_result = analyzer.analyze(self._get_client())
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/ssh/dhparams.py", line 111, in analyze
        analyzer_result = AnalyzerCiphers().analyze(analyzable)
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/ssh/ciphers.py", line 80, in analyze
        server_messages = analyzable.do_handshake(last_message_type=SshMessageCode.KEXINIT)
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/ssh/client.py", line 111, in do_handshake
        self.init_connection()
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/common/transfer.py", line 251, in init_connection
        self._init_connection()
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/ssh/client.py", line 102, in _init_connection
        self.l4_transfer.init_connection()
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/common/transfer.py", line 73, in init_connection
        self._init_connection()
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/common/transfer.py", line 142, in _init_connection
        six.raise_from(NetworkError(NetworkErrorType.NO_CONNECTION), e)
      File "<string>", line 3, in raise_from
    cryptolyzer.common.exception.NetworkError: connection to target cannot be established
    
    opened by V0072 5
  • Errors trying to connect to target

    Errors trying to connect to target

    @c0r0n3r I can provide wireshark if needed in order to understand why the script fails despite having communication.

    Output: C:\Users\t>dheat --protocol tls gw.t.local Network error oocuerd while checking whether Diffie-Hellman ephemeral (DHE) key exchange is supported by the server; uri="gw.t.local", error="connection to target cannot be established"

    C:\Users\t>dheat --protocol tls gw.t.local Network error oocuerd while checking whether Diffie-Hellman ephemeral (DHE) key exchange is supported by the server; uri="gw.t.local", error="no response received from target"

    question 
    opened by KyferEz 4
  • Does not work

    Does not work

    Either way I run Install it via pip or use it via Docker I get the following error

    ┌──(kali㉿kali)-[~]
    └─$ docker run --tty --rm balasys/dheater --protocol tls domainwhichiownandreachable.com                                                    1 ⨯
    Traceback (most recent call last):
      File "/usr/local/bin/dheat", line 8, in <module>
        sys.exit(main())
      File "/usr/local/lib/python3.9/site-packages/dheater/__main__.py", line 331, in main
        enforcer = DHEnforcerThreadTLS(args.uri, args.timeout, pre_check_result)
      File "<attrs generated init dheater.__main__.DHEnforcerThreadBase>", line 15, in __init__
      File "/usr/local/lib/python3.9/site-packages/dheater/__main__.py", line 100, in __attrs_post_init__
        self._pre_check()
      File "/usr/local/lib/python3.9/site-packages/dheater/__main__.py", line 264, in _pre_check
        server_messages = self._get_client().do_tls_handshake(
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/tls/client.py", line 429, in do_tls_handshake
        return self._do_handshake(
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/tls/client.py", line 409, in _do_handshake
        l7_client.do_handshake(self, hello_message, record_version, last_handshake_message_type)
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/tls/client.py", line 1181, in do_handshake
        self._process_non_handshake_message(record.content_type, message)
      File "/usr/local/lib/python3.9/site-packages/cryptolyzer/tls/client.py", line 1135, in _process_non_handshake_message
        raise TlsAlert(message.description)
    cryptolyzer.tls.exception.TlsAlert: TlsAlert(description=<TlsAlertDescription.HANDSHAKE_FAILURE: 40>)
    
    question 
    opened by rtcms 4
  • gnuTLS support?

    gnuTLS support?

    It seems like it does not work against gnuTLS implementations, but the general problem described in the CVE sounds like it should. Any chance to get it modified for gnuTLS as well...

    bug 
    opened by Lockhead 3
  • Anti-DDoS Mechanism in openssh-8.5p1

    Anti-DDoS Mechanism in openssh-8.5p1

    Once, I also submitted a ddos question to the openssh community: https://bugzilla.mindrot.org/show_bug.cgi?id=3211

    They added the configuration items PerSourceMaxStartups and PerSourceNetBlockSize to openssh-8.5p1. I think that the two parameters can be properly configured to prevent "dheat" from attacking OpenSSH.

    documentation 
    opened by kircherlike 1
  • DHEater crashes on hardened SSH server

    DHEater crashes on hardened SSH server

    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 [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
    
    Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
    
    MACs [email protected],[email protected],umac-128-e[email protected],hmac-sha2-512,hmac-sha2-256,[email protected]
    

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

    Traceback (most recent call last):
      File "/opt/homebrew/Cellar/[email protected]/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/[email protected]/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.

    opened by Nothing4You 1
  • Minimum versions defined for dependencies do not work

    Minimum versions defined for dependencies do not work

    On latest master 09f8cc9597fa0df2c652a760fc4fa4d98d5b6549 I'm getting the following exception:

    pdm run python -m dheater --protocol ssh myhost

    Traceback (most recent call last):
      File "/home/username/.asdf/installs/python/3.10.1/lib/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/home/username/.asdf/installs/python/3.10.1/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File ".../dheater/dheater/__main__.py", line 22, in <module>
        from cryptoparser.tls.ciphersuite import TlsCipherSuite
      File ".../dheater/__pypackages__/3.10/lib/cryptoparser/tls/ciphersuite.py", line 12, in <module>
        from cryptoparser.tls.version import (
      File ".../dheater/__pypackages__/3.10/lib/cryptoparser/tls/version.py", line 24, in <module>
        @attr.s(order=False, eq=False, hash=True)
    TypeError: attrs() got an unexpected keyword argument 'order'
    

    this is on Python 3.10.1 on macOS ARM with the following package versions:

    asn1crypto==1.4.0
    attrs==19.1.0
    certifi==2021.10.8
    certvalidator==0.11.1
    charset-normalizer==2.0.11
    cryptolyzer==0.7.2
    cryptoparser==0.7.1
    idna==3.3
    oscrypto==1.2.1
    python-dateutil==2.8.2
    requests==2.27.1
    six==1.16.0
    urllib3==1.26.8
    
    bug 
    opened by Nothing4You 0
  • software_version must be cryptoparser.ssh.version.SshSoftwareVersionBase

    software_version must be cryptoparser.ssh.version.SshSoftwareVersionBase

    On latest master 09f8cc9597fa0df2c652a760fc4fa4d98d5b6549 I'm getting the following exception:

    pdm run python -m dheater --protocol ssh myhost

    Traceback (most recent call last):
      File "/home/username/.asdf/installs/python/3.10.1/lib/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/home/username/.asdf/installs/python/3.10.1/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File ".../dheater/dheater/__main__.py", line 565, in <module>
        main()
      File ".../dheater/dheater/__main__.py", line 507, in main
        enforcer = DHEnforcerThreadSSH(args.uri, args.timeout, pre_check_result)
      File "<attrs generated init __main__.DHEnforcerThreadBase>", line 14, in __init__
      File ".../dheater/dheater/__main__.py", line 130, in __attrs_post_init__
        self.message_bytes = self._prepare_packets()
      File ".../dheater/dheater/__main__.py", line 232, in _prepare_packets
        protocol_message = SshProtocolMessage(
      File "<attrs generated init cryptoparser.ssh.subprotocol.SshProtocolMessage>", line 7, in __init__
      File ".../dheater/__pypackages__/3.10/lib/attr/validators.py", line 103, in __call__
        raise TypeError(
    TypeError: ("'software_version' must be <class 'cryptoparser.ssh.version.SshSoftwareVersionBase'> (got 'DHEater_0.3.1' that is a <class 'str'>).", Attribute(name='software_version', default=NOTHING, validator=<instance_of validator for type <class 'cryptoparser.ssh.version.SshSoftwareVersionBase'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None), <class 'cryptoparser.ssh.version.SshSoftwareVersionBase'>, 'DHEater_0.3.1')
    

    this is on Python 3.10.1 on macOS ARM with the following package versions:

    asn1crypto==1.4.0
    attrs==21.4.0
    certifi==2021.10.8
    certvalidator==0.11.1
    charset-normalizer==2.0.11
    cryptolyzer==0.8.0
    cryptoparser==0.8.0
    idna==3.3
    oscrypto==1.2.1
    python-dateutil==2.8.2
    requests==2.27.1
    six==1.16.0
    urllib3==1.26.8
    
    bug 
    opened by Nothing4You 0
  • Using IPv6

    Using IPv6

    Hi,

    I am trying to use dheater with an IPv6 address but I always get an error like below:

    python3 -m dheater --protocol tls "[3011::4]:5060"
    Network error oocuerd while checking whether Diffie-Hellman ephemeral (DHE) key exchange is supported by the server; uri="[3011::4]:5060", error="address of the target cannot be resolved"
    

    How should I use or is it some kind of bug?

    opened by VidarHUN 0
Releases(v0.3.2)
Owner
Balasys
Balasys
Simplebot-tg - Telegram/DeltaChat Bridge with python

simplebot_tg Telegram/DeltaChat Bridge, is a plugin for https://github.com/simpl

Arián Díaz Cruz 1 Dec 30, 2021
TonplaceApi - Ton.place api wrapper

tonplaceApi ton.place/tonplaceApi Обертка для ton.place Установка pip install ht

Nickolay Samedov 3 Feb 21, 2022
AWS Workmail Migration Tool

WMigrate A tool for migrating AWS Workmail Users and Groups cross region and cross accounts. It also creates user and group aliases and adds the users

NK 1 Oct 27, 2021
Scripts to help you win the Pizza Express

Slice of the Prizes Slice of the Prizes is a Python Script designed to enter the "Slice of the Action" competition hosted by Pizza Express the competi

Luke Bendall 1 Nov 04, 2021
NFT Generator: A modular NFT generator application

NFT Generator A simple passion project done with the role to learn a bit about h

2 Aug 30, 2022
A simple Facebook Account generator, written in python (needs different Email so Accounts do not get banned)

FacebookAccountGenerator FAB is a Facebook-Account generating script, written in python Installation Use the package manager pip to install selenium p

MrOverload 7 Jan 05, 2023
CRUD database for python discord bot developers that stores data on discord text channels

Discord Database A CRUD (Create Read Update Delete) database for python Discord bot developers. All data is stored in key-value pairs directly on disc

Ankush Singh 7 Oct 22, 2022
An open-source Discord Nuker can be used as a self-bot or a regular bot.

How to use Double click avery.exe, and follow the prompts Features Important! Make sure to use [9] (Scrape Info) before using these, or some things ma

Exortions 3 Jul 03, 2022
Telegram Link Shortener Bot (With 20 Shorteners)

Telegram ShortenerBot ShortenerBot: 🇬🇧 Telegram Link Shortener Bot (11 + 9 Shorteners) 🇹🇷 Telegram Link Kısaltıcı Bot (11 + 9 Kısaltıcı) All suppo

Hüzünlü Artemis [HuzunluArtemis] 10 May 24, 2022
Example notebooks for working with SageMaker Studio Lab. Sign up for an account at the link below!

SageMaker Studio Lab Sample Notebooks Available today in public preview. If you are looking for a no-cost compute environment to run Jupyter notebooks

Amazon Web Services 304 Jan 01, 2023
Cookies is a project inspired by python cookiecutter but used for terraform generation.

Introduction Cookies is a project inspired by python cookiecutter but used for terraform generation. How to run your terraform After you download your

Digger 6 Mar 14, 2022
A mood based crypto tracking application.

Crypto Bud - API A mood based crypto tracking application. The main repository is private. I am creating the API before I connect everything to the ma

Krishnasis Mandal 1 Oct 23, 2021
music recommend chat bot

Your Song A chat bot who can recommend music for you. Project Documents https://drive.google.com/drive/folders/1zbHbuRyrUgMrO-LtDXrXwqycN_ysuAUx Dir I

4 Mar 27, 2022
A python script to acquire multiple aws ec2 instances in a forensically sound-ish way

acquire_ec2.py The script acquire_ec2.py is used to automatically acquire AWS EC2 instances. The script needs to be run on an EC2 instance in the same

Deutsche Telekom Security GmbH 31 Sep 10, 2022
Python async SDK for betsapi.com

Python async SDK for betsapi.com

1 Dec 21, 2021
Telegram tools

Telegram-Tools Telegram tools. Explanation English | 中文 Features Export group memebrs Add users to the group Send message to users Setup API Open http

4 Apr 02, 2022
A pypi packages finder telegram bot.

PyPi-Bot A pypi packages information finder telegram bot. Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https:

Fayas Noushad 17 Oct 21, 2022
a simple quant trading bot with CLI interface

shepherd a simple quant trading bot with CLI interface CLI shell command docs coming soon after I brush up the code and add more features :) Minimal R

m00n 0 Jun 06, 2022
Offline reverse geocoder in Python using sqlite3

rgeocode Offline reverse geocoder rgeocode accepts a geographic coordinate pair (latitude and longitude) and returns a list containing the name of: A

Venkat 7 Dec 01, 2021
A VCVideoPlayer Bot for Telegram made with 💞 By @ProErrorXD

VC Video Player How To Host ✨ Heroku Deploy ✨ The easiest way to deploy this Bot is via Heroku. Credit 🔥 |🇮🇳 Louis |🇮🇳 Sammy |🇮🇳 Blaze Marsha

丂ムᄊᄊƳ 95 May 17, 2022