Summary
The snailjob component in RuoYi-Vue-Plus allows user-controlled QLExpress expressions to be evaluated without proper filtering or sandboxing.
When attackers can reach the /snail-job/workflow/check-node-expression interface, they may craft expressions that leverage the File class to perform arbitrary file reads and writes on the server.
Affected context
This vulnerability affects RuoYi-Vue-Plus deployments using the snailjob component where workflow node expressions are evaluated dynamically through QLExpress.
The risk is present when:
- The /snail-job/workflow/check-node-expression endpoint is exposed (e.g., via internal tools or external API access), and
- User-supplied expression strings are passed directly to the QLExpress engine without enforcing a strict whitelist or sandbox,
- The runtime environment permits file system access from within expression execution.
Exploit preconditions
- Attack surface: HTTP access to the /snail-job/workflow/check-node-expression endpoint.
- Required access: Ability to submit or influence the QLExpress expression parameter (e.g., via authenticated panel or exposed API).
- Trigger point: Server-side evaluation of the attacker-controlled QLExpress expression.
- Why exploitation is possible: The expression engine is invoked with untrusted input and without restricting dangerous classes or APIs, allowing use of the File class and related I/O operations.
Why this happens
The root cause is the direct evaluation of untrusted expressions in a powerful expression language runtime without adequate sandboxing or validation.
This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), where user input is treated as executable logic.
QLExpress can access Java classes such as File, and because there is no robust restriction mechanism (e.g., blocked imports, class whitelists, or function-level permissions), an attacker can craft expressions that interact with the file system and potentially go beyond the intended business logic.
Potential impact
- Read sensitive configuration files that may contain credentials, tokens, or secret keys.
- Overwrite or create files on the server, potentially altering application behavior or logs.
- Facilitate further compromise by staging additional malicious data or scripts.
- Combine file access with other platform capabilities to move toward remote code execution or privilege escalation.
- Disrupt normal application operation by corrupting critical files or data.
General mitigation guidance
Effective mitigation centers on tightly controlling how expressions are handled and what capabilities they expose.
Common defensive patterns include:
- Minimizing or eliminating dynamic expression evaluation for user-controlled data where possible.
- Enforcing strict allowlists of safe functions, operators, and data structures within QLExpress.
- Configuring the expression engine to disallow access to Java reflection, file system APIs, and other sensitive classes.
- Introducing a server-side validation layer that parses and inspects expressions before evaluation, rejecting constructs outside the approved subset.
- Running the snailjob component under least-privilege OS accounts with constrained file system access.
- Isolating this component using containerization or sandboxing so that even if expressions are abused, the blast radius is reduced.
How teams detect issues like this
Detection typically combines code-level review with runtime monitoring:
- Static analysis and review:
- Look for code paths that pass request parameters directly into QLExpress or similar expression evaluators.
- Flag any use of generic eval-like APIs or expression engines without explicit sandbox configuration.
- Check for missing allowlists or policy enforcement around accessible classes and packages.
- Runtime monitoring:
- Log all evaluated expressions and monitor for suspicious patterns (e.g., references to File, I/O classes, or reflection-related APIs).
- Use anomaly detection on file access patterns originating from the snailjob process.
- Policy enforcement:
- Integrate security checks into CI/CD to block deployments when expression engines are used without explicit hardening.
- Employ application security testing tools that can fuzz expression endpoints and detect unexpected capabilities.

