CVE-2026-52830: fast-mcp-telegram Path Traversal Vulnerability

CRITICAL
Advisory Identifier: GHSA-rxw2-pc8j-vxwm
CVSS 9.4
CWE-287 CWE-22
Published
Advisory Summary

CVE-2026-52830 is a CRITICAL (CVSS 9.4) path traversal vulnerability (CWE-287: Improper Authentication) affecting fast-mcp-telegram libraries in the PyPI ecosystem. The issue involves bearer token path traversal bypasses reserved telegram session protection. Remediation is available by upgrading affected packages to version 0.19.1.

CVE-2026-52830 at a Glance

CVE Identifier CVE-2026-52830
GHSA Identifier GHSA-rxw2-pc8j-vxwm
Severity CRITICAL
CVSS v3.1 Base Score 9.4
CWE Classification CWE-287: Improper Authentication
Affected Product fast-mcp-telegram
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2026-52830

To remediate this vulnerability, upgrade all affected fast-mcp-telegram dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

fast-mcp-telegram fixed: 0.19.1
pip install fast-mcp-telegram>=0.19.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show fast-mcp-telegram

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-52830, inspect your installed packages using pip:

pip show fast-mcp-telegram

Analyze the terminal output to locate any version of fast-mcp-telegram in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.19.1), your application is affected.

