sqlmapproject/sqlmap · error · KerberosError

reply decryption failed (wrong password or salt)

Error message

reply decryption failed (wrong password or salt)

What it means

_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.

Solutions

  1. Re-check the username/password and the salt used for string-to-key (realm casing, enterprise name, KDC-advertised salt).
  2. Confirm the negotiated etype matches what the KDC used (see the reply's enc-part etype).
  3. Verify the key usage number matches AS-REP/TGS-REP decryption per RFC 4120.
  4. If the password was recently changed, ensure the new credential is in use.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at extra/kerberos/client.py:247 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/6283076f8c95aa89. Report an issue: GitHub.

Appendix: source

Thrown at extra/kerberos/client.py:247

        raise KerberosError(-1, "malformed KDC reply")

def _parseRep(response, key, usage, expectedNonce, expectedType):
    """Parse an AS-REP / TGS-REP: decrypt its enc-part with 'key' under 'usage', returning the
    opaque ticket and the freshly issued session key. The two replies are structurally identical.
    The reply's application tag MUST match the expected message type, and the nonce carried in the
    (integrity-protected) enc-part MUST equal the request nonce (RFC 4120)."""

    try:                                                   # any structural defect in a hostile/truncated reply -> KerberosError
        tag, repContent = _raiseIfError(response)
        if tag != der.applicationTag(expectedType):
            raise KerberosError(-1, "unexpected reply message type (tag 0x%02x)" % tag)
        rep = _fields(der.peel(repContent)[1])
        encData = _expFields(rep[6])                        # enc-part (EncryptedData)
        repEtype = _expInteger(encData[0])
        try:
            encRepPart = _enctype(repEtype).decrypt(key, usage, _expOctet(encData[2]))
        except ValueError:                                 # HMAC mismatch -> we hold the wrong long-term key
            raise KerberosError(-1, "reply decryption failed (wrong password or salt)")

        # Enc*RepPart = [APPLICATION 25/26] EncKDCRepPart ; key is field [0], nonce is field [2]
        encKdcRep = _fields(der.peel(der.peel(encRepPart)[1])[1])
        if _expInteger(encKdcRep[2]) != expectedNonce:
            raise KerberosError(-1, "reply nonce does not match the request (possible replay)")
        keyFields = _expFields(encKdcRep[0])

        return {
            "ticket": bytes(rep[5]),
            "sessionKey": _expOctet(keyFields[1]),
            "sessionKeyType": _expInteger(keyFields[0]),
            "etype": repEtype,
            "crealm": _expString(rep[3]),
            # EncKDCRepPart endtime [7]; a scan can outlive the ticket, so the caller can re-fetch
            "endtime": _expTime(encKdcRep[7]) if 7 in encKdcRep else None,
        }
    except (KeyError, IndexError, ValueError, struct.error):
        raise KerberosError(-1, "malformed KDC reply")

View on GitHub (pinned to 0a35b20e39)