{"record":{"id":"19a6ddcc853db2b7","repo":"sqlmapproject/sqlmap","slug":"scram-server-signature-mismatch-rogue-server","errorCode":null,"errorMessage":"SCRAM server signature mismatch (rogue server?)","messagePattern":"SCRAM server signature mismatch \\(rogue server\\?\\)","errorType":"exception","errorClass":"OperationalError","httpStatus":null,"severity":"error","filePath":"extra/dbwire/postgres.py","lineNumber":294,"sourceCode":"            # Without this the client proves itself to the server and simply trusts whatever answers back.\n            # ServerSignature = HMAC(ServerKey, AuthMessage) can only be produced by a peer that holds the\n            # stored credentials, so comparing it is what makes the exchange mutual (RFC 5802 5, 5.1).\n            if salted is None or auth_message is None:\n                raise OperationalError(\"unexpected SCRAM server-final message\")\n            try:\n                attrs = dict(kv.split(\"=\", 1) for kv in payload[4:].decode(\"ascii\").split(\",\"))\n            except (ValueError, UnicodeDecodeError) as ex:\n                raise OperationalError(\"malformed SCRAM server-final message (%s)\" % ex)\n            if \"e\" in attrs:\n                raise OperationalError(\"SCRAM authentication failed (%s)\" % attrs[\"e\"])\n            try:\n                signature = base64.b64decode(attrs[\"v\"])\n            except (KeyError, binascii.Error, ValueError) as ex:\n                raise OperationalError(\"malformed SCRAM server signature (%s)\" % ex)\n            server_key = hmac.new(salted, b\"Server Key\", hashlib.sha256).digest()\n            expected = hmac.new(server_key, auth_message.encode(\"ascii\"), hashlib.sha256).digest()\n            if not hmac.compare_digest(signature, expected):\n                raise OperationalError(\"SCRAM server signature mismatch (rogue server?)\")\n        else:\n            raise InterfaceError(\"unsupported authentication request %d\" % code)\n\ndef _raise_server_error_as_operational(payload):\n    message, _ = _error_message(payload)\n    raise OperationalError(\"(remote) %s\" % message)\n\ndef connect(host=None, port=5432, user=None, password=None, database=None, connect_timeout=None, **kwargs):\n    try:\n        sock = socket.create_connection((host or \"localhost\", int(port or 5432)), timeout=connect_timeout)\n        keepalive(sock)\n    except (socket.error, socket.timeout) as ex:\n        raise OperationalError(\"could not connect to '%s:%s' (%s)\" % (host, port, ex))\n\n    params = b\"\"\n    for key, value in ((\"user\", user or \"\"), (\"database\", database or user or \"\"), (\"client_encoding\", \"UTF8\")):\n        params += key.encode(\"ascii\") + b\"\\x00\" + (\"%s\" % value).encode(\"utf-8\") + b\"\\x00\"\n    params += b\"\\x00\"","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/extra/dbwire/postgres.py#L276-L312","documentation":"Error \"SCRAM server signature mismatch (rogue server?)\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at extra/dbwire/postgres.py:294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}