Skip to content
Account takeover Disclosed report Intermediate CVE-2023-27538

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.

nyymi Follow

Originally disclosed on HackerOne

  • 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:

  1. Make two connections to the same host with different ssh keys

Impact

Connection reuse when different ssh keys are used.

The original report as published on HackerOne, by nyymi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. 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.

More by nyymi

View all

51 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.