NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Langflow

CVE-2025-68478: External Control of File Name or Path in Langflow

highCVSS 3.1 7.1GHSA-f43r-cc68-gpx4

Langflow's flow-creation endpoint, POST /api/v1/flows/, accepts an `fs_path` in the request body and writes the flow's JSON to that path with no restriction. Any authenticated user can create or overwrite files anywhere the Langflow process can write. Upgrade to langflow 1.7.1.

Published Dec 19, 2025 · Updated Jun 6, 2026 · Analysis Nov 1, 2026

What an attacker can do

create_flow in src/backend/base/langflow/api/v1/flows.py saves the new flow to the database, then calls _save_flow_to_fs. Before that, _verify_fs_path touches the path if it does not exist. _save_flow_to_fs opens fs_path in write mode and writes flow.model_dump_json(). The code applies no base directory, no normalization and no allowlist. Absolute paths such as /etc/poc.txt are used as given, and relative paths allow directory traversal.

The caller needs a valid API key or JWT, so this is an authenticated arbitrary file write. The reporter reproduced it with a curl POST that set fs_path to /tmp/POC.txt. On a production host, writes to protected directories fail unless the process has rights.

The attacker does not control the file content, which is the flow's JSON. That still matters. Overwriting a config, log, task or data file can corrupt the app or break other components. If the target is read by a JSON parser or by a later job, the injected flow data may be acted on. The risk grows when Langflow runs as root or with writable mounts. Shared Langflow servers where many users hold keys are the main concern.

Who is affected

pip package langflow below the fixed release. The package data lists < 1.7.1 with patched 1.7.1; the advisory text says < 1.7.0. Treat anything older than 1.7.1 as affected. Any instance where more than one trusted person, or any untrusted user, holds a key or login is exposed.

pip show langflow

langflow

Ecosystem
PyPI
Affected
< 1.7.1
Fixed in
1.7.1
Check
pip show langflow

How to fix it

Upgrade to langflow 1.7.1:

pip install --upgrade "langflow>=1.7.1"

The advisory lists no workaround. It advises enforcing a save root, normalizing paths, blocking symlink traversal and minimizing permissions. Until you upgrade, run Langflow as an unprivileged user with a read-only file system apart from its data directory, and limit who holds API keys or accounts.

How to tell if you were hit

Check web or reverse-proxy logs for POST requests to /api/v1/flows/ whose body contains an fs_path field, especially one with an absolute path or ... In the Langflow database, look for flows with a non-empty fs_path. On the host, search for JSON files containing flow data (nodes and edges) in unexpected places such as /tmp or system directories, and for config or data files that were replaced.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Vulnerability Overview

If an arbitrary path is specified in the request body's fs_path, the server serializes the Flow object into JSON and creates/overwrites a file at that path. There is no path restriction, normalization, or allowed directory enforcement, so absolute paths (e.g., /etc/poc.txt) are interpreted as is.

Vulnerable Code

  1. It receives the request body (flow), updates the DB, and then passes it to the file-writing sink.

https://github.com/langflow-ai/langflow/blob/ac6e2d2eabeee28085f2739d79f7ce4205ca082c/src/backend/base/langflow/api/v1/flows.py#L154-L168

    @router.post("/", response_model=FlowRead, status_code=201)
    async def create_flow(
        *,
        session: DbSession,
        flow: FlowCreate,
        current_user: CurrentActiveUser,
    ):
        try:
            db_flow = await _new_flow(session=session, flow=flow, user_id=current_user.id)
            await session.commit()
            await session.refresh(db_flow)
    
            await _save_flow_to_fs(db_flow)
    
        except Exception as e:
  1. Applies authentication dependency (requires API Key/JWT) when accessing the endpoint.

https://github.com/langflow-ai/langflow/blob/ac6e2d2eabeee28085f2739d79f7ce4205ca082c/src/backend/base/langflow/api/utils/core.py#L36-L38

    CurrentActiveUser = Annotated[User, Depends(get_current_active_user)]
    CurrentActiveMCPUser = Annotated[User, Depends(get_current_active_user_mcp)]
    DbSession = Annotated[AsyncSession, Depends(get_session)]
  1. The client can directly specify the save path, including fs_path.

https://github.com/langflow-ai/langflow/blob/ac6e2d2eabeee28085f2739d79f7ce4205ca082c/src/backend/base/langflow/api/v1/flows.py#L66-L70

    ):
        try:
            await _verify_fs_path(flow.fs_path)
    
            """Create a new flow."""
  1. It attempts to create the file (or *the* file, in the case of a path without a parent) directly without path validation.

https://github.com/langflow-ai/langflow/blob/ac6e2d2eabeee28085f2739d79f7ce4205ca082c/src/backend/base/langflow/api/v1/flows.py#L45-L49

    async def _verify_fs_path(path: str | None) -> None:
        if path:
            path_ = Path(path)
            if not await path_.exists():
                await path_.touch()
  1. Serializes the Flow object to JSON and writes it to the specified path in "w" mode (overwriting).

https://github.com/langflow-ai/langflow/blob/ac6e2d2eabeee28085f2739d79f7ce4205ca082c/src/backend/base/langflow/api/v1/flows.py#L52-L58

    async def _save_flow_to_fs(flow: Flow) -> None:
        if flow.fs_path:
            async with async_open(flow.fs_path, "w") as f:
                try:
                    await f.write(flow.model_dump_json())
                except OSError:
                    await logger.aexception("Failed to write flow %s to path %s", flow.name, flow.fs_path)

PoC Description

When an authenticated user passes an arbitrary path in fs_path, the Flow JSON is written to that path. Since /tmp is usually writable, it is easy to reproduce. In a production environment, writing to system-protected directories may fail depending on permissions.

PoC

  • Before Exploit
  • After Exploit
    curl -sS -X POST "http://localhost:7860/api/v1/flows/" \
      -H "Content-Type: application/json" \
      -H "x-api-key: sk-8Kyzf9IQ-UEJ_OtSTaJq4eniMT9_JKgZ7__q8PNkoxc" \
      -d '{"name":"poc-etc","data":{"nodes":[],"edges":[]},"fs_path":"/tmp/POC.txt"}'

Impact

  • Authenticated Arbitrary File Write (within server permission scope): Risk of corrupting configuration/log/task files, disrupting application behavior, and tampering with files read by other components.
  • Both absolute and relative paths are allowed, enabling base directory traversal. The risk of overwriting system files increases in environments with root privileges or weak mount/permission settings.
  • The file content is limited to Flow JSON, but the impact is severe if the target file is parsed by a JSON parser or is subject to subsequent processing.
  • In production environments, it is essential to enforce a save root, normalize paths, block symlink traversal, and minimize permissions.

Credited to J1vvoo, im-soohyun.

Questions

Can an unauthenticated user exploit CVE-2025-68478?

No. The create-flow endpoint requires an API key or JWT. Any authenticated user can set the path, though.

Can the attacker choose what is written?

Not freely. The content is the flow's JSON. The impact comes from overwriting files and from other components that parse the target file.

Does it need root to be serious?

Root raises the risk, but any file the Langflow process can write is at stake, including its own config and data files.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Langflow vulnerabilities

All Langflow entries