/

CVE-2026-51888

Severity:

HIGH RISK

(7.5)

Directory Traversal (CWE-22) in Langflow Knowledge API

CVE-2026-51888

Awaiting Analysis

Vulnerability type

Category:

Directory Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write and File Overwrite

Severity:

HIGH RISK

(7.5)

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's knowledge-base creation endpoint may accept attacker-controlled absolute paths and use them when creating files. If the HTTP service is reachable and the request can influence the path or filename, an attacker may write or overwrite files outside the intended workspace or storage boundary.

Langflow's knowledge-base creation endpoint may accept attacker-controlled absolute paths and use them when creating files. If the HTTP service is reachable and the request can influence the path or filename, an attacker may write or overwrite files outside the intended workspace or storage boundary.

Affected context

The vulnerability occurs in deployments running the Langflow knowledge-base creation API when request-controlled path or filename values reach host-side file creation without effective boundary enforcement. Risk is greater when the endpoint is publicly reachable, exposed through a browser-backed service, or operated with permissions that allow writes to sensitive locations.

The vulnerability occurs in deployments running the Langflow knowledge-base creation API when request-controlled path or filename values reach host-side file creation without effective boundary enforcement. Risk is greater when the endpoint is publicly reachable, exposed through a browser-backed service, or operated with permissions that allow writes to sensitive locations.

Exploit preconditions

  • Attack surface: HTTP or browser-backed knowledge-base creation service
  • Required access: Ability to submit requests to the affected endpoint; authentication requirements depend on deployment configuration
  • Trigger point: Knowledge-base creation processing in knowledge_bases-create_knowledge_base
  • Why exploitation is possible: An attacker-controlled absolute path may be used for file creation without sufficient canonicalization and workspace-boundary checks
  • Attack surface: HTTP or browser-backed knowledge-base creation service
  • Required access: Ability to submit requests to the affected endpoint; authentication requirements depend on deployment configuration
  • Trigger point: Knowledge-base creation processing in knowledge_bases-create_knowledge_base
  • Why exploitation is possible: An attacker-controlled absolute path may be used for file creation without sufficient canonicalization and workspace-boundary checks

Why this happens

The underlying bug is improper limitation of a pathname to an intended directory, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The endpoint appears to pass untrusted path or filename data into file-system operations without reliably rejecting absolute paths or confirming that the resolved destination remains within an approved storage root.

The underlying bug is improper limitation of a pathname to an intended directory, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The endpoint appears to pass untrusted path or filename data into file-system operations without reliably rejecting absolute paths or confirming that the resolved destination remains within an approved storage root.

Potential impact

  • An attacker may write files outside the intended workspace
  • Existing files may be overwritten if the service has suitable permissions
  • Application configuration or operational data could be modified
  • Service integrity or availability could be affected
  • In some deployments, file writes could support further compromise through altered executable or configuration content
  • An attacker may write files outside the intended workspace
  • Existing files may be overwritten if the service has suitable permissions
  • Application configuration or operational data could be modified
  • Service integrity or availability could be affected
  • In some deployments, file writes could support further compromise through altered executable or configuration content

General mitigation guidance

Mitigation generally focuses on making storage locations server-controlled and preventing request data from selecting arbitrary file-system destinations.

Common defensive patterns include:

  • Generate opaque server-side filenames instead of accepting paths from clients
  • Resolve candidate paths and verify that they remain beneath an approved storage root
  • Reject absolute paths, traversal segments, alternate path formats, and unexpected separators
  • Apply strict allowlists for file types and naming formats
  • Use dedicated storage areas with least-privilege permissions and limited write scope
  • Avoid overwriting existing files unless replacement is explicitly required and authorized
  • Treat uploaded or generated content as untrusted and keep it separate from executable or sensitive locations

Mitigation generally focuses on making storage locations server-controlled and preventing request data from selecting arbitrary file-system destinations.

Common defensive patterns include:

  • Generate opaque server-side filenames instead of accepting paths from clients
  • Resolve candidate paths and verify that they remain beneath an approved storage root
  • Reject absolute paths, traversal segments, alternate path formats, and unexpected separators
  • Apply strict allowlists for file types and naming formats
  • Use dedicated storage areas with least-privilege permissions and limited write scope
  • Avoid overwriting existing files unless replacement is explicitly required and authorized
  • Treat uploaded or generated content as untrusted and keep it separate from executable or sensitive locations

How teams detect issues like this

Organizations can identify this class of issue through:

  • Static analysis rules for request-derived values passed to file open, write, rename, or copy operations
  • Code review checks for missing canonicalization and containment validation
  • Tests using absolute paths, traversal sequences, encoded separators, and platform-specific path forms
  • Runtime logging of rejected and accepted storage paths, without exposing sensitive content
  • Web-application policies that restrict file-creation endpoints to approved destinations and naming schemes
  • Automated security testing or code-review tools that flag path construction from HTTP parameters

Organizations can identify this class of issue through:

  • Static analysis rules for request-derived values passed to file open, write, rename, or copy operations
  • Code review checks for missing canonicalization and containment validation
  • Tests using absolute paths, traversal sequences, encoded separators, and platform-specific path forms
  • Runtime logging of rejected and accepted storage paths, without exposing sensitive content
  • Web-application policies that restrict file-creation endpoints to approved destinations and naming schemes
  • Automated security testing or code-review tools that flag path construction from HTTP parameters

Sources

SourceLink
gist.github.comgist.github.com/Ro1ME/c85f513d1fd702c686cffe061cbf8ef5

Frequently asked

questions

It can be remotely exploitable when the knowledge-base creation endpoint is reachable and request data can influence the file path or filename. Authentication, network exposure, and authorization controls determine the practical scope.

The attacker needs access to submit a request accepted by the affected endpoint. This may require authentication or another permitted application session, depending on how the Langflow service is deployed.

Keep the destination directory under server control, use generated filenames, and verify that every resolved path remains within an approved storage boundary before performing file operations.

Apply centralized path-validation utilities, use strict filename allowlists, test platform-specific path forms, and run the service with only the minimum file-system permissions it needs.

It can be remotely exploitable when the knowledge-base creation endpoint is reachable and request data can influence the file path or filename. Authentication, network exposure, and authorization controls determine the practical scope.

The attacker needs access to submit a request accepted by the affected endpoint. This may require authentication or another permitted application session, depending on how the Langflow service is deployed.

Keep the destination directory under server control, use generated filenames, and verify that every resolved path remains within an approved storage boundary before performing file operations.

Apply centralized path-validation utilities, use strict filename allowlists, test platform-specific path forms, and run the service with only the minimum file-system permissions it needs.

Find out what's already
exploitable in your codebase.