Summary
Backpack CRUD contains an improper path restriction flaw in its multiple-file upload deletion logic. An authenticated user with update permission may submit a disk-relative path that is not associated with the current record and cause another attachment, shared asset, or operational file to be deleted.
Affected context
The vulnerability occurs in Backpack CRUD configurations that use the affected HasUploadFields mutator for multiple-file uploads and permit authenticated users to update records. The deletion routine trusts paths supplied through the clear_<attribute>[] input and forwards them to the configured storage disk without confirming that each path belongs to the current model record. The newer MultipleFiles uploader uses a persisted-file intersection check and is not affected by this specific behavior. The 5.x line remains within the affected context.
Exploit preconditions
- Attack surface: An authenticated CRUD update endpoint using the affected upload-field mutator
- Required access: Permission to update a record through the relevant Backpack CRUD interface
- Trigger point: Processing of requested file removals during an update operation
- Why exploitation is possible: User-supplied disk-relative paths are passed to storage deletion without verifying ownership against the current record's persisted attachment list
Why this happens
The underlying flaw is an improper restriction of file paths combined with insufficient authorization validation. The deletion logic treats a client-provided path as authorized merely because it appears in a removal request, rather than deriving the allowed deletion set from files persisted on the current record. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related authorization weaknesses represented by CWE-285 and CWE-639.
Potential impact
- An attacker may delete attachments belonging to another record.
- Shared assets on the configured storage disk could be removed.
- Operational files may be deleted, potentially disrupting application workflows.
- Data integrity and availability may be reduced.
- The flaw does not provide a direct capability to read the deleted files.
General mitigation guidance
Mitigation generally focuses on making deletion authorization server-derived rather than client-controlled.
Common defensive patterns include:
- Build the deletion candidate set exclusively from files persisted on the current model record.
- Confirm record ownership, tenant scope, and authorization before processing file changes.
- Canonicalize and constrain storage paths to the intended storage namespace.
- Reject paths that are not present in the record's trusted attachment metadata.
- Prefer upload components that intersect requested removals with the record's persisted file list.
- Apply least-privilege permissions to application storage identities and separate shared assets from user-managed uploads where practical.
- Treat client-provided file paths as references requiring authorization, not as authoritative deletion instructions.
How teams detect issues like this
Organizations can assess for this issue through:
- Static analysis rules that identify storage deletion calls receiving request-controlled paths.
- Code review checks for file-removal logic that lacks comparison with persisted model metadata.
- Tests verifying that a user cannot remove files associated with another record or storage scope.
- Policy enforcement requiring authorization and ownership checks before destructive filesystem operations.
- Runtime audit logging for storage deletions, including the acting identity, record identifier, and resolved path.
Automated security review tools may help identify data-flow paths from request parameters to file deletion APIs.

