{"record":{"id":"6283076f8c95aa89","repo":"sqlmapproject/sqlmap","slug":"reply-decryption-failed-wrong-password-or-salt","errorCode":null,"errorMessage":"reply decryption failed (wrong password or salt)","messagePattern":"reply decryption failed \\(wrong password or salt\\)","errorType":"exception","errorClass":"KerberosError","httpStatus":null,"severity":"error","filePath":"extra/kerberos/client.py","lineNumber":247,"sourceCode":"        raise KerberosError(-1, \"malformed KDC reply\")\n\ndef _parseRep(response, key, usage, expectedNonce, expectedType):\n    \"\"\"Parse an AS-REP / TGS-REP: decrypt its enc-part with 'key' under 'usage', returning the\n    opaque ticket and the freshly issued session key. The two replies are structurally identical.\n    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\")","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/extra/kerberos/client.py#L229-L265","documentation":"_parseRep failed to decrypt the reply's enc-part with the derived client key under the expected key usage. RFC 4120 integrity protection makes this almost always a key-derivation mismatch — wrong password, wrong salt (e.g. enterprise vs. principal-name salt), or wrong etype — rather than corruption.","triggerScenarios":"Thrown at extra/kerberos/client.py:247 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-check the username/password and the salt used for string-to-key (realm casing, enterprise name, KDC-advertised salt).","Confirm the negotiated etype matches what the KDC used (see the reply's enc-part etype).","Verify the key usage number matches AS-REP/TGS-REP decryption per RFC 4120.","If the password was recently changed, ensure the new credential is in use."],"exampleFix":null,"handlingStrategy":"try-catch","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"}