Summary
A path traversal vulnerability in dromara lamp-cloud's chunk-check endpoint allows remote attackers to influence how a requested file name is interpreted. When the endpoint processes attacker-controlled Name input without adequately restricting path resolution, an attacker may access files outside the intended directory.
Affected context
The issue occurs in the chunk-check processing handled by FileChunkController.java in lamp-cloud deployments up to the affected release range. Risk is present when the endpoint accepts remotely supplied file-name values and uses them in filesystem operations without reliably constraining the resolved path to the intended upload or chunk directory.
Exploit preconditions
- Attack surface: Remotely accessible chunk-check endpoint
- Required access: Network access to the endpoint; authentication requirements depend on deployment configuration
- Trigger point: Processing of the
Nameargument byFileChunkController.java - Why exploitation is possible: Insufficient path canonicalization or directory-boundary enforcement may allow attacker-controlled path components to resolve outside the expected storage location
Why this happens
The underlying bug is improper limitation of a user-controlled path value. When file names are incorporated into filesystem paths without canonicalization, normalization, and verification that the final path remains within an intended directory, traversal sequences can escape the permitted storage area. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- An attacker may read sensitive files accessible to the application process
- An attacker could disclose configuration, credentials, or application data
- An attacker may interfere with chunked-upload state or stored files
- Exposure of sensitive files could enable further compromise
General mitigation guidance
Mitigation generally focuses on treating file-name parameters as untrusted identifiers rather than filesystem paths.
Common defensive patterns include:
- Resolving candidate paths and verifying they remain within a fixed, intended storage directory
- Rejecting traversal components, absolute paths, encoded separators, and other ambiguous path forms
- Preferencing server-generated opaque identifiers over client-selected file names
- Applying allowlists for permitted file-name formats and chunk identifiers
- Restricting the application process to the minimum filesystem permissions required
- Separating uploaded content from application code, secrets, and system directories
- Returning generic errors that do not disclose filesystem details
How teams detect issues like this
Organizations can look for path traversal risks through:
- Static analysis rules targeting user input passed to file and path APIs
- Code review checks for missing canonicalization and directory-boundary validation
- Tests covering encoded, normalized, absolute, and separator-based path variants
- Web application firewall or gateway policies that detect traversal indicators
- Runtime monitoring for unusual file access outside approved upload directories
- Automated review tools that flag filesystem operations using request parameters

