VYPR
Critical severityNVD Advisory· Published Mar 20, 2026· Updated Mar 20, 2026

Mesop: Path Traversal utilizing `FileStateSessionBackend` leads to Application Denial of Service and File Write/Deletion

CVE-2026-33054

Description

Mesop is a Python-based UI framework that allows users to build web applications. Versions 1.2.2 and below contain a Path Traversal vulnerability that allows any user supplying an untrusted state_token through the UI stream payload to arbitrarily target files on the disk under the standard file-based runtime backend. This can result in application denial of service (via crash loops when reading non-msgpack target files as configurations), or arbitrary file manipulation. This vulnerability heavily exposes systems hosted utilizing FileStateSessionBackend. Unauthorized malicious actors could interact with arbitrary payloads overwriting or explicitly removing underlying service resources natively outside the application bounds. This issue has been fixed in version 1.2.3.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
mesopPyPI
< 1.2.31.2.3

Affected products

1

Patches

1
c6b382f363b7

Add path traversal protection to FileStateSessionBackend (#1361)

https://github.com/mesop-dev/mesopRichard ToMar 15, 2026via ghsa
2 files changed · +35 1
  • mesop/server/state_session.py+10 1 modified
    @@ -1,5 +1,6 @@
     import logging
     import os
    +import re
     from datetime import datetime, timedelta
     from pathlib import Path
     from typing import Any, Protocol
    @@ -146,8 +147,16 @@ def __init__(self, base_dir: Path):
         self.base_dir = base_dir
         self.prefix = "session"
     
    +  # Matches tokens produced by secrets.token_urlsafe: base64url alphabet only.
    +  _VALID_TOKEN_RE = re.compile(r"^[A-Za-z0-9_-]+$")
    +
       def _make_file_path(self, token: str) -> Path:
    -    return self.base_dir / (self.prefix + token)
    +    if not self._VALID_TOKEN_RE.match(token):
    +      raise MesopException("Invalid state token.")
    +    file_path = (self.base_dir / (self.prefix + token)).resolve()
    +    if not file_path.is_relative_to(self.base_dir.resolve()):
    +      raise MesopException("Invalid state token.")
    +    return file_path
     
       def restore(self, token: str, states: States):
         """Gets the saved state from the given token and updates the given state."""
    
  • mesop/server/state_session_test.py+25 0 modified
    @@ -196,6 +196,31 @@ def test_memory_backend_clear_stale_sessions():
       assert states == {type(StateA): StateA()}
     
     
    +@pytest.mark.parametrize(
    +  "malicious_token",
    +  [
    +    "../../../../etc/passwd",
    +    "../sibling",
    +    "token/../../escape",
    +    "token\x00null",
    +    "token with spaces",
    +    "",
    +  ],
    +)
    +def test_file_backend_rejects_path_traversal_token(tmp_path, malicious_token):
    +  backend = FileStateSessionBackend(tmp_path)
    +  with pytest.raises(MesopException, match="Invalid state token."):
    +    backend._make_file_path(malicious_token)
    +
    +
    +def test_file_backend_accepts_valid_token(tmp_path):
    +  backend = FileStateSessionBackend(tmp_path)
    +  # token_urlsafe(16) produces base64url characters: A-Z a-z 0-9 _ -
    +  valid_token = "abcABC123_-XyZ"
    +  path = backend._make_file_path(valid_token)
    +  assert path.parent == tmp_path.resolve()
    +
    +
     def test_file_backend_clear_stale_sessions_not_stale(tmp_path):
       # GIVEN
       backend = FileStateSessionBackend(tmp_path)
    

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

5

News mentions

0

No linked articles in our index yet.