sqlmapproject/sqlmap · error · ValueError

deserialization of class

Error message

deserialization of class '%s' is forbidden

What it means

Security sentinel in _serializeResolveClass: the class name decoded from an 'o' (object) structure is not on the deserialization allowlist, so instantiating it is forbidden to prevent arbitrary code execution from untrusted serialized data.

Solutions

  1. Only add the class to the allowlist if it is sqlmap's own or a trusted bundled type
  2. Regenerate the session data via --flush-session instead of decoding foreign structures
  3. Never deserialize session files received from untrusted sources
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at lib/core/convert.py:231 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at lib/core/convert.py:231

            return datetime.time(*struct["v"])
        elif tag == "td":
            return datetime.timedelta(struct["v"][0], struct["v"][1], struct["v"][2])
        elif tag == "o":
            return _serializeDecodeObject(struct)
        elif tag is None:  # defensive - a bare mapping should never occur
            return dict((_serializeDecode(k), _serializeDecode(v)) for (k, v) in struct.items())
        else:
            raise ValueError("unsupported serialized tag '%s'" % tag)

    raise ValueError("unsupported serialized structure of type '%s'" % type(struct))

def _serializeResolveClass(name):
    """
    Resolves an allowlisted class name to its class (nothing else may be reconstructed)
    """

    if name not in _SERIALIZE_CLASSES:
        raise ValueError("deserialization of class '%s' is forbidden" % name)

    if name == "lib.utils.har.RawPair":
        from lib.utils.har import RawPair
        return RawPair
    else:
        from lib.core.datatype import AttribDict, InjectionDict
        return InjectionDict if name.endswith("InjectionDict") else AttribDict

def _serializeDecodeObject(struct):
    """
    Reconstructs an allowlisted class instance from its serialized form
    """

    _class = _serializeResolveClass(struct.get("c"))
    retVal = _class.__new__(_class)

    if isinstance(retVal, dict):
        for pair in (struct.get("d") or []):

View on GitHub (pinned to 0a35b20e39)