Dev.to Security 🔐 Cybersecurity 👁 0 📖 4 min read

CVE-2026-135389: CVE-2026-135389: Authentication Bypass via Premature Session Caching in Pion DTLS

CVE-2026-135389: Authentication Bypass via Premature Session Caching in Pion DTLS Vulnerability ID: CVE-2026-135389 CVSS Score: 9.1 Published: 2026-12-03 A critical authentication bypass vulnerability exists in Pion

CVE-2026-135389: Authentication Bypass via Premature Session Caching in Pion DTLS

Vulnerability ID: CVE-2026-135389
CVSS Score: 9.1
Published: 2026-12-03

A critical authentication bypass vulnerability exists in Pion DTLS (versions 2.1.0 through 3.1.13 and 4.0.0-rc.1 through 4.0.0-rc.5) within the DTLS 1.2 server handshake state machine. When a server is configured with a SessionStore and negotiates a certificate-based cipher suite, it prematurely persists the session ID and derived master secret immediately after processing the ClientKeyExchange message. Because this cache write occurs before validating the client's Certificate, CertificateVerify, and Finished messages, an unauthenticated remote attacker can abandon an incomplete initial handshake and immediately perform an abbreviated session resumption handshake using the derived master secret, bypassing mandatory client certificate authentication (RequireAnyClientCert, RequireAndVerifyClientCert) and custom VerifyConnection callbacks.

TL;DR

Pion DTLS prematurely caches negotiated session secrets during the DTLS 1.2 handshake before validating client certificates or receiving a valid Finished message. An unauthenticated attacker can abandon a half-completed handshake and resume the cached session to bypass mutual TLS authentication.

⚠️ Exploit Status: POC

Technical Details

  • CVE / GHSA ID: CVE-2026-135389 / GHSA-hhpj-h56m-9f2p
  • Vulnerability Class: CWE-287 (Improper Authentication) / CWE-303
  • CVSS v3.1 Score: 9.1 Critical (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N)
  • EPSS Score: 0.735% (55.71th Percentile)
  • Affected Component: Pion DTLS (flight4handler.go / flight4ProcessClientFlight)
  • Impact: Unauthenticated Mutual TLS (Client Certificate) Bypass
  • Exploit Status: Public Proof-of-Concept Available
  • CISA KEV Status: Not Listed

Affected Systems

  • Pion DTLS v2 (v2.1.0 - v2.2.12)
  • Pion DTLS v3 (v3.0.0 - v3.1.13)
  • Pion DTLS v4 (v4.0.0-rc.1 - v4.0.0-rc.5)
  • github.com/pion/dtls/v2: >= 2.1.0, <= 2.2.12 (Fixed in: v3.1.14)
  • github.com/pion/dtls/v3: >= 3.0.0, < 3.1.14 (Fixed in: v3.1.14)
  • github.com/pion/dtls/v4: < 4.0.0-rc.6 (Fixed in: v4.0.0-rc.6)

Code Analysis

Commit: ce84b97

Defer session caching in flight4handler.go until finishClientFlight after Finished and client authentication checks succeed (v3 branch).

File: flight4handler.go
@@ -92,7 +92,7 @@ func flight4Parse(
            }
        }

-       return flight6, nil, nil
+       return finishClientFlight(state, cfg)
    }

    switch cfg.clientAuth {
@@ -124,7 +124,7 @@ func flight4Parse(
        }
    }

-   return flight6, nil, nil
+   return finishClientFlight(state, cfg)
 }

 // flight4ProcessClientFlight retains progress while waiting for CertificateVerify.
@@ -300,17 +300,6 @@ func flight4ProcessClientFlight(state *State, cache *handshakeCache, cfg *handsh
        cfg.writeKeyLog(keyLogLabelTLS12, clientRandom[:], state.masterSecret)
    }

-   if len(state.SessionID) > 0 {
-       s := Session{
-           ID:     state.SessionID,
-           Secret: state.masterSecret,
-       }
-       cfg.log.Tracef("[handshake] save new session: %x", s.ID)
-       if err := cfg.sessionStore.Set(state.SessionID, s); err != nil {
-           return false, &alert.Alert{Level: alert.Fatal, Description: alert.InternalError}, err
-       }
-   }
-
    state.handshakeRecvSequence = seq
    state.clientKeyExchange = nil
    state.clientFlightProcessed = true
@@ -567,3 +556,13 @@ func flight4Generate(

    return pkts, nil, nil
 }
+
+func finishClientFlight(state *State, cfg *handshakeConfig) (flightVal, *alert.Alert, error) {
+   if len(state.SessionID) > 0 && cfg.sessionStore != nil {
+       if err := cfg.sessionStore.Set(state.SessionID, Session{ID: state.SessionID, Secret: state.masterSecret}); err != nil {
+           return 0, &alert.Alert{Level: alert.Fatal, Description: alert.InternalError}, err
+       }
+   }
+
+   return flight6, nil, nil
+}

Commit: 410ac0e

Defer session caching in internal/flight/flight12/flight4handler.go until finishClientFlight after client authentication checks pass (v4 branch).

Exploit Details

  • GitHub: Public PoC reproduction laboratory and differential state verification harness for CVE-2026-135389.

Mitigation Strategies

  • Upgrade Pion DTLS to version v3.1.14 or v4.0.0-rc.6 to ensure session secrets are only committed to the SessionStore after Finished message validation and client authentication checks succeed.
  • Disable DTLS session resumption by setting SessionStore to nil in dtls.Config on servers requiring client certificate authentication or VerifyConnection callbacks.
  • Implement post-handshake application-layer validation to inspect conn.ConnectionState().PeerCertificates and reject connections lacking verified peer certificates.

Remediation Steps:

  1. Audit go.mod files across all Go repositories to identify dependencies on github.com/pion/dtls/v2, github.com/pion/dtls/v3 (< v3.1.14), or github.com/pion/dtls/v4 (< v4.0.0-rc.6).
  2. Inspect server initialization code to determine whether dtls.Config configures a non-nil SessionStore alongside ClientAuth policies or VerifyConnection callbacks.
  3. Run 'go get github.com/pion/dtls/[email protected]' (or v4.0.0-rc.6 for v4 users) and 'go mod tidy' to update the dependency.
  4. Rebuild and redeploy affected Go binaries and flush any persistent external SessionStore backends (such as Redis or Memcached session stores) to evict potentially unauthenticated cached sessions.

References

Read the full report for CVE-2026-135389 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.