Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if connection trottling is configured, diffie-hellman-group-exchange-sha256 warning about bit numbers disappear #262

Open
perkelix opened this issue Apr 19, 2024 · 6 comments

Comments

@perkelix
Copy link

Reporting aginstt what's in Git up to commit 8124c8e:

If connection trottling is enabled as a mitigation against CVE-2002-20001, all warnings about diffie-hellman-group-exchange-sha256's risks disappear.

What's expected:

(kex) diffie-hellman-group-exchange-sha256 (3072-bit) -- [info] available since OpenSSH 4.4
`- [info] OpenSSH's GEX fallback mechanism was triggered during testing. Very old SSH clients will still be able to create connections using a 2048-bit modulus, though modern clients will use 3072. This can only be disabled by recompiling the code (see https://github.com/openssh/openssh-portable/blob/V_9_4/dh.c#L477).

What we get:

(kex) diffie-hellman-group-exchange-sha256 -- [info] available since OpenSSH 4.4

What caused this was the addition of 3 lines to sshd_config:

MaxStartups 10:30:100
PerSourceMaxStartups 1
PerSourceNetBlockSize 32:128

@jtesta
Copy link
Owner

jtesta commented Apr 21, 2024

That result makes sense. The PerSourceMaxStartups 1 setting is interfering with ssh-audit's tests. On my test machine, updating it to 2 fixes the issue. This change might make you vulnerable to the DHEat attack with that, I think (tomorrow I'll be doing more tests on this situation, specifically).

@perkelix
Copy link
Author

It doesn't make sense. Vulnerability to low bit number doesn't disappear just because we're also testing for something else.

Which gets us back to why diffie-hellman-group-exchange-sha256 hasn't been deprecated yet.

@jtesta
Copy link
Owner

jtesta commented Apr 22, 2024

Vulnerability to low bit number doesn't disappear just because we're also testing for something else.

When PerSourceMaxStartups is set to 1, only one client can connect to OpenSSH at a time from a particular IP. ssh-audit creates multiple connections to do the group exchange tests. These multiple connections are done sequentially, but I suppose they're done so rapidly the server considers them to be in parallel. Hence they're blocked and ssh-audit cannot complete the gex tests.

You'll notice that the tests complete as expected when PerSourceMaxStartups is set to 2, though like I mentioned before, this can possibly expose you to the denial-of-service condition.

@perkelix
Copy link
Author

Vulnerability to low bit number doesn't disappear just because we're also testing for something else.

That point wasn't addressed in your reply.

You'll notice that the tests complete as expected when PerSourceMaxStartups is set to 2, though like I mentioned before, this can possibly expose you to the denial-of-service condition.

Which is why diffie-hellman-group-exchange-sha256 should result in a red flag and a recommendation to remove it from the configuration file, while the other diffie-hellman should result in a yellow flag.

@perkelix
Copy link
Author

The logic for this is still broken. ssh-audit currently skips testing diffie-hellman-group-exchange-sha256's number of bits if any DHEat mitigation is in use.

@jtesta
Copy link
Owner

jtesta commented Apr 23, 2024

I can't reproduce that result. I scanned a clean Ubuntu 22.04 image with the ssh-audit v3.2.0 stable release. Then I applied the iptables & ip6tables commands I described in #263 (comment) and scanned it again. The output in both is identical, except for the line that starts with (nfo) Potentially insufficient connection throttling detected [...].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants