sqlmapproject/sqlmap · error · ValueError

rc4-hmac ciphertext too short

Error message

rc4-hmac ciphertext too short

What it means

Error "rc4-hmac ciphertext too short" thrown in sqlmapproject/sqlmap.

Source

Thrown at extra/kerberos/crypto.py:245

        return _md4(password.encode("utf-16-le"))

    @staticmethod
    def _usage(usage):
        # RFC 4757 section 3: a couple of Kerberos usages map to Microsoft-specific values (per the
        # published errata, usage 9 is NOT folded into 8 - only 3->8 and 23->13 apply)
        return struct.pack("<I", {3: 8, 23: 13}.get(usage, usage))

    def encrypt(self, key, usage, plaintext, confounder=None):
        if confounder is None:
            confounder = os.urandom(8)
        ki = hmac.new(key, self._usage(usage), hashlib.md5).digest()
        cksum = hmac.new(ki, confounder + plaintext, hashlib.md5).digest()
        ke = hmac.new(ki, cksum, hashlib.md5).digest()
        return cksum + _rc4(ke, confounder + plaintext)

    def decrypt(self, key, usage, ciphertext):
        if len(ciphertext) < 24:
            raise ValueError("rc4-hmac ciphertext too short")
        cksum, data = ciphertext[:16], ciphertext[16:]
        ki = hmac.new(key, self._usage(usage), hashlib.md5).digest()
        ke = hmac.new(ki, cksum, hashlib.md5).digest()
        plaintext = _rc4(ke, data)
        if not _eq(cksum, hmac.new(ki, plaintext, hashlib.md5).digest()):
            raise ValueError("Kerberos integrity check failed (wrong key or corrupted ciphertext)")
        return plaintext[8:]                               # strip the 8-byte confounder

    def checksum(self, key, usage, data):
        ksign = hmac.new(key, b"signaturekey\x00", hashlib.md5).digest()
        return hmac.new(ksign, hashlib.md5(self._usage(usage) + bytes(data)).digest(), hashlib.md5).digest()

# etype number -> enctype implementation
ENCTYPES = {
    17: AESEnctype(16),
    18: AESEnctype(32),
    23: RC4Enctype(),
}

View on GitHub (pinned to 0a35b20e39)

When it happens

Trigger: Thrown at extra/kerberos/crypto.py:245 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/fd5a665ea7c9f990. Report an issue: GitHub.