Lucene search
+L

Diffie-Hellman Ephemeral Key Exchange DoS Vulnerability (SSH, D(HE)ater)

🗓️ 16 Dec 2021 00:00:00Reported by Copyright (C) 2021 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 343 Views

The SSH server has a vulnerability in supporting Diffie-Hellman ephemeral (DHE) Key Exchange (KEX) algorithms that could be prone to a denial of service (DoS)

Related
Refs
Code
# SPDX-FileCopyrightText: 2021 Greenbone AG
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-only

if(description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.117839");
  script_version("2024-10-03T05:05:33+0000");
  script_cve_id("CVE-2002-20001", "CVE-2022-40735", "CVE-2024-41996");
  script_tag(name:"last_modification", value:"2024-10-03 05:05:33 +0000 (Thu, 03 Oct 2024)");
  script_tag(name:"creation_date", value:"2021-12-16 10:47:19 +0000 (Thu, 16 Dec 2021)");
  script_tag(name:"cvss_base", value:"5.0");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:P");
  script_tag(name:"severity_vector", value:"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H");
  script_tag(name:"severity_origin", value:"NVD");
  script_tag(name:"severity_date", value:"2021-11-16 15:36:00 +0000 (Tue, 16 Nov 2021)");
  script_name("Diffie-Hellman Ephemeral Key Exchange DoS Vulnerability (SSH, D(HE)ater)");
  script_copyright("Copyright (C) 2021 Greenbone AG");
  script_category(ACT_GATHER_INFO);
  script_family("SSL and TLS");
  script_dependencies("gb_ssh_algos.nasl");
  script_require_ports("Services/ssh", 22);
  script_mandatory_keys("ssh/algos_available");

  script_xref(name:"URL", value:"https://dheatattack.gitlab.io/");
  script_xref(name:"URL", value:"https://dheatattack.gitlab.io/details/");
  script_xref(name:"URL", value:"https://www.researchgate.net/profile/Anton-Stiglic-2/publication/2401745_Security_Issues_in_the_Diffie-Hellman_Key_Agreement_Protocol");
  script_xref(name:"URL", value:"https://github.com/Balasys/dheater");
  script_xref(name:"URL", value:"https://github.com/c0r0n3r/dheater");

  script_tag(name:"summary", value:"The remote SSH server is supporting Diffie-Hellman ephemeral
  (DHE) Key Exchange (KEX) algorithms and thus could be prone to a denial of service (DoS)
  vulnerability.");

  script_tag(name:"vuldetect", value:"Checks the supported KEX algorithms of the remote SSH
  server.");

  script_tag(name:"insight", value:"- CVE-2002-20001: The Diffie-Hellman Key Agreement Protocol
  allows remote attackers (from the client side) to send arbitrary numbers that are actually not
  public keys, and trigger expensive server-side DHE modular-exponentiation calculations, aka a
  D(HE)ater attack. The client needs very little CPU resources and network bandwidth. The attack may
  be more disruptive in cases where a client can require a server to select its largest supported
  key size. The basic attack scenario is that the client must claim that it can only communicate
  with DHE, and the server must be configured to allow DHE.

  - CVE-2022-40735: The Diffie-Hellman Key Agreement Protocol allows use of long exponents that
  arguably make certain calculations unnecessarily expensive, because the 1996 van Oorschot and
  Wiener paper found that '(appropriately) short exponents' can be used when there are adequate
  subgroup constraints, and these short exponents can lead to less expensive calculations than for
  long exponents. This issue is different from CVE-2002-20001 because it is based on an observation
  about exponent size, rather than an observation about numbers that are not public keys. The
  specific situations in which calculation expense would constitute a server-side vulnerability
  depend on the protocol (e.g., TLS, SSH, or IKE) and the DHE implementation details. In general,
  there might be an availability concern because of server-side resource consumption from DHE
  modular-exponentiation calculations. Finally, it is possible for an attacker to exploit this
  vulnerability and CVE-2002-20001 together.

  - CVE-2024-41996: Validating the order of the public keys in the Diffie-Hellman Key Agreement
  Protocol, when an approved safe prime is used, allows remote attackers (from the client side) to
  trigger unnecessarily expensive server-side DHE modular-exponentiation calculations. The client
  may cause asymmetric resource consumption. The basic attack scenario is that the client must claim
  that it can only communicate with DHE, and the server must be configured to allow DHE and validate
  the order of the public key.");

  script_tag(name:"impact", value:"This vulnerability allows remote attackers (from the client side)
  to send arbitrary numbers that are actually not public keys, and trigger expensive server-side DHE
  modular-exponentiation calculations, also known as a D(HE)ater attack.

  There could be an increase in CPU usage in the affected component. For OpenSSH, users may observe
  issues such as a slowdown in SSH connections.");

  script_tag(name:"solution", value:"- DHE key exchange should be disabled if no other mitigation
  mechanism can be used and either elliptic-curve variant of Diffie-Hellman (ECDHE) or RSA key
  exchange is supported by the clients. The fact that RSA key exchange is not forward secret should
  be considered.

  - Limit the maximum number of concurrent connections in e.g. the configuration of the remote
  server. For OpenSSH this limit can be configured via the 'MaxStartups' option, for other products
  please refer to the manual of the product in question on configuration possibilities.");

  script_tag(name:"qod_type", value:"remote_banner_unreliable");
  script_tag(name:"solution_type", value:"Mitigation");

  exit(0);
}

include("ssh_func.inc");
include("list_array_func.inc");
include("port_service_func.inc");
include("misc_func.inc");
include("host_details.inc");

port = ssh_get_port( default:22 );

if( ! supported_kex_algos = get_kb_list( "ssh/" + port + "/kex_algorithms" ) )
  exit( 0 );

# Sort to not report changes on delta reports if just the order is different
supported_kex_algos = sort( supported_kex_algos );

dhe_kex_algos = make_list(
  "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" );

report = 'The remote SSH server supports the following DHE KEX algorithm(s):\n';

foreach dhe_kex_algo( dhe_kex_algos ) {
  if( in_array( search:dhe_kex_algo, array:supported_kex_algos, part_match:FALSE ) ) {
    report += '\n' + dhe_kex_algo;
    found = TRUE;
  }
}

if( found ) {

  # nb:
  # - Store the reference from this one to gb_ssh_algos.nasl to show a cross-reference within the
  #   reports
  # - We don't want to use get_app_* functions as we're only interested in the cross-reference here
  register_host_detail( name:"detected_by", value:"1.3.6.1.4.1.25623.1.0.105565" ); # gb_ssh_algos.nasl
  register_host_detail( name:"detected_at", value:port + "/tcp" );

  security_message( port:port, data:report );
  exit( 0 );
}

exit( 99 );

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

03 Oct 2024 00:00Current
7.4High risk
Vulners AI Score7.4
CVSS 25
CVSS 3.17.5
EPSS0.23061
SSVC
343