Security Advisory ZPE-NG-2024-001

Security Advisory ZPE-NG-2024-001

Advisory ID: ZPE-NG-2024-001
First Published: July 8, 2024
CVE ID: CVE-2024-6387 (details on NIST.gov)
CVSSv3 Score: 8.1 (High)

Summary

If a client does not authenticate within LoginGraceTime seconds, by default three minutes, then sshd's SIGALRM handler is called asynchronously, and this handler calls functions that are not “async-signal-safe”, leading to a race condition that can theoretically be exploited on Linux systems using glibc.

Affected Nodegrid OS Versions

  • 3.2.56 (EOL)
  • 4.2.17 (EOL)
  • 5.0.13 to 5.0.18 (EOL)
  • 5.2.9 to 5.2.20 (EOL)
  • 5.4.0 to 5.4.17 (EOL)
  • 5.6.0 to 5.6.14 (EOL)
  • 5.8.0 to 5.8.19 (LTS)
  • 5.10.0 to 5.10.15 (Stable)
  • 6.0.0 to 6.0.11 (LTS)

Nodegrid OS is used in the following products:

  • Nodegrid Serial Console
  • Nodegrid Serial Console Plus
  • Nodegrid Net Services Router
  • Nodegrid Gate SR
  • Nodegrid Link SR
  • Nodegrid Bold SR
  • Nodegrid Hive SR
  • Nodegrid Mini SR
  • Nodegrid Manager
  • Nodegrid Virtual Services Router

Impact:

A signal handler race condition in OpenSSH’s sshd server may allow unauthenticated remote code execution.

As of the release date of the CVE, there are no publicly known working exploits on amd64 based on this vulnerability.


Mitigations

The immediate solution we recommend is to install a package that updates OpenSSH to address the vulnerability, as described in the Solutions section.

Mitigations are proposed in this section as an alternative to installing the update package, and the recommended mitigation is to configure firewall to allow only trusted hosts.


Firewall to allow only trusted hosts

Configure firewall rules to allow SSH connections only from trusted hosts, denying everyone else.

This should be implemented on any interface that may receive untrusted incoming traffic, with special attention to any interface exposed to the internet including LTE interfaces with public IP addresses.

This should be configured for both IPv4 and IPv6.

First, identify which hosts should be trusted, and then add rules to the INPUT chain to ACCEPT them.

For example, from the web UI, 

  1. Navigate to Security :: Firewall :: drill down to INPUT 
  2. Click on the Add button
  3. Set target as ACCEPT
  4. Set Source IP/Mask to the host or network you need to allow.
  5. Set Input Interface to the interface receiving untrusted traffic, or leave as Any
  6. Select Protocol as TCP, Destination Port as 22.
  7. Save

Or from the CLI:

cd settings/ipv4_firewall/chains/INPUT/
set source_net4=<host_or_network_to_allow>
set input_interface=<interface_or_any>
set protocol=tcp
set destination_port=22
set target=ACCEPT
commit

Only after the allow rules are in place, add a firewall rule to DROP anyone else.

For example, from the web UI,

  1. Navigate to Security :: Firewall :: drill down to INPUT
  2. Click on the Add button
  3. Set target as DROP
  4. Set Input Interface to the interface receiving untrusted traffic, or leave as Any
  5. Select Protocol as TCP, Destination Port as 22.
  6. Save

Or from the CLI:

cd settings/ipv4_firewall/chains/INPUT/
set input_interface=<interface_or_any>
set protocol=tcp
set destination_port=22
set target=DROP
commit

For more information on how to configure the Firewall, please consult the corresponding section in the Nodegrid OS User Guide:

https://docs.zpesystems.com/docs/firewall-tab


Change the SSH port

Change the SSH port to a random port. This can be done via web UI under
Security :: Services :: SSH TCP Port

Or via cli with:

cd settings/services/
set ssh_tcp_port=<random_port>
commit

where <random_port> needs to be a number between 1 and 65535 and not conflict with another port in use. To check ports in use, execute netstat -nlt.

If you added firewall rules to allow only trusted hosts, they need to be updated to use the new port.


Eliminate the race condition

Warning: This exposes Nodegrid to a denial of service attack.

Log in as user admin and start a root shell with:

shell sudo su -

Using a text editor such as vim, set LoginGraceTime to 0 in /etc/ssh/sshd_config and restart sshd with:

/etc/init.d/sshd restart

While this eliminates the race condition required for this vulnerability to be exploited, we do not recommend this as it exposes Nodegrid to a denial of service attack, where anyone capable of starting MaxStartups SSH connections and holding authentication by not providing a password would be able to effectively impede any additional SSH connection to succeed. You may increase MaxStartups in /etc/ssh/sshd_config, but this would simply require the attacker to start more SSH connections.

If you choose to implement this mitigation, it should be reverted after a solution is applied.


Solutions

An interim solution involving installation of a package to update sshd on latest supported versions is available to customers via Sharefile

Download the package that applies to your version, 5.8, 5.10, or 6.0, and follow the instructions in the README.txt file.

Please contact support@zpesystems.com if you need help to access and/or install it.

  • Upgrade to Nodegrid OS version 6.0.12 or above when available.
  • Upgrade to Nodegrid OS version 5.10.16 or above when available.
  • Upgrade to Nodegrid OS version 5.8.20 or above when available.

References