Note: The pip show fast-mcp-telegram command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In fast-mcp-telegram, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary fast-mcp-telegram validates HTTP Bearer tokens by joining the raw token string into a session-file path. The verifier rejects the exact reserved token `telegram`, but it does not reject path separators or normalize the path before checking whether the session file exists. A remote HTTP client can therefore authenticate as the default legacy session with a token such as `../fast-mcp-telegram/telegram` when the documented default session file `~/.config/fast-mcp-telegram/telegram.session` exists. This bypasses the reserved session name control that is intended to prevent HTTP multi-user sessions from colliding with the default stdio or legacy account. With account-prefixed MCP tools enabled, the attacker still sees and calls the prefixed tools for the default account, so the prefix middleware does not stop the session selection bypass. ## Impact An unauthenticated network client can access the Telegram account represented by the default `telegram.session` file without knowing a generated bearer token, if that legacy or default session file is present on a server running HTTP auth. The attacker can then call Telegram MCP tools as that account, including message reading, message sending, MTProto API calls, and attachment-producing tool surfaces available to the session. ## Technical details `SessionFileTokenVerifier.verify_token()` strips whitespace and rejects exact reserved names: ```python if token.lower() in RESERVED_SESSION_NAMES: return None ``` It then appends `.session` to the raw token and checks the resulting path: ```python session_path = self._session_directory / f"{token}.session" if not session_path.is_file(): return None ``` No check rejects `/`, `\\`, `..`, absolute paths, or resolved paths outside the configured session directory. The session client path is built the same way in `src/client/connection.py`: ```python session_path = SESSION_DIR / f"{token}.session" client = await _build_telegram_client_for_token(session_path, token) ``` With the default session directory, the token `../fast-mcp-telegram/telegram` resolves as follows: ```text ~/.config/fast-mcp-telegram/../fast-mcp-telegram/telegram.session = ~/.config/fast-mcp-telegram/telegram.session ``` The exact token `telegram` is denied, but the traversal alias reaches the same file and is accepted. This is especially important because `telegram` is the documented default `session_name`, and the security documentation says reserved names are blocked to prevent conflicts with stdio and HTTP no-auth sessions. The vulnerable code is present on current `master` commit `167ab705f1cd09b21e85c370570471fe75a4f8c9` and in release tag `0.19.0` commit `77bdf6d7e5c6a84d87acc423db613e6c6ba30094`. ## Reproduction The following proof uses stub session files and stub Telegram clients, so it does not need real Telegram credentials. It validates the auth decision and the eventual session path used by the client builder. Run on current master: ```bash git clone https://github.com/leshchenko1979/fast-mcp-telegram.git cd fast-mcp-telegram python validation_token_traversal.py ``` The local proof script created for validation is attached below for reference: ```python # High-level proof outline # 1. Create a temporary session directory containing telegram.session and a random token session. # 2. Instantiate SessionFileTokenVerifier with that directory. # 3. Verify denied controls: token `telegram` is rejected, and a traversal token to a missing file is rejected. # 4. Verify allowed control: a normal random token with a matching session file is accepted. # 5. Verify bypass: token `../fast-mcp-telegram/telegram` is accepted and the client builder receives the default telegram.session path. # 6. Verify prefix behavior: account-prefixed tools are listed for the traversal-authenticated default account, a prefixed call reaches send_message, and an unprefixed call is still denied. ``` Key controls from the current-master run: ```json { "reserved_default_token_denied": true, "normal_random_token_allowed": true, "missing_traversal_token_denied": true, "traversal_alias_to_reserved_default_allowed": true, "traversal_access_token_value": "../fast-mcp-telegram/telegram", "client_builder_used_default_session_file": true, "prefixed_tool_listed_for_traversal_token": "defaultalice_send_message", "prefixed_tool_call_reached_handler_as": "send_message", "unprefixed_tool_call_denied_when_prefix_resolved": true } ``` Interpretation: 1. Denied control: the exact reserved token `telegram` is rejected. 2. Allowed control: a normal random session token is accepted when its matching session file exists. 3. Denied control: a traversal token pointing to a missing file is rejected. 4. Bypass: `../fast-mcp-telegram/telegram` authenticates and the client builder receives the resolved default session path. 5. Prefix control: once authenticated through the traversal token, account-prefixed tools are listed and a prefixed `tools/call` reaches the internal `send_message` handler. An unprefixed call is rejected when the prefix resolves, so the confirmed bug is the session selection and authentication bypass, not a missing-prefix execution bypass. ## Why this crosses the auth boundary A production HTTP auth deployment is expected to require high-entropy per-session bearer tokens. Reserved names are explicitly blocked because common names such as `telegram` can collide with the default session. The traversal alias turns the public token namespace back into a filesystem namespace and bypasses that reserved-name policy. The account-prefix middleware is downstream of authentication. It labels tools based on the resolved Telegram account for the token that was accepted. Because the traversal token is accepted as a valid FastMCP `AccessToken`, the middleware correctly exposes the default account's prefixed tools to the attacker. It cannot recover the lost authentication boundary. ## Remediation Reject bearer tokens that are not strict opaque token identifiers before using them in file paths. Recommended checks: 1. Accept only a safe token alphabet, for example `^[A-Za-z0-9_-]{32,128}$`, matching generated URL-safe base64 tokens. 2. Reject `/`, `\\`, `.`, `..`, empty segments, and absolute paths for both header auth and URL auth. 3. Resolve the final session path and require it to remain directly under the configured session directory: ```python session_dir = self._session_directory.resolve() session_path = (session_dir / f"{token}.session").resolve() if session_path.parent != session_dir: return None ``` 4. Apply the same validation in `SessionFileTokenVerifier`, URL auth middleware, setup flows, cleanup code, and any code that opens session files by token. 5. Add regression tests for exact reserved names, traversal aliases such as `../fast-mcp-telegram/telegram`, absolute paths, URL-encoded traversal if any route decodes path components, Windows separators, and normal generated tokens.

CVE-2026-52830 Affected fast-mcp-telegram Versions

1 component(s)
Fixed Versions:
0.19.1
Product / Package Ecosystem Affected Versions Fixed Version
fast-mcp-telegram
PyPI
< 0.19.1
0.19.1

References

Frequently Asked Questions

