/

CVE-2026-24902

Severity:

HIGH RISK

(7.1)

SSRF in TrustTunnel TCP Forwarder

CVE-2026-24902

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Internal Network Access / SSRF-based Pivoting

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

TrustTunnel versions prior to 0.9.114 contain a server-side request forgery (SSRF) flaw in the TCP forwarding logic that bypasses private network restrictions when a numeric IP is used.

An attacker who can influence the VPN's destination endpoint may reach loopback or private network services despite allow_private_network_connections = false, enabling unauthorized access to internal systems.

Affected context

This vulnerability affects TrustTunnel deployments that:

  • Rely on the VPN's allow_private_network_connections = false setting to block access to loopback or private IP ranges, and
  • Allow clients or upstream components to specify arbitrary TCP destinations, including numeric IP addresses.

The flaw resides in the TCP forwarder (tcp_forwarder.rs), where hostname-based destinations are filtered for private ranges but numeric IP destinations are connected without equivalent checks.

Environments that expose TrustTunnel as a gateway toward internal services or cloud metadata endpoints are particularly at risk.

Exploit preconditions

  • Attack surface: The TrustTunnel TCP forwarding interface that accepts user-controlled or proxy-controlled destination endpoints.
  • Required access: Ability to establish a TrustTunnel connection and influence the requested TCP destination (e.g., hostname or IP address) within the protocol or configuration used by the server.
  • Trigger point: Supplying a numeric IP address (e.g., 127.0.0.1, 10.x.x.x, 192.168.x.x) as the destination when allow_private_network_connections = false is configured.
  • Why exploitation is possible: The private network checks (such as is_global_ip and loopback checks) were only applied to the TcpDestination::HostName(peer) path. The TcpDestination::Address(peer) path for numeric IPs proceeded directly to TcpStream::connect() without equivalent validation, allowing connections to loopback and private IP ranges.

Why this happens

The root cause is an incomplete enforcement of network access controls based on how the destination is represented in code.

The private network restriction logic was implemented only for hostnames (e.g., performing checks after DNS resolution), and was not mirrored for numeric IP addresses handled via TcpDestination::Address(peer).

This design creates a discrepancy in trust enforcement: the same logical "destination" is treated differently depending on whether it is given as a name or as an IP literal.

Conceptually, this maps to CWE-918: Server-Side Request Forgery (SSRF), where an attacker leverages a server-side component to initiate unauthorized connections to internal resources, often by bypassing incomplete or inconsistent validation of outbound targets.

Potential impact

  • Access to loopback services (127.0.0.1) exposed only on the TrustTunnel server host.
  • Unauthorized connections to private network services (e.g., 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12) that administrators expected to be blocked by configuration.
  • Potential interaction with sensitive internal APIs, databases, or administrative interfaces not directly reachable from the attacker's network.
  • Use of the TrustTunnel server as an SSRF pivot to discover internal network topology and probe additional internal hosts.
  • Possible access to cloud provider metadata endpoints or other local infrastructure services if reachable via private ranges.

General mitigation guidance

Effective mitigation centers on making the outbound connection policy uniform and destination-agnostic, and on minimizing trust in client-controlled routing data.

Common defensive patterns include:

  • Applying identical private-network and loopback checks to all outbound connection paths, regardless of whether the destination is a hostname or a numeric IP.
  • Implementing a centralized, reusable network access control layer (e.g., a "safe connect" helper) that enforces allowlists/denylists and is used by all code that creates outbound TCP connections.
  • Treating both resolved addresses and literal IPs as untrusted and validating them against explicit policies (e.g., block RFC1918 ranges, link-local, loopback, and other restricted segments when such access is disabled).
  • Designing configuration flags like allow_private_network_connections so they are enforced close to the networking layer, reducing the chance of bypass through alternative code paths.
  • Running the VPN and its forwarder components under least-privilege network conditions, such as using firewall rules or container/network namespaces to prevent access to highly sensitive internal endpoints by default.

How teams detect issues like this

Detection typically involves a mix of code-level and runtime approaches:

  • Static analysis and code review:
  • Search for direct TcpStream::connect() (or equivalent) calls and verify that all paths go through a common validation routine for destination addresses.
  • Look for branching logic that treats hostnames and numeric IP addresses differently, especially around network filtering or private-range checks.
  • Enforce policies in code review templates requiring that new outbound network code use shared, policy-enforcing helpers.
  • Automated scanning:
  • Configure SAST tools to flag outbound connection calls that bypass central network policy functions.
  • Use configuration-as-code checks to ensure that SSRF protections are not conditional on representation (hostname vs IP).
  • Runtime monitoring:
  • Log outbound connection attempts with resolved destination IPs and compare them against allowed ranges.
  • Alert on attempted connections to loopback or private IP ranges from the VPN server when such access is nominally disabled.

Sources

SourceLink
github.comgithub.com/TrustTunnel/TrustTunnel/commit/734bb5cf103b72390a95c853cbf91e699cc01bc0
github.comgithub.com/TrustTunnel/TrustTunnel/security/advisories/GHSA-hgr9-frvw-5r76

Frequently asked

questions

Yes, it can be remotely exploitable if an attacker can establish or influence a TrustTunnel connection and specify the TCP destination. In that case, they may coerce the server into connecting to internal IP addresses that should be off-limits.

The attacker needs the ability to control or inject the destination endpoint used by the TCP forwarder—typically as an authenticated or permitted TrustTunnel client, or through any upstream system that passes user-controlled destinations into TrustTunnel.

The safest pattern is to centralize outbound connection creation behind a single function that performs strict validation of all destinations—whether hostnames or raw IP addresses—against a clearly defined policy, and then ensure all forwarding logic uses this function.

To prevent similar bugs, treat all destination representations uniformly, enforce network policies at the lowest practical layer, require security-focused reviews for any outbound network code, and use automated checks to flag direct socket connections that bypass established validation routines.

Find out what's already
exploitable in your codebase.