Summary
Flowise contains a sandbox escape in its vm2 JavaScript isolation layer that can allow an authenticated user to execute arbitrary code. The issue becomes risky when crafted JavaScript objects bypass locale-based path validation and cause malicious files outside the sandbox to be loaded from the document store.
Affected context
The vulnerability affects Flowise deployments that execute user-influenced JavaScript within the vm2 sandbox and allow authenticated users to interact with functionality that performs locale validation or loads JavaScript from the document store. Risk depends on the availability of attacker-controlled inputs, access to the relevant Flowise features, and permissions granted to the application process.
Exploit preconditions
- Attack surface: Flowise functionality that evaluates JavaScript inside the vm2 sandbox
- Required access: An authenticated account with access to the affected execution or document-store features
- Trigger point: Locale validation and subsequent JavaScript file loading within the sandbox
- Why exploitation is possible: A crafted object can alter expected string behavior, bypass path traversal checks, and cause code outside the intended sandbox boundary to be loaded
Why this happens
The underlying bug is improper neutralization of behavior in dynamically evaluated code, mapping to CWE-95. Security-sensitive validation relies on object behavior that can be replaced or forged by attacker-controlled JavaScript values. When path checks trust such behavior and the sandbox can load files beyond its permitted scope, validation and isolation boundaries can be bypassed, enabling unintended code execution.
Potential impact
- An authenticated attacker may execute arbitrary code with the privileges of the Flowise process.
- The attacker could access, modify, or delete application and document-store data.
- The compromise could enable credential theft, data manipulation, or persistence.
- The attacker may use the affected host as a foothold for lateral movement, depending on deployment permissions.
- Availability of Flowise or connected services could be disrupted.
General mitigation guidance
Mitigation generally focuses on eliminating trust in attacker-controlled
object behavior and strengthening the boundary between evaluated code and
host resources.
Common defensive patterns include:
- Use a maintained isolation mechanism with explicit capability restrictions rather than relying only on JavaScript-level validation.
- Validate paths and file identities using trusted primitive values and canonicalized, allowlisted locations.
- Prevent sandboxed code from loading arbitrary modules or files from the document store.
- Apply strict authorization and least privilege to document-store access and code-execution features.
- Run the application with a dedicated low-privilege identity, restricted filesystem access, and minimal network permissions.
- Reduce input trust by enforcing schemas and rejecting unexpected object types before security-sensitive checks.
- Separate untrusted workflow execution from sensitive application services where practical.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules identifying dynamic evaluation, sandbox escape paths, unsafe module loading, and security checks based on overridable methods.
- Code review searches for path validation that operates on attacker-controlled objects instead of normalized primitive strings.
- Tests using hostile object types, unexpected prototypes, and boundary-focused file access cases.
- Runtime monitoring for unusual Flowise child processes, file reads outside approved directories, module loading, or unexpected outbound connections.
- Policy enforcement that restricts document-store permissions, evaluated-code features, and application filesystem access.
- Automated security review tools can help identify unsafe evaluation and sandbox-boundary patterns during development.

