{"record":{"id":"c3ccbcdcde93d8a7","repo":"sqlmapproject/sqlmap","slug":"reply-nonce-does-not-match-the-request-possible-r","errorCode":null,"errorMessage":"reply nonce does not match the request (possible replay)","messagePattern":"reply nonce does not match the request \\(possible replay\\)","errorType":"exception","errorClass":"KerberosError","httpStatus":null,"severity":"error","filePath":"extra/kerberos/client.py","lineNumber":252,"sourceCode":"    The reply's application tag MUST match the expected message type, and the nonce carried in the\n    (integrity-protected) enc-part MUST equal the request nonce (RFC 4120).\"\"\"\n\n    try:                                                   # any structural defect in a hostile/truncated reply -> KerberosError\n        tag, repContent = _raiseIfError(response)\n        if tag != der.applicationTag(expectedType):\n            raise KerberosError(-1, \"unexpected reply message type (tag 0x%02x)\" % tag)\n        rep = _fields(der.peel(repContent)[1])\n        encData = _expFields(rep[6])                        # enc-part (EncryptedData)\n        repEtype = _expInteger(encData[0])\n        try:\n            encRepPart = _enctype(repEtype).decrypt(key, usage, _expOctet(encData[2]))\n        except ValueError:                                 # HMAC mismatch -> we hold the wrong long-term key\n            raise KerberosError(-1, \"reply decryption failed (wrong password or salt)\")\n\n        # Enc*RepPart = [APPLICATION 25/26] EncKDCRepPart ; key is field [0], nonce is field [2]\n        encKdcRep = _fields(der.peel(der.peel(encRepPart)[1])[1])\n        if _expInteger(encKdcRep[2]) != expectedNonce:\n            raise KerberosError(-1, \"reply nonce does not match the request (possible replay)\")\n        keyFields = _expFields(encKdcRep[0])\n\n        return {\n            \"ticket\": bytes(rep[5]),\n            \"sessionKey\": _expOctet(keyFields[1]),\n            \"sessionKeyType\": _expInteger(keyFields[0]),\n            \"etype\": repEtype,\n            \"crealm\": _expString(rep[3]),\n            # EncKDCRepPart endtime [7]; a scan can outlive the ticket, so the caller can re-fetch\n            \"endtime\": _expTime(encKdcRep[7]) if 7 in encKdcRep else None,\n        }\n    except (KeyError, IndexError, ValueError, struct.error):\n        raise KerberosError(-1, \"malformed KDC reply\")\n\ndef _reqBody(realm, snameType, snameComponents, etypes, nonce, cnameComponents=None):\n    parts = [der.tagged(0, der.bitString(b\"\\x00\\x00\\x00\\x00\"))]                      # kdc-options\n    if cnameComponents is not None:\n        parts.append(der.tagged(1, _principalName(NT_PRINCIPAL, cnameComponents)))  # cname (AS only)","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/extra/kerberos/client.py#L234-L270","documentation":"_parseRep found that the nonce inside the successfully decrypted enc-part does not equal the nonce sent in the request. Because the enc-part is integrity-protected with the client key, a mismatch indicates a replayed or fabricated reply (or a client bug reusing nonce state), so the reply is rejected per RFC 4120.","triggerScenarios":"Thrown at extra/kerberos/client.py:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Generate a fresh random nonce per request; never reuse or hardcode it.","Check for request multiplexing bugs where replies are paired with the wrong request.","Investigate possible man-in-the-middle/replay on the path to the KDC.","If a proxy retries requests transparently, disable that and retry once."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}