Potential Zip Slip Vulnerability in restoreFromCheckpoint
and decompress
Methods
#18697
Labels
type-bug
This issue is about a bug
Alluxio Version:
2.9.4
Describe the bug
There is a potential security vulnerability related to Zip Slip (CWE-22) in the restoreFromCheckpoint method and the decompress method, which handle ZIP file extraction without sufficient validation of the file paths within the ZIP entries. Assuming that a malicious checkpoint file is passed to the
restoreFromCheckpoint(CheckpointInputStream input)
function:This
ZipFile
is then read and unzipped, with each entry unzipped in theunzipEntry
function:However, the
entry.getName()
function might return malicious entry name if the user crafted zip file contains malicious information. Specifically, the name could contain../
, which will allow traversal into unwanted paths. Indeed, theentry.getName()
path is un-sanitized and directly passed toFileOutputStream
.To Reproduce
Create a malicious ZIP file with entries that contain path traversal sequences, such as
../
or/
. Pass this ZIP file as a checkpoint to therestoreFromCheckpoint
method. Observe that files are extracted outside of the expected directory.Expected behavior
An exception should be thrown if an unwanted substring (such as
../
) is found in aZipArchiveEntry
.Urgency
This is a CWE-22 security vulnerability which will make the project vulnerable to whoever having access to the API for restoring from user supplied checkpoint.
The text was updated successfully, but these errors were encountered: