CVE-2026-47071: SOCKS5 TLS upgrade ignores caller timeout in hackney

Published May 25, 2026
·
Updated

Summary

The SOCKS5 transport in src/hackneysocks5.erl correctly applies the caller-supplied timeout to the SOCKS5 negotiation phase, but then upgrades the tunnel to TLS using ssl:connect/2 (the two-argument form), which defaults to infinity. The Timeout value is in scope at that call site but is never forwarded. A hostile or man-in-the-middled SOCKS5 proxy that completes the SOCKS5 handshake normally and then stalls the TLS exchange will pin the connecting Erlang process and socket indefinitely, regardless of any connecttimeout or recvtimeout options the caller set.

Details

In src/hackneysocks5.erl, line 65, after the SOCKS5 negotiation succeeds, the code calls:

erlang ssl:connect(Socket, SSLOpts)

The three-argument form ssl:connect/3 takes a timeout; the two-argument form used here defaults to infinity. The variable Timeout (already used for SOCKS5 recv calls earlier in the same function) is simply not passed. The bytes that drive the TLS handshake on the upstream side of the tunnel come from whatever endpoint the proxy connects to. A hostile proxy can complete SOCKS5 normally, then either stay silent or send a partial ServerHello and stop, keeping ssl:connect/2 blocked forever. No certificate forgery is needed.

PoC

1. Stand up a SOCKS5 proxy that completes the SOCKS5 greeting and CONNECT reply normally, then goes silent (never sends a TLS ServerHello). 2. Issue an HTTPS request through it via hackney with connecttimeout and recvtimeout set to a short value (e.g. 2000 ms). 3. Observe the calling process remains blocked well past the configured timeout, consuming a process and socket until killed externally.

Impact

Denial of service via unbounded process and socket consumption. Affects hackney 0.10.0 through 4.0.0 for any HTTPS request routed through a SOCKS5 proxy. The connecttimeout and recvtimeout options give a false sense of safety since they are not honored during the TLS upgrade. CVSS v4.0: 8.2 (HIGH).

Resources

Introduction commit: https://github.com/benoitc/hackney/commit/34cdbd1d20a282aacc286a89327465a3925b4c5d Patch commit: https://github.com/benoitc/hackney/commit/5ccdab725c561a6f03d05a51f2d0664f98236dae

Other sources

Uncontrolled Resource Consumption vulnerability in benoitc hackney allows Flooding. The SOCKS5 transport in src/hackneysocks5.erl correctly applies the caller-supplied timeout to the SOCKS5 negotiation phase, but then upgrades the connection to TLS using the two-argument form ssl:connect/2, which defaults to an infinite timeout. The Timeout value is in scope at the call site but is not forwarded. A hostile SOCKS5 proxy that completes the SOCKS5 handshake normally and then goes silent (or sends a partial TLS ServerHello and stalls) will cause the connecting process to block indefinitely, regardless of the connecttimeout or recvtimeout options supplied by the caller.

This issue affects hackney: from 0.10.0 before 4.0.1.

— NVD

Affected Software

3 affected componentsFixes available
hex/hackney>=0.10.0<4.0.1
benoitc hackney>=0.10.0<4.0.1
erlang/hackney>=0.10.0<4.0.1
4.0.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade erlang/hackney to a version that resolves this vulnerability.

    Fixed in 4.0.1
  2. Upgrade

    Upgrade hackney to a version that resolves this vulnerability.

    Fixed in 4.0.1Patch 5ccdab725c561a6f03d05a51f2d0664f98236dae

Event History

May 25, 2026
CVE Published
via MITRE·02:00 PM
Data Sourced
via MITRE·02:00 PM
DescriptionWeakness
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jun 26, 2026
Advisory Published
via GitHub·09:53 PM
Data Sourced
via GitHub·09:53 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

When can this issue be exploited?

It affects connections that use hackney's SOCKS5 transport and then upgrade the tunnel to TLS. A hostile or man-in-the-middle SOCKS5 proxy must complete the SOCKS5 negotiation and then stall or partially respond during the TLS handshake.

2

Do configured connection or receive timeouts prevent the hang?

No. Although the caller-supplied timeout is used during SOCKS5 negotiation, it is not passed to the TLS upgrade call, which uses an infinite default timeout.

3

What is the operational impact of exploitation?

Each affected connection can leave the connecting Erlang process and its socket pinned indefinitely. An attacker able to induce enough such connections could exhaust available process or socket resources.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203