Summary
RAGFlow's MinerU parser contains a Zip Slip path traversal flaw in its ZIP extraction routine, allowing archive entries to escape the intended directory.
When a crafted ZIP file is processed from a remote MinerU server, an attacker can overwrite arbitrary files on the RAGFlow server, which may be escalated to remote code execution depending on what files are replaced.
Affected context
This vulnerability affects deployments of RAGFlow that:
- Use version 0.23.1 (and potentially earlier versions),
- Rely on the MinerU parser to fetch and process ZIP archives from an external
mineru_server_url, - Allow ZIP contents to be extracted onto the server filesystem.
The issue manifests in the _extract_zip_no_root logic, where archive entry paths are not normalized or constrained to a dedicated extraction directory, enabling files to be written outside the intended path when malicious ZIP filenames are used.
Exploit preconditions
- Attack surface: Server-side ZIP processing within the MinerU parser.
- Required access: Ability to influence or control the ZIP archive delivered from
mineru_server_url(e.g., operating a malicious MinerU server, compromising it, or controlling the content it serves). - Trigger point: RAGFlow invoking
MinerUParserto retrieve and extract a ZIP file, which is then processed by_extract_zip_no_root. - Why exploitation is possible: Filenames inside the ZIP are trusted and written directly to disk without robust validation, canonicalization, or enforcement that the final paths stay within the designated extraction directory. This allows path traversal sequences (such as parent directory references) to overwrite arbitrary files on the host.
Why this happens
The core issue is a classic Zip Slip pattern, a subset of CWE-22: Path Traversal, where archive extraction code does not validate or normalize entry paths before writing them to disk.
In MinerU's _extract_zip_no_root implementation, paths provided by the ZIP entries are used directly to construct output file locations. Without stripping dangerous components (e.g., ../), rejecting absolute paths, or verifying that the resolved path remains under the intended root directory, an attacker can craft ZIP entries that escape the extraction directory. This insecure pattern arises when developers assume that archive contents are trustworthy or that the archive source is implicitly trusted, leading to file system writes outside the expected boundary.
Potential impact
- Overwriting application configuration files that may alter behavior or disable security features.
- Replacing executable scripts or binaries used by the application or environment, which can lead to remote code execution.
- Planting malicious code in locations that will be executed by scheduled tasks, startup scripts, or web server runtimes.
- Tampering with logs or data files, potentially enabling data corruption, loss of integrity, or cover-up of other malicious activity.
- Escalating from a limited application compromise to broader system compromise, depending on file system permissions and deployment configuration.
General mitigation guidance
Effective mitigation focuses on constraining file extraction paths and reducing trust in archive contents:
- Restrict all archive extraction to a dedicated directory and enforce that every extracted path, after normalization, remains within this directory.
- Normalize and validate each ZIP entry path before writing, rejecting:
- Absolute paths,
- Paths containing parent directory segments (
../), - Paths containing platform-specific traversal or device references.
- Implement a strict allowlist for acceptable file types and subdirectories, discarding unknown or unexpected entries.
- Run the RAGFlow and MinerU components under dedicated, least-privilege accounts that have limited filesystem write access, reducing impact if a traversal occurs.
- Consider using hardened, well-reviewed archive-handling utilities or libraries that provide built-in protections against Zip Slip style issues.
- Treat remotely supplied archives as untrusted input and subject them to the same validation, logging, and monitoring controls as other external data sources.
How teams detect issues like this
Identifying and monitoring for this vulnerability typically involves a combination of code and operational analysis:
- Static analysis and code review:
- Search for custom ZIP extraction logic that concatenates
zip_entry.filename(or equivalent) directly into file system paths. - Flag uses of
extractall, ad-hoc extraction loops, or manual path joins without subsequent normalization and boundary checks. - Verify that any path normalization is followed by an explicit check ensuring the resolved path remains within the intended base directory.
- Secure development policies:
- Establish guidelines requiring centralized archive handling utilities with built-in path validation.
- Enforce security-focused code review on all file system and archive-handling changes.
- Runtime monitoring:
- Monitor for unexpected file writes outside designated data directories during ZIP processing operations.
- Use file integrity monitoring (FIM) to detect unauthorized modifications to critical configuration or executable files.
- Correlate application logs indicating ZIP extraction with system logs showing changes to sensitive paths.
- Automated security tools (SAST/DAST) can be configured with rules to spot unsafe archive extraction patterns and suspicious file system behavior in test environments.

