security: RestoreEngine staging path uses unsanitized $record->tag #77
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: HIGH
RestoreEngineat line 80 constructs the staging directory path using$record->tagdirectly from the database without sanitization:A crafted tag like
../../etc/would resolve outside/tmp/, allowing file extraction to arbitrary locations.Similarly,
SnapshotRestoreEngineat line 79 trusts$record->data_filefrom DB without validating it stays within the backup directory.Fix
Sanitize tag:
preg_replace('/[^a-zA-Z0-9_-]/', '', $record->tag)Validate data_file: check
realpath()stays withinBackupDirectory::getDefaultAbsolute()Files
src/Engine/RestoreEngine.php:80src/Engine/SnapshotRestoreEngine.php:79