GitHub Security Advisory: GHSA-5993-7p27-66g5
Package: langflow (PIP)
Severity: HIGH (CVSS 7.7)
CWE: CWE-918: Server-Side Request Forgery (SSRF)
Vulnerable versions: < 1.7.1
Patched in: 1.7.1

Summary: Langflow vulnerable to Server-Side Request Forgery

Details:
**Vulnerability Overview**


Langflow provides an API Request component that can issue arbitrary HTTP requests within a flow. This component takes a user-supplied URL, performs only normalization and basic format checks, and then sends the request using a server-side httpx client. It does not block private IP ranges (127.0.0.1, the 10/172/192 ranges) or cloud metadata endpoints (169.254.169.254), and it returns the response body as the result.

Because the flow execution endpoints (/api/v1/run, /api/v1/run/advanced) can be invoked with just an API key, if an attacker can control the API Request URL in a flow, non-blind SSRF is possible—accessing internal resources from the server’s network context. This enables requests to, and collection of responses from, internal administrative endpoints, metadata services, and internal databases/services, leading to information disclosure and providing a foothold for further attacks.

**Vulnerable Code**
 
1. When a flow runs, the API Request URL is set via user input or tweaks, or it falls back to the value stored in the node UI.
    
    https://github.com/langflow-ai/langflow/blob/fa21c4e5f11a697431ef471d63ff70d20c05c6dd/src/backend/base/langflow/api/v1/endpoints.py#L349-L359
    
    ```python
    @router.post("/run/{flow_id_or_name}", response_model=None, response_model_exclude_none=True)
    async def simplified_run_flow(
        *,
        background_tasks: BackgroundTasks,
        flow: Annotated[FlowRead | None, Depends(get_flow_by_id_or_endpoint_name)],
        input_request: SimplifiedAPIRequest | None = None,
        stream: bool = False,
        api_key_user: Annotated[UserRead, Depends(api_key_security)],
        context: dict | None = None,
        http_request: Request,
    ):
    ```
    
    https://github.com/langflow-ai/langflow/blob/fa21c4e5f11a697431ef471d63ff70d20c05c6dd/src/backend/base/langflow/api/v1/endpoints.py#L573-L588
    
    ```bash
    @router.post(
        "/run/advanced/{flow_id_or_name}",
        response_model=RunResponse,
        response_model_exclude_none=True,
    )
    async def experimental_run_flow(
        *,
        session: DbSession,
        flow: Annotated[Flow, Depends(get_flow_by_id_or_endpoint_name)],
        inputs: list[InputValueRequest] | None = None,
        outputs: list[str] | None = None,
        tweaks: Annotated[Tweaks | None, Body(embed=True)] = None,
        stream: Annotated[bool, Body(embed=True)] = False,
        session_id: Annotated[None | str, Body(embed=True)] = None,
        api_key_user: Annotated[UserRead, Depends(api_key_security)],
    ) -> RunResponse:
    ```
    
2. Normalization/validation stage: It only checks that the URL is non-empty and well-formed. No blocking of private networks, localhost, or IMDS.
    
    https://github.com/langflow-ai/langflow/blob/fa21c4e5f11a697431ef471d63ff70d20c05c6dd/src/lfx/src/lfx/components/data/api_request.py#L280-L289
    
    ```python
        def _normalize_url(self, url: str) -> str: