Mindsdb · Mindsdb · CVE-2022-23522
**Name of the Vulnerable Software and Affected Versions**
MindsDB versions prior to 22.11.4.3
**Description**
MindsDB is an open source machine learning platform. An unsafe extraction is being performed using `shutil.unpack archive()` from a remotely retrieved tarball, which may lead to the writing of the extracted files to an unintended location. This issue is sometimes called a TarSlip or a ZipSlip variant. Unpacking files using the high-level function `shutil.unpack archive()` from a potentially malicious tarball without validating that the destination file path remained within the intended destination directory may cause files to be overwritten outside the destination directory. An attacker could craft a malicious tarball with a filename path, such as `../../../../../../../../etc/passwd`, and then serve the archive remotely using a personal bucket `s3`, thus, retrieve the tarball through MindsDB and overwrite the system files of the hosting server.
**Recommendations**
For versions prior to 22.11.4.3, upgrade to version 22.11.4.3 or later to address the issue.
As a temporary workaround, consider validating the location of the extracted files and discard those with malicious paths such as relative path `..` or absolute path such as `/etc/password`.
Additionally, using a safer module like `zipfile` can help mitigate the issue.
Avoid ingesting archives from untrusted sources until the issue is resolved.