ZIP path traversal risk in BundleImportService #168

Closed
opened 2026-04-10 16:03:57 +02:00 by shahondin1624 · 0 comments
Owner

Severity: MEDIUM

Location

lib/Service/BundleImportService.php:325

Description

When extracting ZIP files, $zip->getNameIndex($i) returns the filename as stored in the ZIP, which could contain path traversal sequences (e.g., ../../etc/passwd). While basename() is used to strip directories (line 335), the basename() call happens after the hidden file checks but the content is read from the original index, not the basename. The actual risk is low because the content is only used as CSV data, not written to disk.

Recommendation

Add explicit path traversal validation: reject entries containing .. or absolute paths.

## Severity: MEDIUM ## Location `lib/Service/BundleImportService.php:325` ## Description When extracting ZIP files, `$zip->getNameIndex($i)` returns the filename as stored in the ZIP, which could contain path traversal sequences (e.g., `../../etc/passwd`). While `basename()` is used to strip directories (line 335), the `basename()` call happens after the hidden file checks but the content is read from the original index, not the basename. The actual risk is low because the content is only used as CSV data, not written to disk. ## Recommendation Add explicit path traversal validation: reject entries containing `..` or absolute paths.
shahondin1624 added the backendsecuritypriority:medium labels 2026-04-10 16:03:57 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shahondin1624/Mitgliederverwaltung#168