Summary
Qwen-Agent through version 0.0.34 contains a path traversal weakness in its document parser, allowing user-supplied paths to escape intended directories. An attacker may use the unauthenticated Gradio interface to read files accessible to the server process.
Affected context
The issue may occur in deployments that expose Qwen-Agent's Gradio interface without authentication and use the document parser to process user-provided file paths. Risk is increased when the server process has read access to sensitive application, system, credential, or configuration files and the parser does not constrain access to an approved directory.
Exploit preconditions
- Attack surface: The document-upload or document-processing functionality exposed through the Gradio interface
- Required access: Access to the interface; authentication may not be required when the deployment leaves it unauthenticated
- Trigger point: Document parsing of an attacker-controlled file path
- Why exploitation is possible: The parser does not sufficiently validate or constrain absolute paths to the intended directory, allowing file access outside the permitted location
Why this happens
The underlying bug is improper neutralization of path elements used to identify files, which maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory. The parser trusts a user-controlled path without reliably canonicalizing it and verifying that the resulting file remains within an approved directory boundary. This insecure pattern allows filesystem access to be determined by external input rather than by an enforced server-side allowlist or containment check.
Potential impact
- Sensitive application configuration files may be disclosed
- Credentials, tokens, or private keys may be exposed if readable by the server process
- Source code and internal data may be retrieved
- Information gathered from local files could support follow-on attacks
- Privacy, confidentiality, and compliance protections could be weakened
General mitigation guidance
Mitigation generally focuses on reducing trust in user-supplied paths and enforcing filesystem boundaries before opening files.
Common defensive patterns include:
- Resolve and canonicalize paths before access checks
- Require the resolved path to remain within a dedicated, approved directory
- Prefer server-side file identifiers or opaque handles over client-supplied filesystem paths
- Use strict allowlists for permitted filenames and document types
- Reject absolute paths, parent-directory components, symbolic-link escapes, and unexpected path formats
- Run the service with least-privilege filesystem permissions
- Keep sensitive files outside directories readable by the application
- Apply authentication and authorization controls to interfaces that process documents
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules for file operations using request, form, or interface parameters
- Code review checks for missing canonicalization and directory-containment validation
- Tests covering absolute paths, parent-directory components, symbolic links, and alternate path representations
- Runtime monitoring for document requests that reference paths outside approved directories
- Policy enforcement requiring authenticated access and sandboxed document-processing locations
- Automated security review tools that flag user-controlled input reaching filesystem APIs

