CVE-2025-69286 Overview
RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine developed by Infiniflow. A critical insecure random number generation vulnerability exists in versions prior to 0.22.0 that affects the API key and beta token generation process. The use of an insecure key generation algorithm allows API keys and assistant/agent share authentication tokens to be mutually derivable, enabling unauthorized account takeover.
Both tokens are generated using the same URLSafeTimedSerializer with predictable inputs, creating a cryptographic weakness that allows an attacker who obtains a shared assistant/agent URL to derive the personal API key. This grants the attacker full control over the assistant/agent owner's account, compromising all associated data and configurations.
Critical Impact
An attacker with access to a shared assistant/agent URL can derive the account owner's personal API key, enabling complete account takeover and unauthorized access to all RAGFlow resources.
Affected Products
- Infiniflow RAGFlow versions prior to 0.22.0
- RAGFlow API key generation module (api/apps/system_app.py)
- RAGFlow beta token generation utilities (api/utils/__init__.py, api/utils/api_utils.py)
Discovery Timeline
- 2025-12-31 - CVE-2025-69286 published to NVD
- 2026-01-06 - Last updated in NVD database
Technical Details for CVE-2025-69286
Vulnerability Analysis
This vulnerability stems from a fundamental cryptographic design flaw in how RAGFlow generates both API keys and beta authentication tokens. The application relies on Python's URLSafeTimedSerializer from the itsdangerous library for token generation. While this serializer is suitable for creating time-limited signed tokens, the implementation uses predictable inputs for both the API key and the assistant/agent share tokens.
The core issue is that both token types share the same serialization mechanism with inputs that can be derived from one another. When a user shares an assistant or agent via a public URL, the authentication token embedded in that URL contains enough information for an attacker to reverse-engineer or derive the user's personal API key. This represents a violation of the cryptographic principle of key independence, where separate secrets should not be mathematically related.
The vulnerability enables a network-based attack requiring no authentication or user interaction. An attacker only needs to obtain a shared assistant/agent URL—which may be publicly posted or shared through collaboration—to exploit this weakness.
Root Cause
The root cause is the use of identical or predictable inputs to the URLSafeTimedSerializer for generating both API keys and beta share tokens. The vulnerable code paths exist in multiple files:
- api/apps/system_app.py (lines 214-215) - API key generation
- api/utils/__init__.py (line 343) - Utility functions for token handling
- api/utils/api_utils.py (line 378) - API utilities for token generation
By using the same serializer configuration and predictable seed values, the relationship between the two token types becomes deterministic rather than cryptographically independent. This falls under CWE-340: Generation of Predictable Numbers or Identifiers.
Attack Vector
The attack vector is network-based and requires no privileges or user interaction. The exploitation flow proceeds as follows:
- An attacker obtains a shared assistant/agent URL (publicly shared or through collaboration)
- The attacker extracts the beta authentication token from the URL
- Using knowledge of the predictable serializer inputs, the attacker derives the API key
- With the derived API key, the attacker gains full account access
The vulnerability mechanism relies on the mathematical relationship between tokens generated with URLSafeTimedSerializer. Since both tokens use predictable inputs derived from user account information, analyzing one token reveals sufficient information to reconstruct the other. For detailed technical analysis, refer to the GitHub Security Advisory.
Detection Methods for CVE-2025-69286
Indicators of Compromise
- Unexpected API key usage from unfamiliar IP addresses or geographic locations
- Multiple authentication attempts using derived API keys in rapid succession
- Access to account resources immediately following sharing of assistant/agent URLs
- Anomalous activity patterns on accounts that have recently shared assistants or agents
Detection Strategies
- Monitor API authentication logs for usage patterns that correlate with recently shared assistant/agent URLs
- Implement alerting for API key access from new IP addresses or user agents
- Track and correlate shared URL access with subsequent API authentication events
- Review access logs for accounts with shared assistants/agents for unauthorized operations
Monitoring Recommendations
- Enable comprehensive audit logging for all API key authentications and operations
- Implement real-time monitoring for API key usage anomalies, particularly after share events
- Configure alerts for administrative actions performed via API keys on accounts with active share URLs
- Establish baseline behavior profiles for API usage to detect deviation patterns
How to Mitigate CVE-2025-69286
Immediate Actions Required
- Upgrade RAGFlow to version 0.22.0 or later immediately
- Regenerate all API keys for accounts that have shared assistants or agents
- Revoke and recreate any active assistant/agent share URLs
- Audit account activity logs for any signs of unauthorized access
- Review and restrict sharing permissions where possible
Patch Information
Infiniflow has released version 0.22.0 to address this vulnerability. The fix implements cryptographically independent key generation for API keys and share tokens, eliminating the derivability issue. The security patch is available via the official commit.
Organizations should update immediately using their standard deployment process. After upgrading, all existing API keys and share tokens should be regenerated to ensure they are created using the secure algorithm.
Workarounds
- Disable assistant/agent sharing functionality until the patch can be applied
- Implement network-level restrictions to limit API access to trusted IP ranges
- Rotate API keys frequently and monitor for unauthorized usage
- Use additional authentication layers (such as IP allowlisting) for API access
- Consider temporarily restricting API key creation until the upgrade is complete
# Upgrade RAGFlow to patched version
cd /path/to/ragflow
git fetch origin
git checkout v0.22.0
# Or using pip if applicable
pip install ragflow>=0.22.0
# After upgrade, regenerate API keys via the admin interface
# Review and revoke existing share URLs
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


