The vulnerability is a path traversal issue within Portainer's backup restore feature. The root cause is the insecure handling of file paths during the extraction of .tar.gz archives. The function archive.ExtractTarGz located in api/archive/targz.go uses the standard filepath.Join and filepath.Clean functions to determine the destination of extracted files. However, this combination does not prevent directory traversal attacks. An attacker with administrator privileges can upload a specially crafted backup archive containing relative path components (e.g., ../). When Portainer restores this backup, the vulnerability can be triggered to write files to arbitrary locations on the server's filesystem, outside of the intended extraction directory. This could lead to remote code execution, for example, by writing a cron job or an SSH authorized key. The patch replaces the insecure path construction with a custom filesystem.JoinPaths function, which ensures that the final path is always within the intended destination directory, thus mitigating the vulnerability.