Skip to content
Misconfiguration Disclosed report Intermediate CVE-2022-27782

CVE-2022-27782: TLS and SSH connection too eager reuse

libcurl reused existing TLS or SSH connections even when security-related options had changed, so a later transfer could run with the wrong client certificate, weaker TLS settings, or a previously authenticated SSH session. An attacker who knows the application's SSH key setup could potentially abuse this reuse to act on the same host.

nyymi Follow

Originally disclosed on HackerOne

Bounty$2,400 Medium View original
  • Fixed in 36 hours
  • Paid in 36 hours
  • Disclosed after 37 hours

Summary by the program

TLS and SSH connection too eager reuse

Project curl Security Advisory, May 11 2022 - Permalink

VULNERABILITY

libcurl would reuse a previously created connection even when a TLS or SSH related option had been changed that should have prohibited reuse.

libcurl keeps previously used connections in a connection pool for subsequent transfers to reuse if one of them matches the setup. However, several TLS and SSH settings were left out from the configuration match checks, making them match too easily.

We are not aware of any exploit of this flaw.

INFO

Here are the list of options that were not considered in the check, so curl would reuse a connection even if the subsequent transfer would have changed one or more of these options.

TLS options

  • CURLOPT_SSL_OPTIONS(since 7.25.0)
  • CURLOPT_CRLFILE (since 7.19.0)
  • CURLOPT_TLSAUTH_USERNAME (since 7.21.4)
  • CURLOPT_TLSAUTH_PASSWORD (since 7.21.4)
  • CURLOPT_PROXY_SSL_OPTIONS (since 7.52.0)
  • CURLOPT_PROXY_CRLFILE (since 7.52.0)
  • CURLOPT_PROXY_TLSAUTH_USERNAME (since 7.52.0)
  • CURLOPT_PROXY_TLSAUTH_PASSWORD (since 7.52.0)

SSH options

  • CURLOPT_SSH_PUBLIC_KEYFILE (since 7.16.1)
  • CURLOPT_SSH_PRIVATE_KEYFILE (since 7.16.1)

This flaw was initially introduced in curl 7.16.1 and has been widened several times since then. See table above for details

The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2022-TLSSSHREUSE to this issue.

CWE-305: Authentication Bypass by Primary Weakness

Severity: Medium

AFFECTED VERSIONS

libcurl is used by many applications, but not always advertised as such!

THE SOLUTION

The two patches for CVE-2022-27782: TLS-fix and SSH-fix

RECOMMENDATIONS

A - Upgrade curl to version 7.83.1

B - Apply the patch to your local version

TIMELINE

This issue was reported to the curl project on May 1, 2022. We contacted distros@openwall on May 5.

libcurl 7.83.1 was released on May 11 2022, coordinated with the publication of this advisory.

LINK TO ADVISORY

https://curl.se/docs/CVE-2022-27782.html

The report

Summary:

Curl fails to consider some security related options when reusing TLS connections. For example:

TLS

CURLOPT_SSL_OPTIONS CURLOPT_PROXY_SSL_OPTIONS CURLOPT_CRLFILE CURLOPT_PROXY_CRLFILE CURLOPT_TLSAUTH_TYPE CURLOPT_TLSAUTH_USERNAME CURLOPT_TLSAUTH_PASSWORD CURLOPT_PROXY_TLSAUTH_TYPE CURLOPT_PROXY_TLSAUTH_USERNAME CURLOPT_PROXY_TLSAUTH_PASSWORD

As a result for example TLS connection with lower security (CURLSSLOPT_ALLOW_BEAST, CURLSSLOPT_NO_REVOKE) connection reused when it should no longer be. Also connection that has been authenticated perviously with CURLSSLOPT_AUTO_CLIENT_CERT might be reused for connections that should not be.

SSH

CURLOPT_SSH_PUBLIC_KEYFILE CURLOPT_SSH_PRIVATE_KEYFILE

If the attacker knows the vulnerable application used SSH key authentication towards specific host with certain username and protocol they can then perform actions to the same host afterwards and abuse the connection reuse.

Impact

  • Wrong identity (client certificate) or TLS security options being used for subsequent connections to the same hosts.
  • Previously authenticated SSH sessions (SCP/SFTP) reuse.

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 connection-reuse matching logic omitted several TLS and SSH configuration options from its comparison, so connections with different security settings were treated as interchangeable.

Impact

A later transfer could use the wrong client certificate or weaker TLS options, and a previously authenticated SSH session could be reused; the advisory states no exploit is known.

What the attacker needed

Application uses libcurl with connection reuse; security-related TLS or SSH options change between transfers; attacker knows the SSH key setup

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 makes many connections, it often keeps old ones open to save time. Here, curl kept reusing an old secure connection even after the program asked for different security settings, such as a different client certificate or stricter checks. That means a later request could accidentally use the wrong identity or weaker protection.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by nyymi

View all

51 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.