CVE-2025-30358
Description
Mesop is a Python-based UI framework that allows users to build web applications. A class pollution vulnerability in Mesop prior to version 0.14.1 allows attackers to overwrite global variables and class attributes in certain Mesop modules during runtime. This vulnerability could directly lead to a denial of service (DoS) attack against the server. Additionally, it could also result in other severe consequences given the application's implementation, such as identity confusion, where an attacker could impersonate an assistant or system role within conversations. This impersonation could potentially enable jailbreak attacks when interacting with large language models (LLMs). Just like the Javascript's prototype pollution, this vulnerability could leave a way for attackers to manipulate the intended data-flow or control-flow of the application at runtime and lead to severe consequences like remote code execution when gadgets are available. Users should upgrade to version 0.14.1 to obtain a fix for the issue.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
mesopPyPI | < 0.14.1 | 0.14.1 |
Patches
2897bf09e0b67748e20d4a363Harden dataclass utils (#1171)
2 files changed · +23 −0
mesop/dataclass_utils/dataclass_utils.py+4 −0 modified@@ -129,6 +129,10 @@ def update_dataclass_from_json(instance: Any, json_string: str): def _recursive_update_dataclass_from_json_obj(instance: Any, json_dict: Any): for key, value in json_dict.items(): + if key.startswith("__") and key.endswith("__"): + raise MesopDeveloperException( + f"Cannot use dunder property: {key} in stateclass" + ) if hasattr(instance, key): attr = getattr(instance, key) if isinstance(value, dict):
mesop/dataclass_utils/dataclass_utils_test.py+19 −0 modified@@ -14,6 +14,7 @@ serialize_dataclass, update_dataclass_from_json, ) +from mesop.exceptions import MesopDeveloperException @dataclass @@ -593,5 +594,23 @@ class ChildClass(ParentClass): assert has_parent(ParentClass) is False +def test_globals_pollution(): + @dataclass + class A: + val: str + + initial_name = __name__ + obj = A(val="default") + with pytest.raises(MesopDeveloperException) as exc_info: + update_dataclass_from_json( + obj, '{"__init__": {"__globals__": {"__name__": "polluted"}}}' + ) + assert "Cannot use dunder property: __init__ in stateclass" in str( + exc_info.value + ) + # Make sure __name__ has not been modified via the __globals__ pollution attempt + assert __name__ == initial_name + + if __name__ == "__main__": raise SystemExit(pytest.main(["-vv", __file__]))
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4News mentions
0No linked articles in our index yet.