Summary
YunaiV yudao-cloud (Ruoyi-Vue-Pro) up to version 3.8.0 contains an improper authentication flaw in the doFilterInternal method of JwtAuthenticationTokenFilter.java, where the mock-token argument can be manipulated to bypass normal login checks.
A remote attacker who can send crafted HTTP requests may obtain unauthorized access by abusing this token handling logic, especially in deployments that trust the mock token path in non-production environments.
Affected context
The vulnerability appears in yudao-cloud deployments using the Ruoyi-Vue-Pro component with JWT-based authentication.
It specifically affects the JwtAuthenticationTokenFilter filter chain logic, where a mock-token parameter or header is inspected and can influence authentication state.
Environments that expose this logic over the network and allow the mock token feature outside tightly controlled test or development scenarios are more likely to be impacted.
Exploit preconditions
- Attack surface: HTTP interface protected by the JwtAuthenticationTokenFilter
- Required access: Ability to send crafted requests to endpoints using JWT-based authentication
- Trigger point: Processing of the
mock-tokenargument insidedoFilterInternalduring request filtering - Why exploitation is possible: The filter treats the
mock-tokeninput as implicitly trusted or inadequately validated, allowing an attacker to influence authentication decisions and possibly obtain an authenticated security context without valid credentials
Why this happens
The root cause falls under CWE-287: Improper Authentication.
The authentication filter contains logic that treats a mock-token argument as a special case, likely intended for testing or internal use, and does not sufficiently distinguish between trusted and untrusted contexts.
As a result, the filter can assign an authenticated identity or bypass normal token verification based on externally supplied input.
This pattern breaks the assumption that only cryptographically valid JWTs or properly authenticated sessions result in authenticated requests.
Potential impact
- Unauthorized access to application endpoints that rely on JWT-based authentication
- Ability to perform actions as another user or as a generic authenticated principal
- Exposure of sensitive data protected by authentication checks
- Escalation of privileges if the mock token is mapped to higher-privileged roles
- Undermining of audit trails due to spoofed identities
General mitigation guidance
Mitigation typically centers on tightening authentication logic and removing or hardening mock or test-only paths.
Common defensive patterns include:
- Eliminating trust in any client-supplied
mock-tokenor similar testing parameters in production environments - Ensuring all authentication decisions are derived from fully validated, cryptographically protected tokens
- Explicitly gating any mock or debug authentication features behind secure configuration flags that are disabled by default
- Applying strict separation between development/test and production configurations so that non-standard authentication flows cannot be enabled in production
- Enforcing least-privilege roles and defense-in-depth authorization checks so that a single authentication filter flaw does not grant broad access
How teams detect issues like this
Organizations can detect this class of issue by:
- Reviewing authentication filters and middleware for conditional branches handling "mock", "debug", or "test" tokens or bypass flags
- Using static analysis rules that flag authentication logic paths driven directly by request parameters or headers without strong verification
- Implementing security code review checklists that require justification for any non-standard or environment-specific authentication mechanisms
- Adding runtime monitoring and logging for unusual authentication events, such as tokens that do not align with expected issuers or claims but still result in successful authentication
- Incorporating automated tests that attempt to authenticate with malformed or arbitrary values in non-standard parameters to verify that they are ignored or rejected

