CVE-2023-27538: SSH connection too eager reuse still
A check meant to prevent SSH connection reuse when the SSH keys differ was written with an equality comparison against a combined protocol-family constant, so it never matched. An attacker could therefore have a connection reused even though a different SSH key was supplied.
- Triaged in 13 hours
- Fixed in 11 days
- Disclosed after 13 days
Summary:
There's a check if SSH keys match between new and existing connection when considering reuse. This check is broken due to wrong comparison:
#define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP)
...
else if(get_protocol_family(needle->handler) == PROTO_FAMILY_SSH) {
This never matches as handler family is either CURLPROTO_SCP or CURLPROTO_SFTP.
Remediation
- Make the code:
else if(get_protocol_family(needle->handler) & PROTO_FAMILY_SSH) {
Steps To Reproduce:
- Make two connections to the same host with different ssh keys
Impact
Connection reuse when different ssh keys are used.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the protocol-family check used equality against a bitmask constant instead of a bitwise AND, so it could never be true.
Impact
Connection reuse could occur when different SSH keys are used, which may let a connection be shared when it should not be.
What the attacker needed
Ability to make SSH/SCP/SFTP connections; two different SSH keys
How it was found
- Make two connections to the same host with different SSH keys
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program opens a new connection, it sometimes reuses an existing one to save time. Here the code that decides whether reuse is safe for SSH connections was written so the test could never be true, meaning reuse happened even when the keys were different. The fix is to change the comparison so the test actually works.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.