Summary
Admidio's file-renaming function can use an unvalidated new filename, allowing an authenticated user with folder upload permission to move files outside the intended adm_my_files directory. By submitting path traversal sequences, an attacker may write files or create directories in other writable locations, potentially including the web root.
Affected context
The issue affects Admidio's DocumentsService::renameFile() functionality when the adm_new_name value is not safely constrained to the intended directory. An authenticated user with folder upload permission may be able to trigger the vulnerable behavior through file_rename_save. The risk depends on which locations are writable by the application process.
Exploit preconditions
- Attack surface: Admidio's authenticated file-renaming functionality
- Required access: An account with folder upload permission
- Trigger point: Submission to
file_rename_savethat invokesDocumentsService::renameFile() - Why exploitation is possible: The supplied
adm_new_namevalue is not adequately validated to prevent traversal outsideadm_my_files, and the application may have write access to other locations.
Why this happens
The root cause is accepting a user-controlled path component without enforcing that the resulting file path remains inside the intended storage directory. Relative traversal sequences can cause path resolution to escape that directory, matching CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The insecure pattern is constructing or using filesystem paths from untrusted names without canonicalization and containment checks.
Potential impact
- An attacker could write or move files into locations writable by the application.
- Files or directories could be created outside the intended document storage area.
- Writing to the web root may expose or alter application-served content.
- If a written file is interpreted or executed by the server, further compromise may be possible, depending on deployment configuration.
General mitigation guidance
Mitigations generally focus on treating filenames as untrusted input and constraining all filesystem operations to an intended storage root.
Common defensive patterns include:
- Accepting only filename formats allowed by a strict application-specific policy.
- Resolving candidate paths and verifying they remain within the canonical storage directory before filesystem operations.
- Using APIs that separate directory selection from a validated basename.
- Keeping uploaded files outside executable or publicly served directories where practical.
- Limiting application filesystem permissions to the directories it must manage.
How teams detect issues like this
Review file upload, rename, and move operations for user-controlled path components, especially where values are joined with filesystem paths.
- Use static analysis rules to flag path construction from request parameters and missing containment checks.
- During code review, check that canonicalization and directory-boundary validation occur before file operations.
- Apply input-validation policies that reject path separators or traversal components where they are not required.
- Monitor application file operations for unexpected writes outside approved storage locations.

