Summary
A code injection vulnerability in Flowise's CSVAgent feature allows attackers to supply custom Pandas CSV-read code that is executed on the server without proper sanitization.
In environments where untrusted users can configure or influence CSVAgent settings, this can lead to arbitrary command execution with the privileges of the Flowise server process.
Affected context
This issue affects Flowise deployments that enable and expose the CSVAgent functionality where:
- Users can define or modify the Pandas CSV read logic or related code snippets
- The server executes that user-provided code as part of CSV processing
- There are no strict controls on who can configure agents or upload flows
The risk is higher in shared or multi-tenant environments, or where external users can create or edit agents that run on a central Flowise instance.
Exploit preconditions
- Attack surface: Flowise UI or API endpoints that allow configuration of CSVAgent behavior or code snippets.
- Required access: Ability to create, edit, or otherwise influence CSVAgent settings or flows (e.g., authenticated user with agent-edit permissions, or any external interface that feeds into those settings).
- Trigger point: Execution of the CSVAgent when it attempts to read and process CSV data using the configured Pandas code.
- Why exploitation is possible: User-supplied code is interpolated into a Python execution context without sanitization, validation, or restriction, allowing arbitrary commands or Python code to run on the server.
Why this happens
The root cause is treating user-controllable configuration as executable code, which directly maps to CWE-94: Improper Control of Generation of Code ('Code Injection').
Instead of using fixed, parameterized APIs for CSV parsing, the implementation allows the CSVAgent to accept custom Pandas CSV read logic that is dynamically interpreted or executed by the server.
Because this code is not validated, sandboxed, or constrained to a safe subset, an attacker can craft input that escapes the intended CSV-processing behavior and injects arbitrary commands or Python statements.
Potential impact
- Execution of arbitrary system commands on the Flowise server
- Read, modification, or deletion of data accessible to the Flowise process
- Pivoting to other internal services or systems reachable from the server
- Compromise of credentials, API keys, or LLM provider secrets stored or accessed by the instance
- Full takeover of the application environment, depending on server privileges
General mitigation guidance
Effective mitigation focuses on removing the ability for untrusted data to influence executable code paths:
- Replace dynamic, user-provided code with declarative configuration options (e.g., flags and parameters passed to a fixed CSV parsing routine).
- Use safe, parameterized APIs for CSV parsing instead of constructing code strings that are evaluated or executed.
- Restrict agent configuration to trusted administrators and segregate high-privilege flows from user-managed flows.
- Apply least-privilege principles to the Flowise runtime (e.g., non-root OS user, minimal file and network permissions) to limit impact if code is executed.
- Consider sandboxing or isolating any component that must process potentially attacker-controlled transformations or scripts.
How teams detect issues like this
Detection generally combines code-level review with runtime monitoring:
- Static analysis: Search for dynamic evaluation of strings in CSVAgent-related code paths (e.g., use of
eval,exec, templated code strings, or similar constructs fed by configuration). - Code review: Flag any place where user input or configuration is concatenated into executable Python statements or shell commands; ensure CSV parsing is done via fixed APIs.
- Configuration policy: Enforce policies that prevent arbitrary script fragments in agent configuration; restrict who can modify advanced settings in Flowise.
- Runtime monitoring: Monitor server logs and command execution traces for suspicious patterns involving CSVAgent operations, such as unexpected system commands or unusual file access when CSV flows run.

