/

CVE-2026-33309

Severity:

CRITICAL RISK

(9.9)

Path Traversal / External Control of File Name

CVE-2026-33309

Analyzed

Vulnerability type

Category:

Path Traversal / External Control of File Name

CWE:

CWE-22, CWE-73, CWE-94, CWE-284

Impact:

Arbitrary File Write leading to Remote Code Execution

Severity:

CRITICAL RISK

(9.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Langflow versions 1.2.0 through 1.8.1 contain an architectural flaw in LocalStorageService that allows authenticated users to control where uploaded files are written on the host file system.

Because the storage layer performs no boundary checks and relies solely on HTTP-layer filename validation, attackers can bypass guards on the POST /api/v2/files/ endpoint, leading to arbitrary file write and potential remote code execution.

Affected context

This vulnerability affects Langflow deployments using versions 1.2.0 through 1.8.1 where file uploads are handled by LocalStorageService.

The issue manifests when the application accepts multipart file uploads at the POST /api/v2/files/ endpoint and trusts the request-level filename validation without enforcing equivalent checks in the storage layer.

The risk is highest on instances where the Langflow process runs with permissions that allow writing into sensitive directories or paths interpreted as executable code by the host environment or application runtime.

Exploit preconditions

  • Attack surface: HTTP API file upload endpoint POST /api/v2/files/.
  • Required access: Valid authenticated access to Langflow, with permissions to upload files.
  • Trigger point: Submission of a crafted multipart/form-data upload whose filename parameter bypasses the HTTP-layer ValidatedFileName guard.
  • Why exploitation is possible:
  • The underlying LocalStorageService does not enforce directory or path containment (no canonicalization and boundary checks).
  • The system relies solely on the HTTP-layer validation to constrain filenames, creating a defense-in-depth gap.
  • As a result, attacker-controlled paths can be resolved and written directly on the host filesystem, enabling placement of executable or configuration files that can later be invoked to achieve RCE.

Why this happens

The root cause is an architectural reliance on external validation for file paths instead of enforcing constraints within the storage component itself.

LocalStorageService accepts file paths derived from user-controlled input without canonicalizing and verifying that the final path remains within an intended storage directory, mapping primarily to CWE-22: Path Traversal and CWE-73: External Control of File Name or Path.

This means the low-level storage layer lacks its own trust boundary, assuming that HTTP-layer safeguards (such as ValidatedFileName) are sufficient.

In practice, discrepancies between how the API layer and the storage layer interpret input allow bypasses, enabling attackers to write arbitrary files.

When those files influence code loading, script execution, or configuration, the flaw further intersects with CWE-94: Code Injection and CWE-284: Improper Access Control, as attackers can escalate from file write to remote code execution under the privileges of the Langflow process.

Potential impact

  • Arbitrary file write anywhere on the host filesystem accessible to the Langflow process.
  • Placement or modification of application files, scripts, or configuration leading to remote code execution.
  • Creation of web-accessible or service-accessible backdoors or shells, depending on the hosting environment.
  • Tampering with AI workflows, agent definitions, or data, potentially altering system behavior or exfiltrating information.
  • Escalation of privileges within the application context or lateral movement on the host if combined with other weaknesses.

General mitigation guidance

Effective mitigation focuses on enforcing strict path containment and defense-in-depth within the storage layer itself:

  • Implement canonicalization and directory boundary checks in LocalStorageService (or equivalent storage abstraction) to ensure all resolved paths stay within a predefined root directory.
  • Derive on-disk file names from server-side identifiers (such as UUIDs) rather than trusting client-supplied filenames for path construction.
  • Normalize and reject paths containing traversal sequences, absolute paths, or symbolic-link resolved paths that escape the intended storage root.
  • Apply least-privilege to the Langflow process and its file system permissions, restricting write access to a dedicated storage directory and preventing writes into system or executable paths.
  • Use layered validation: maintain HTTP-layer input checks, but treat them as advisory, not authoritative, with final enforcement happening in the storage component.
  • Consider segregating uploaded files into non-executable partitions or mount points to reduce the chance that uploaded content can be directly executed.

How teams detect issues like this

Detection should combine code-centric and environment-centric approaches:

  • Static analysis and code review:
  • Search for file write operations (e.g., open/write calls) that use input derived directly or indirectly from request filenames or paths.
  • Flag storage utilities that do not perform canonicalization and directory boundary checks before file creation.
  • Review for assumptions where lower-level services rely solely on upstream validation for security decisions (missing defense-in-depth).
  • Configuration and runtime monitoring:
  • Monitor for unexpected file creation or modification outside designated upload directories, especially near application code, configuration, or executable paths.
  • Use file integrity monitoring (FIM) to detect sudden changes in sensitive directories following file uploads.
  • Automated security testing:
  • Employ DAST or API-focused scanners configured to test file upload endpoints with path traversal patterns and unusual filename values.
  • Integrate SAST tooling into CI/CD pipelines with rules targeting CWE-22/CWE-73 patterns in storage and file handling code.
  • Policy enforcement:
  • Establish coding guidelines requiring storage components to enforce their own path constraints and prohibit trust in client-controlled filenames for path construction.

Sources

SourceLink
github.comgithub.com/langflow-ai/langflow/security/advisories/GHSA-g2j9-7rj2-gm6c

Frequently asked

questions

Yes. Any authenticated user who can reach the POST /api/v2/files/ endpoint can potentially exploit the flaw remotely, subject to their permissions and the deployment's network exposure.

It requires authenticated access with the ability to upload files. Additional privileges are not necessarily needed if the upload capability is broadly available, but the impact depends on what the Langflow process can write to on the host.

Centralize file path validation and containment within the storage service, ensuring it canonicalizes paths, enforces a fixed storage root, and ignores or rewrites client-supplied filenames into safe server-generated identifiers. The storage layer should never assume that upstream validation is sufficient.

Treat file handling as a separate trust boundary: design storage components to be self-defensive, avoid direct use of user-controlled path segments, apply least-privilege filesystem permissions, and use automated checks (SAST/secure code review) specifically targeting path traversal and arbitrary file write patterns across the codebase.

Find out what's already
exploitable in your codebase.