CWE-22
## Summary `qbee-agent` contains a Zip Slip vulnerability in `app/utils/tar.go`. The tar extractor checks whether an entry remains inside the destination directory with: ```go strings.HasPrefix(targetPath, destdirClean) ``` This does not enforce a path separator boundary. If the destination directory is `/tmp/.../context`, a tar entry such as `../context-outside/payload.txt` cleans to `/tmp/.../context-outside/payload.txt` and still passes the prefix check. qbee-agent then creates the outside directory and writes the payload outside the intended extraction root. The issue is reachable through the Docker Compose build context path when `UseContext` is enabled. ## Details Code references below were verified against `qbee-io/qbee-agent` commit: - `1d8bdbb7422adb4ca563d3114cbe2817d6ba3581` Affected repository: - `qbee-io/qbee-agent` Affected files: - `app/utils/tar.go` - Docker Compose context path in `app/configuration/bundle_docker_compose.go` The vulnerable extraction code: - `app/utils/tar.go:89-93` ```go targetPath := filepath.Clean(filepath.Join(destPath, header.Name)) destdirClean := filepath.Clean(destPath) if !strings.HasPrefix(targetPath, destdirClean) { return fmt.Errorf("tar entry %s is outside of destination directory %s", targetPath, destdirClean) } ``` The file is then created at the accepted `targetPath`: - `app/utils/tar.go:96-109` ```go case tar.TypeDir: if err := os.MkdirAll(targetPath, 0755); err != nil { return err } case