sqlmapproject/sqlmap · error · OperationalError

server does not support the 4.1 protocol, which this client…

Error message

server does not support the 4.1 protocol, which this client requires

What it means

The server's capability flags lack CLIENT_PROTOCOL_41: it only speaks the pre-4.1 protocol, whose handshake and scramble this client does not implement, so negotiation is refused rather than guessed.

Solutions

  1. Point at a MySQL >= 4.1 server (any modern MySQL/MariaDB)
  2. Implement the old handshake or use a client library that still supports it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extra/dbwire/mysql.py:323 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/86ada563ddd214e8. Report an issue: GitHub.

Appendix: source

Thrown at extra/dbwire/mysql.py:323

        off += 10                                       # reserved
        salt += payload[off:off + max(13, auth_data_len - 8) - 1]  # part 2 (drop trailing NUL)
        off += max(13, auth_data_len - 8)
        plugin = "mysql_native_password"
        if off < len(payload):
            name, _ = _cstring(payload, off)
            plugin = name.decode("ascii", "replace") or plugin

        if plugin == "caching_sha2_password":
            auth_response = _scramble_sha2(password or "", salt)
        else:
            plugin = "mysql_native_password"
            auth_response = _scramble_native(password or "", salt)

        # capabilities are NEGOTIATED: each side advertises what it can do and only the intersection is in
        # play. Sending a fixed set makes the client claim features a proxy/fork/older server never offered,
        # which is how a handshake ends up desynchronized rather than cleanly refused.
        if not (server_caps & _CLIENT_PROTOCOL_41):
            raise OperationalError("server does not support the 4.1 protocol, which this client requires")
        wanted = (_CLIENT_LONG_PASSWORD | _CLIENT_LONG_FLAG | _CLIENT_PROTOCOL_41 |
                  _CLIENT_TRANSACTIONS | _CLIENT_SECURE_CONNECTION | _CLIENT_PLUGIN_AUTH)
        if database:
            wanted |= _CLIENT_CONNECT_WITH_DB
        flags = wanted & server_caps
        flags |= _CLIENT_PROTOCOL_41 | _CLIENT_SECURE_CONNECTION     # mandatory for the packets built below
        if database and not (flags & _CLIENT_CONNECT_WITH_DB):
            raise OperationalError("server does not support selecting a database during the handshake")
        if not (flags & _CLIENT_PLUGIN_AUTH):
            plugin = None       # pre-4.1.1 style: no trailing plugin name in the handshake response
        response = struct.pack("<I", flags) + struct.pack("<I", _MAX_PACKET) + struct.pack("<B", 45) + (b"\x00" * 23)
        response += (user or "").encode("utf-8") + b"\x00"
        response += struct.pack("<B", len(auth_response)) + auth_response
        if database:
            response += database.encode("utf-8") + b"\x00"
        if plugin:
            response += plugin.encode("ascii") + b"\x00"
        _send_packet(sock, seq + 1, response)

View on GitHub (pinned to 0a35b20e39)