VAITP Dataset

← Back to the dataset

CVE-2026-69098

Unauthenticated RCE via insecure deserialization in the check_connection.

  • CVSS 9.3
  • 502
  • Input Validation and Sanitization
  • Remote

kotaemon through 0.12.0 contains an insecure deserialization vulnerability in the check_connection endpoint that allows unauthenticated attackers to instantiate arbitrary Python classes by supplying crafted YAML/JSON input with a __type__ field. Attackers can exploit this to override the __type__ field with subprocess.check_output and arbitrary arguments, achieving remote code execution with application process privileges.

CWE
502
CVSS base score
9.3
Published
2026-08-04
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Serialization Issues
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
kotaemon
Fixed by upgrading
Yes

Solution

Upgrade to kotaemon version 0.13.0 or later.

Vulnerable code sample

import importlib
from typing import Any, Dict, Type

def _import_class(class_path: str) -> Type[Any]:
    """Dynamically import a class from its full path."""
    module_path, class_name = class_path.rsplit(".", 1)
    module = importlib.import_module(module_path)
    return getattr(module, class_name)

class Serializable:
    """
    Base class for components in kotaemon that can be deserialized from a dict.
    This logic is triggered by endpoints like /check_connection from user JSON.
    """
    def __init__(self, **kwargs):
        pass

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "Serializable":
        """Deserialize a component based on the '__type__' field in the data."""
        if "__type__" not in data:
            raise ValueError("Deserialization data must contain a '__type__' field.")

        class_name = data.pop("__type__")
        
        # VULNERABLE: Class name from user input is used to dynamically load a class.
        component_class = _import_class(class_name)
        
        return component_class(**data)

Patched code sample

import importlib
from typing import Any, Dict, Type

def _is_allowed_module(module_path: str) -> bool:
    """Checks if a module is in an allow-list of safe-to-load modules."""
    # A real implementation would have a carefully curated list.
    return module_path.startswith("kotaemon.")

def _import_class(class_path: str) -> Type[Any]:
    """Dynamically import a class from its full path."""
    module_path, class_name = class_path.rsplit(".", 1)
    module = importlib.import_module(module_path)
    return getattr(module, class_name)

class Serializable:
    """
    Base class for components in kotaemon that can be deserialized from a dict.
    This logic is triggered by endpoints like /check_connection from user JSON.
    """
    def __init__(self, **kwargs):
        pass

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "Serializable":
        """Deserialize a component based on the '__type__' field in the data."""
        if "__type__" not in data:
            raise ValueError("Deserialization data must contain a '__type__' field.")

        class_name = data.pop("__type__")
        
        module_path, _ = class_name.rsplit(".", 1)
        # FIX: Validate the module path against an allow-list before importing.
        if not _is_allowed_module(module_path):
            raise ValueError(f"Module '{module_path}' is not allowed for deserialization.")
        
        component_class = _import_class(class_name)
        
        return component_class(**data)

Payload

{
    "__type__": "subprocess.check_output",
    "args": ["id"]
}

Cite this entry

@misc{vaitp:cve202669098,
  title        = {{Unauthenticated RCE via insecure deserialization in the check_connection.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-69098},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-69098/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::