Summary
Flowise 3.1.2 contains a critical code-injection vulnerability in the prediction API endpoint associated with a flow. A remote attacker who can reach the affected endpoint may be able to execute arbitrary code in the Flowise runtime, depending on deployment configuration and exposed access controls.
Affected context
The vulnerability occurs in Flowise 3.1.2 deployments that expose the /api/v1/prediction/<flowId> endpoint and process attacker-controlled request data through a code-execution path. Risk is higher when the endpoint is reachable from untrusted networks, authentication is absent or weak, or the Flowise process has broad operating-system or cloud permissions.
Exploit preconditions
- Attack surface: Network-accessible Flowise prediction API
- Required access: Ability to send requests to a reachable prediction endpoint; authentication requirements depend on deployment configuration
- Trigger point: Processing of a request for a selected flow through
/api/v1/prediction/<flowId> - Why exploitation is possible: Attacker-controlled input can reach an unsafe code execution or evaluation path, allowing unintended operations within the application process
Why this happens
The underlying issue is a code-injection flaw, mapped to CWE-94: Improper Control of Generation of Code ('Code Injection'). The vulnerable behavior occurs when externally influenced data is handled in a way that permits it to alter or invoke executable logic rather than being treated strictly as inert application data. This breaks the boundary between API input and trusted program instructions.
Potential impact
- An attacker may execute arbitrary code in the Flowise process context
- The application could be compromised or used to access connected services
- Sensitive configuration, credentials, or flow data could be exposed
- The host or container could be used for lateral movement
- Data could be modified, deleted, or poisoned
General mitigation guidance
Mitigation generally focuses on removing code-evaluation behavior from request processing and reducing the trust placed in API input.
Common defensive patterns include:
- Treating prediction parameters and flow identifiers as data only, never as executable expressions
- Replacing dynamic evaluation with allowlisted operations and typed interfaces
- Applying strict input validation, canonicalization, and schema enforcement
- Requiring strong authentication and authorization for prediction endpoints
- Restricting network exposure through gateways, segmentation, and policy controls
- Running Flowise with least-privilege operating-system, container, and cloud permissions
- Preventing access to unnecessary files, metadata services, and administrative interfaces
- Logging and rate-limiting sensitive API activity
How teams detect issues like this
Detection can combine application, code, and infrastructure controls:
- Use static analysis rules to identify dynamic evaluation, interpreter invocation, shell execution, or string-to-code conversion involving request data
- Review API handlers for unvalidated values flowing from route parameters or request bodies into executable functions
- Enforce pull-request policies that prohibit unsafe evaluation primitives and require security review for dynamic execution
- Monitor prediction endpoints for unusual flow identifiers, repeated probing, unexpected command-like input, and abnormal child-process creation
- Use runtime application protection and network policies to constrain outbound access and privileged operations
- Automated code review and software composition analysis tools may help identify related unsafe patterns

