sqlmapproject/sqlmap · error · ValueError
Kerberos integrity check failed (wrong key or corrupted…
Error message
Kerberos integrity check failed (wrong key or corrupted ciphertext)
What it means
decrypt decrypted the body fine but the trailing HMAC-SHA1 (truncated to macsize) computed with ki does not match the MAC carried in the ciphertext, so integrity verification under RFC 3961 5.3 failed. With a valid Kerberos exchange this means the derived key or key usage is wrong, or the data was altered/corrupted in transit.
Solutions
- Verify the password/salt used to derive the base key.
- Confirm the key usage number passed to decrypt matches the one used at encryption (RFC 3961 usage derivation).
- Check for transmission corruption; re-fetch the message.
- If comparing two implementations, ensure both derive ke/ki with the same usage bytes (0xAA/0x55).
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at extra/kerberos/crypto.py:192 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/4b1a6a453caeae49.
Report an issue: GitHub.
Appendix: source
Thrown at extra/kerberos/crypto.py:192
ke = self.dk(key, struct.pack(">IB", usage, 0xAA))
ki = self.dk(key, struct.pack(">IB", usage, 0x55))
return ke, ki
def encrypt(self, key, usage, plaintext, confounder=None):
ke, ki = self._keys(key, usage)
if confounder is None:
confounder = os.urandom(self.blocksize)
basic = confounder + plaintext
return self._basicEncrypt(ke, basic) + hmac.new(ki, basic, hashlib.sha1).digest()[:self.macsize]
def decrypt(self, key, usage, ciphertext):
if len(ciphertext) < self.blocksize + self.macsize: # confounder block + HMAC; guards a hostile short reply
raise ValueError("Kerberos ciphertext too short")
ke, ki = self._keys(key, usage)
ct, mac = ciphertext[:-self.macsize], ciphertext[-self.macsize:]
basic = self._basicDecrypt(ke, ct)
if not _eq(mac, hmac.new(ki, basic, hashlib.sha1).digest()[:self.macsize]):
raise ValueError("Kerberos integrity check failed (wrong key or corrupted ciphertext)")
return basic[self.blocksize:]
def _rc4(key, data):
"""RC4 (ARCFOUR) stream cipher."""
key, data = bytearray(key), bytearray(data)
if not key:
raise ValueError("RC4 requires a non-empty key")
s = list(range(256))
j = 0
for i in range(256):
j = (j + s[i] + key[i % len(key)]) & 0xff
s[i], s[j] = s[j], s[i]
out = bytearray(len(data))
i = j = 0
for n in range(len(data)):
i = (i + 1) & 0xffView on GitHub (pinned to 0a35b20e39)