-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Arbitrary file write during tarfile extraction in luigi/contrib/lsf_runner.py
#3302
Comments
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 4, 2024
Fixes spotify#3302 Address arbitrary file write vulnerability during tarfile extraction in `luigi/contrib/lsf_runner.py`. * Add a function `_is_within_directory(directory, target)` to check if a target path is within a directory. * Add a function `_safe_extract(tar, path=".", members=None, *, numeric_owner=False)` to safely extract tar files. * Replace the existing tar extraction code with a call to `_safe_extract` in the `extract_packages_archive` function. * Add a test case `test_safe_extract` to verify the safe extraction of tar files in `test/contrib/lsf_test.py`. * Add a test case `test_safe_extract_with_traversal` to verify that directory traversal is prevented in `test/contrib/lsf_test.py`.
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 4, 2024
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 6, 2024
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 6, 2024
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 6, 2024
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 6, 2024
Ali-Razmjoo
added a commit
to Ali-Razmjoo/luigi
that referenced
this issue
Sep 6, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Hi,
I am reporting a potential security issue with arbitrary file write during tarfile extraction in
https://github.com/spotify/luigi/blob/master/luigi/contrib/lsf_runner.py#L55-L58
Extracting files from a malicious tar archive without validating that the destination file path is within the destination directory can cause files outside the destination directory to be overwritten, due to the possible presence of directory traversal elements (..) in archive paths.
..\malicious_file
c:\malicious_file
/etc/passwd
Recommendation
References
The text was updated successfully, but these errors were encountered: