security: Path traversal in JpaUnarchiver — no filename sanitization #72

Closed
opened 2026-06-21 23:00:58 +00:00 by jmiller · 0 comments
Owner

Severity: CRITICAL

JpaUnarchiver reads the file path directly from the JPA binary header and uses it raw to construct the output path:

$dirPath  = $this->outputDir . '/' . $path;   // line 211
$fullPath = $this->outputDir . '/' . $path;   // line 230

A maliciously crafted JPA file with a path like ../../../../etc/cron.d/pwned would write files outside the staging directory.

Fix

Sanitize $path — reject absolute paths and ../ sequences, validate realpath() stays within $this->outputDir.

File

  • src/Engine/JpaUnarchiver.php:211,230
## Severity: CRITICAL `JpaUnarchiver` reads the file path directly from the JPA binary header and uses it raw to construct the output path: ```php $dirPath = $this->outputDir . '/' . $path; // line 211 $fullPath = $this->outputDir . '/' . $path; // line 230 ``` A maliciously crafted JPA file with a path like `../../../../etc/cron.d/pwned` would write files outside the staging directory. ## Fix Sanitize `$path` — reject absolute paths and `../` sequences, validate `realpath()` stays within `$this->outputDir`. ## File - `src/Engine/JpaUnarchiver.php:211,230`
jmiller added the component: engine label 2026-06-21 23:00:58 +00:00
Sign in to join this conversation.
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteBackup#72