question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Group Size Enumeration of diffie-hellman-group-exchange-sha1 and diffie-hellman-group-exchange-sha256

See original GitHub issue

I’ve encountered an SSH server where the Diffie-Hellman group size used by the key exchange algorithm diffie-hellman-group-exchange-sha256 is hardcoded and cannot be seen or configured by an administrator.

My plan was to use ssh-audit to scan the server and find out more information about the supported group size(s) but then I realised that ssh-audit only returns the minimum value.

I studied RFC 4419 which explains how the client requests a modulus from the server by specifying a minimum, a preferred and a maximum value (expressed in bits). The send_init_gex function in ssh-audit has been implemented as per the explanation in RFC 4419, it accepts minbits, prefbits and maxbits.

I was able to modify gextest.py to invoke send_init_gex with minbits, prefbits and maxbits of the same value from 0 to 8192. This gave me the answer I was looking for, it showed that the server was configured with group sizes of 1024, 2048, 3072, 4096 and 6144. Using this information I can now contact the manufacturer of the SSH server software and ask if they will consider removing 1024.

@jtesta What do you think about about adding group size enumeration as a feature to ssh-audit? I could submit my patch as a draft for you to review?

Enumerating every value from 0 to 8192 is a slow process because it has to make a new connection to the target server each time. In my case this was not a problem because I ran the patched version of ssh-audit on the SSH server itself. However, if someone were to attempt this over a network it may cause a firewall’s rate control to be triggered resulting in requests being blocked. So we’d probably need to mention this as a potential caveat in the documentation.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
jtestacommented, Oct 11, 2022

Thanks for updating the README with #135.

Thanks again for all your work!

0reactions
thecliguycommented, Apr 10, 2022

Thanks for updating the README with #135.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Group Size Enumeration of diffie-hellman-group-exchange-sha1 ...
I've encountered an SSH server where the Diffie-Hellman group size used by the key exchange algorithm diffie-hellman-group-exchange-sha256 is hardcoded and ...
Read more >
diffie-hellman-group-exchange-sha1 - IETF
Diffie-Hellman Group and Key Exchange The server keeps a list of safe primes ... group size, the preferred size of the group, and...
Read more >
What's the modp length of diffie-hellman-group-exchange ...
A DH group is defined by a prime modulus and a generator. The prime modulus is ... That file contains pre-generated moduli of...
Read more >
RFC 9142: Key Exchange (KEX) Method Updates and ...
This document updates the recommended set of key exchange methods for use in the Secure Shell (SSH) protocol to meet evolving needs for...
Read more >
SSH Weak Diffie-Hellman Group Identification Tool - Aon
The client and server negotiated a group size of 2048 using diffie-hellman-group-exchange-sha256. The security level is STRONG.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found