{"record":{"id":"1963aec5608f0d2b","repo":"golang/go","slug":"tls-received-new-session-ticket-from-a-client","errorCode":null,"errorMessage":"tls: received new session ticket from a client","messagePattern":"tls: received new session ticket from a client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/crypto/tls/handshake_client_tls13.go","lineNumber":840,"sourceCode":"\t}\n\n\tc.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret)\n\n\tif !c.config.SessionTicketsDisabled && c.config.ClientSessionCache != nil {\n\t\tc.resumptionSecret = hs.masterSecret.ResumptionMasterSecret(hs.transcript)\n\t}\n\n\tif c.quic != nil {\n\t\tc.quicSetWriteSecret(QUICEncryptionLevelApplication, hs.suite.id, hs.trafficSecret)\n\t}\n\n\treturn nil\n}\n\nfunc (c *Conn) handleNewSessionTicket(msg *newSessionTicketMsgTLS13) error {\n\tif !c.isClient {\n\t\tc.sendAlert(alertUnexpectedMessage)\n\t\treturn errors.New(\"tls: received new session ticket from a client\")\n\t}\n\n\tif c.config.SessionTicketsDisabled || c.config.ClientSessionCache == nil {\n\t\treturn nil\n\t}\n\n\t// See RFC 8446, Section 4.6.1.\n\tif msg.lifetime == 0 {\n\t\treturn nil\n\t}\n\tlifetime := time.Duration(msg.lifetime) * time.Second\n\tif lifetime > maxSessionTicketLifetime {\n\t\tc.sendAlert(alertIllegalParameter)\n\t\treturn errors.New(\"tls: received a session ticket with invalid lifetime\")\n\t}\n\n\tif len(msg.label) == 0 {\n\t\tc.sendAlert(alertDecodeError)","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/crypto/tls/handshake_client_tls13.go#L822-L858","documentation":"A TLS server received a NewSessionTicket message, which is a client-to-server-only artifact in TLS 1.3. Servers never process inbound NST messages; only clients do. The peer (which should be a client) sent the wrong message direction, indicating a malformed or malicious implementation. The server alerts unexpected_message.","triggerScenarios":"handleNewSessionTicket is invoked on a Conn where c.isClient is false — i.e. the server-side connection received a newSessionTicketMsgTLS13 from the network peer. This requires the peer to actively transmit an NST on a server-facing connection.","commonSituations":"A buggy or malicious TLS client sending server-only messages, a misbehaving TLS proxy/terminator that forwards messages in the wrong direction, or a fuzz tester hitting the server with arbitrary handshake messages. Legitimate TLS clients never send NSTs.","solutions":["Treat as a peer implementation bug; disconnect and log the peer address for investigation.","If a TLS-terminating proxy sits in front, verify it is not injecting or forwarding handshake messages incorrectly.","If fuzzing, this is an expected rejection — assert it and move on.","Upgrade or replace the offending peer TLS stack."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// No caller-side validation possible; the message direction is enforced by\n// the peer's TLS stack. Ensure you are not operating as a server expecting\n// inbound NSTs.","typeGuard":null,"tryCatchPattern":"// In a server handler, log and close the connection on this error.\nif err := conn.Read(...); err != nil {\n    if strings.Contains(err.Error(), \"received new session ticket from a client\") {\n        log.Warn(\"peer sent server-only message; likely malicious or buggy\",\n            \"remote\", conn.RemoteAddr())\n        conn.Close()\n    }\n}","preventionTips":["Run servers behind a vetted TLS terminator.","Log unexpected_message alerts to detect scanning or fuzzing.","Do not forward raw TLS handshake messages between directions in proxies."],"tags":["tls","server-handshake","protocol-violation","tls13","session-ticket"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}