Title
Localhost-filter bypass in SOCKS server mode
Description
In affected versions, the destination filter used by SOCKS server mode rejects IPv4 loopback addresses and the exact IPv6 loopback address, but does not reject several alternate address representations that can reach the local host. A client can therefore bypass the filter and connect to a service that is intended to be reachable only from the stunnel host.
The corrected filter rejects:
- unspecified IPv4 and IPv6 addresses (
0.0.0.0and::); - IPv4-compatible and IPv4-mapped IPv6 representations of loopback and unspecified IPv4 addresses; and
- interface-scoped IPv6 destinations.
The behavior of unspecified and interface-scoped destinations depends on the operating system. IPv4-mapped IPv6 loopback addresses provide a directly reproducible bypass on affected IPv6-enabled systems.
Exploitability
The vulnerability is exploitable under the following conditions:
- Stunnel versions 5.25 through 5.79, inclusive.
- SOCKS server mode is enabled with
protocol = socks. - The attacker is allowed to connect to and use the SOCKS listener.
- A service of interest is reachable through one of the alternate local-address representations and does not independently prevent the attacker's access.
Impact
An untrusted SOCKS client may gain unintended access to services on the stunnel host. The resulting confidentiality or integrity impact depends entirely on the presence and security of those local services. High confidentiality impact is not inherent to stunnel itself, and no availability impact has been established. The practical risk is assessed as Moderate.
A SOCKS proxy is intentionally a general-purpose network-access facility. The filter prevents accidental access to the proxy host, but it is not a substitute for network policy, TLS client authentication, or access controls on local services.
CVSS v3.1 Score
- CVSS Base Score: 5.4 (Medium)
- Impact Subscore: 2.5
- Exploitability Subscore: 2.8
CVSS v3.1 Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N
Recommendation
Upgrade to stunnel 5.80 or later.
Until an upgrade is possible, disable SOCKS server mode when it is not needed. Otherwise, restrict the SOCKS listener with appropriate network policies and require TLS client authentication. Local services should retain their own authentication and access controls.
Credits
- Vulnerability discovery: AISLE Research and Clemens Lang
- This report: MichaĆ Trojnara
Timeline
- Vulnerability reported to the vendor: 28 Jul 2026
- Fix committed: 31 Jul 2026
- Last update: 04 Aug 2026


