{"record":{"id":"bb54453ffe78bee2","repo":"projectdiscovery/nuclei","slug":"error-reading-response-size-header-v","errorCode":null,"errorMessage":"error reading response size header: %v","messagePattern":"error reading response size header: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/js/libs/kerberos/sendtokdc.go","lineNumber":189,"sourceCode":"func sendTCP(conn *net.TCPConn, b []byte) ([]byte, error) {\n\tdefer func() {\n\t\t_ = conn.Close()\n\t}()\n\tvar r []byte\n\t// RFC 4120 7.2.2 specifies the first 4 bytes indicate the length of the message in big endian order.\n\thb := make([]byte, 4)\n\tbinary.BigEndian.PutUint32(hb, uint32(len(b)))\n\tb = append(hb, b...)\n\n\t_, err := conn.Write(b)\n\tif err != nil {\n\t\treturn r, fmt.Errorf(\"error sending to KDC (%s): %v\", conn.RemoteAddr().String(), err)\n\t}\n\n\tsh := make([]byte, 4)\n\t_, err = conn.Read(sh)\n\tif err != nil {\n\t\treturn r, fmt.Errorf(\"error reading response size header: %v\", err)\n\t}\n\ts := binary.BigEndian.Uint32(sh)\n\n\trb := make([]byte, s)\n\t_, err = io.ReadFull(conn, rb)\n\tif err != nil {\n\t\treturn r, fmt.Errorf(\"error reading response: %v\", err)\n\t}\n\tif len(rb) < 1 {\n\t\treturn r, fmt.Errorf(\"no response data from KDC %s\", conn.RemoteAddr().String())\n\t}\n\treturn rb, nil\n}\n\n// CheckKrbError checks if the response bytes from the KDC are a KRBError.\nfunc CheckKrbError(b []byte) ([]byte, error) {\n\tvar KRBErr messages.KRBError\n\tif err := KRBErr.Unmarshal(b); err == nil {","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/js/libs/kerberos/sendtokdc.go#L171-L207","documentation":"After a successful send, sendTCP reads the 4-byte big-endian response size header mandated by RFC 4120 7.2.2, and that read failed. Causes: the KDC closed or reset the connection without answering, or the read deadline (config.timeout seconds, 5 by default) expired before any byte arrived.","triggerScenarios":"KDC silently dropping malformed requests by closing the socket; firewall or IPS sending RST; DC under heavy load answering after the 5s deadline; connection kept half-open by a middlebox.","commonSituations":"Hand-crafted ASN.1 messages with encoding errors; scanning during DC backup windows; tight timeouts over WAN links to remote domains.","solutions":["Validate the Kerberos message encoding before sending (a KDC that drops garbage usually closes the connection)","Raise the client timeout above the 5s default","Try the UDP transport for the same message as a cross-check"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const resp = kerberos.SendToKDC(client, msg);\n} catch (e) {\n  // KDC closed before sending the 4-byte size header: verify message encoding, raise the 5s timeout, or try UDP\n}","preventionTips":["KDCs that silently close usually received a malformed request - lint the ASN.1 first","Raise the timeout when scanning loaded or remote DCs"],"tags":["kerberos","tcp","timeout","kdc"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}