{"id":1844,"cve":"CVE-2026-42351","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-42351\/","cwe":"CWE-22","cwe_number":22,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/22","cvss_score":7.5,"published":"2026-05-08","owasp":"A01 Broken Access Control","odc":"Checking","cdc":"Missing Check","category":"Input Validation and Sanitization","subcategory":"Path Traversal","scope":"Remote","impact":"Information Disclosure","summary":"pygeoapi STAC path traversal allows unauthenticated directory exposure.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-42351\/","description":"pygeoapi is a Python server implementation of the OGC API suite of standards. From version 0.23.0 to before version 0.23.3, a raw string path concatenation vulnerability in pygeoapi's STAC FileSystemProvider plugin can allow for requests to STAC collection based collections to expose directories without authentication. The issue manifests when pygeoapi is deployed without a proxy or web front end that would normalize URLs with .. values, along with a resource of type stac-collection defined in configuration. This issue has been patched in version 0.23.3.","solution":"Upgrade pygeoapi to version 0.23.3 or later.","affected_component":"pygeoapi","fixed_by_upgrading":true,"vulnerable_code":"import os\n\ndef get_stac_collection_path(child_path, identifier):\n    \"\"\"\n    Simplified representation of the vulnerable logic in the\n    pygeoapi.provider.stac.STACProvider.get method before v0.23.3.\n\n    This function insecurely joins a base path with a user-provided\n    identifier, allowing for path traversal.\n    \"\"\"\n\n    # The vulnerability: `os.path.join` is used with a raw `identifier`\n    # from user input. If `identifier` is '..\/..', the resulting path\n    # will point outside of the intended `child_path`.\n    path = os.path.join(child_path, identifier)\n\n    # In the real application, the code would proceed to check if `path`\n    # is a directory and then list its contents, exposing them.\n    # For this example, we just return the constructed path.\n    return path","patched_code":"import os\nimport logging\n\n# This code is a self-contained representation of the logic used\n# in the pygeoapi patch. In the actual patch, these components are\n# integrated into the existing codebase structure.\n\nLOGGER = logging.getLogger(__name__)\n\nclass ProviderConnectionError(Exception):\n    \"\"\"Provider connection error\"\"\"\n    pass\n\n\ndef get_path_from_provider(data_path: str, safe_path: str) -> str:\n    \"\"\"\n    Safely join a path to a provider's data path, preventing path traversal.\n\n    This function resolves the absolute path of the combined path and ensures\n    it is located within the intended 'data_path' directory.\n\n    :param data_path: The provider's base data directory.\n    :param safe_path: The user-provided path component to be joined.\n\n    :raises ProviderConnectionError: If the resulting path is outside the\n                                     base 'data_path' directory (path\n                                     traversal detected).\n\n    :returns: The safely resolved, absolute path.\n    \"\"\"\n\n    LOGGER.debug(f'Safely joining {safe_path} to {data_path}')\n\n    # Vulnerable approach (for comparison, not used in fix):\n    # vulnerable_path = os.path.join(data_path, safe_path)\n    # If safe_path is '..\/secrets', vulnerable_path could resolve\n    # outside data_path.\n\n    # Fixed approach:\n    # 1. Join the paths.\n    # 2. Get the real, absolute path, resolving any '..' components.\n    resolved_path = os.path.abspath(os.path.join(data_path, safe_path))\n    \n    # 3. Ensure the base data_path is a common prefix of the resolved path.\n    #    This confirms the resolved path is still inside the base directory.\n    if os.path.commonprefix((resolved_path, data_path)) != data_path:\n        msg = 'unsafe path detected'\n        LOGGER.error(msg)\n        raise ProviderConnectionError(msg)\n\n    return resolved_path","payload_needed":true,"payload":"\/collections\/my-stac-collection\/items\/..\/..\/..\/..\/..\/..\/etc\/passwd","payload_status":"available","published_fix":[{"repository":"geopython\/pygeoapi","commit_url":"https:\/\/github.com\/geopython\/pygeoapi\/commit\/bf25b8695edbdd5476eeffc102b633d1d3e45f52","commit_subject":"STAC: secure resource pathing","units":[{"file":"pygeoapi\/provider\/filesystem.py","function":null},{"file":"pygeoapi\/provider\/filesystem.py","function":"FileSystemProvider.get_data_path"}]}],"references":null}