What is CVE-2026-52830?
CVE-2026-52830 is a security vulnerability in fast-mcp-telegram involving Bearer token path traversal bypasses reserved Telegram session protection under CWE-287: Improper Authentication.
Which fast-mcp-telegram versions are affected?
Affected versions include releases prior to 0.19.1 across affected packages: fast-mcp-telegram.
What version fixes CVE-2026-52830?
Upgrading to 0.19.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is fast-mcp-telegram affected?
Yes, fast-mcp-telegram is affected in releases prior to 0.19.1. Upgrade your dependency to 0.19.1 or later.
What is the CVSS score of CVE-2026-52830?
CVE-2026-52830 has a CVSS v3.1 base score of 9.4 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L.
What CWE is associated with CVE-2026-52830?
CVE-2026-52830 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check PyPI dependencies for CVE-2026-52830?
Run the dependency tree command: 'pip show fast-mcp-telegram'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rxw2-pc8j-vxwm",
  "modified" : "2026-08-13T16:57:36Z",
  "published" : "2026-07-02T20:38:50Z",
  "aliases" : [ "CVE-2026-52830" ],
  "summary" : "fast-mcp-telegram: Bearer token path traversal bypasses reserved Telegram session protection",
  "details" : "## Summary\n\nfast-mcp-telegram validates HTTP Bearer tokens by joining the raw token string into a session-file path. The verifier rejects the exact reserved token `telegram`, but it does not reject path separators or normalize the path before checking whether the session file exists. A remote HTTP client can therefore authenticate as the default legacy session with a token such as `../fast-mcp-telegram/telegram` when the documented default session file `~/.config/fast-mcp-telegram/telegram.session` exists.\n\nThis bypasses the reserved session name control that is intended to prevent HTTP multi-user sessions from colliding with the default stdio or legacy account. With account-prefixed MCP tools enabled, the attacker still sees and calls the prefixed tools for the default account, so the prefix middleware does not stop the session selection bypass.\n\n## Impact\n\nAn unauthenticated network client can access the Telegram account represented by the default `telegram.session` file without knowing a generated bearer token, if that legacy or default session file is present on a server running HTTP auth. The attacker can then call Telegram MCP tools as that account, including message reading, message sending, MTProto API calls, and attachment-producing tool surfaces available to the session.\n\n## Technical details\n\n`SessionFileTokenVerifier.verify_token()` strips whitespace and rejects exact reserved names:\n\n```python\nif token.lower() in RESERVED_SESSION_NAMES:\n    return None\n```\n\nIt then appends `.session` to the raw token and checks the resulting path:\n\n```python\nsession_path = self._session_directory / f\"{token}.session\"\nif not session_path.is_file():\n    return None\n```\n\nNo check rejects `/`, `\\\\`, `..`, absolute paths, or resolved paths outside the configured session directory. The session client path is built the same way in `src/client/connection.py`:\n\n```python\nsession_path = SESSION_DIR / f\"{token}.session\"\nclient = await _build_telegram_client_for_token(session_path, token)\n```\n\nWith the default session directory, the token `../fast-mcp-telegram/telegram` resolves as follows:\n\n```text\n~/.config/fast-mcp-telegram/../fast-mcp-telegram/telegram.session\n= ~/.config/fast-mcp-telegram/telegram.session\n```\n\nThe exact token `telegram` is denied, but the traversal alias reaches the same file and is accepted. This is especially important because `telegram` is the documented default `session_name`, and the security documentation says reserved names are blocked to prevent conflicts with stdio and HTTP no-auth sessions.\n\nThe vulnerable code is present on current `master` commit `167ab705f1cd09b21e85c370570471fe75a4f8c9` and in release tag `0.19.0` commit `77bdf6d7e5c6a84d87acc423db613e6c6ba30094`.\n\n## Reproduction\n\nThe following proof uses stub session files and stub Telegram clients, so it does not need real Telegram credentials. It validates the auth decision and the eventual session path used by the client builder.\n\nRun on current master:\n\n```bash\ngit clone https://github.com/leshchenko1979/fast-mcp-telegram.git\ncd fast-mcp-telegram\npython validation_token_traversal.py\n```\n\nThe local proof script created for validation is attached below for reference:\n\n```python\n# High-level proof outline\n# 1. Create a temporary session directory containing telegram.session and a random token session.\n# 2. Instantiate SessionFileTokenVerifier with that directory.\n# 3. Verify denied controls: token `telegram` is rejected, and a traversal token to a missing file is rejected.\n# 4. Verify allowed control: a normal random token with a matching session file is accepted.\n# 5. Verify bypass: token `../fast-mcp-telegram/telegram` is accepted and the client builder receives the default telegram.session path.\n# 6. Verify prefix behavior: account-prefixed tools are listed for the traversal-authenticated default account, a prefixed call reaches send_message, and an unprefixed call is still denied.\n```\n\nKey controls from the current-master run:\n\n```json\n{\n  \"reserved_default_token_denied\": true,\n  \"normal_random_token_allowed\": true,\n  \"missing_traversal_token_denied\": true,\n  \"traversal_alias_to_reserved_default_allowed\": true,\n  \"traversal_access_token_value\": \"../fast-mcp-telegram/telegram\",\n  \"client_builder_used_default_session_file\": true,\n  \"prefixed_tool_listed_for_traversal_token\": \"defaultalice_send_message\",\n  \"prefixed_tool_call_reached_handler_as\": \"send_message\",\n  \"unprefixed_tool_call_denied_when_prefix_resolved\": true\n}\n```\n\nInterpretation:\n\n1. Denied control: the exact reserved token `telegram` is rejected.\n2. Allowed control: a normal random session token is accepted when its matching session file exists.\n3. Denied control: a traversal token pointing to a missing file is rejected.\n4. Bypass: `../fast-mcp-telegram/telegram` authenticates and the client builder receives the resolved default session path.\n5. Prefix control: once authenticated through the traversal token, account-prefixed tools are listed and a prefixed `tools/call` reaches the internal `send_message` handler. An unprefixed call is rejected when the prefix resolves, so the confirmed bug is the session selection and authentication bypass, not a missing-prefix execution bypass.\n\n## Why this crosses the auth boundary\n\nA production HTTP auth deployment is expected to require high-entropy per-session bearer tokens. Reserved names are explicitly blocked because common names such as `telegram` can collide with the default session. The traversal alias turns the public token namespace back into a filesystem namespace and bypasses that reserved-name policy.\n\nThe account-prefix middleware is downstream of authentication. It labels tools based on the resolved Telegram account for the token that was accepted. Because the traversal token is accepted as a valid FastMCP `AccessToken`, the middleware correctly exposes the default account's prefixed tools to the attacker. It cannot recover the lost authentication boundary.\n\n## Remediation\n\nReject bearer tokens that are not strict opaque token identifiers before using them in file paths. Recommended checks:\n\n1. Accept only a safe token alphabet, for example `^[A-Za-z0-9_-]{32,128}$`, matching generated URL-safe base64 tokens.\n2. Reject `/`, `\\\\`, `.`, `..`, empty segments, and absolute paths for both header auth and URL auth.\n3. Resolve the final session path and require it to remain directly under the configured session directory:\n\n```python\nsession_dir = self._session_directory.resolve()\nsession_path = (session_dir / f\"{token}.session\").resolve()\nif session_path.parent != session_dir:\n    return None\n```\n\n4. Apply the same validation in `SessionFileTokenVerifier`, URL auth middleware, setup flows, cleanup code, and any code that opens session files by token.\n5. Add regression tests for exact reserved names, traversal aliases such as `../fast-mcp-telegram/telegram`, absolute paths, URL-encoded traversal if any route decodes path components, Windows separators, and normal generated tokens.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "fast-mcp-telegram"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.19.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.19.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/leshchenko1979/fast-mcp-telegram/security/advisories/GHSA-rxw2-pc8j-vxwm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-52830"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/alexeyleshchenko/fast-mcp-telegram"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/fast-mcp-telegram/PYSEC-2026-2473.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/fast-mcp-telegram"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20250926152207/https://github.com/leshchenko1979/fast-mcp-telegram"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-287" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-02T20:38:50Z",
    "nvd_published_at" : "2026-07-02T21:16:56Z"
  }
}