Summary
Admidio's file-rename action can allow an authenticated user with folder upload rights to move a file outside the intended files directory by using path traversal sequences in the new name. If the moved file is an SVG served inline from the web root, its script may execute in an administrator's browser and enable stored cross-site scripting.
Affected context
The issue is in the Documents & Files renameFile() action in affected Admidio deployments. It becomes risky when a user with folder upload rights can supply a name containing path traversal sequences and the application allows the resulting file to be placed outside the intended files directory. An uploaded SVG served inline from the web root may then run script in visitors' browsers.
Exploit preconditions
- Attack surface: Documents & Files file-renaming functionality
- Required access: An authenticated account with folder upload rights
- Trigger point: Processing a user-supplied new filename in the renameFile() action
- Why exploitation is possible: The destination path may not be constrained to the intended files directory, allowing a file to be moved to a web-accessible location
- Potential follow-on condition: The relocated SVG must be served in a way that permits its script to execute in a visitor's browser
Why this happens
The underlying bug is path traversal: user-controlled filename data is used to form a filesystem destination without reliably ensuring that the resolved path remains within the intended directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). When a file is moved to a web-accessible location and served as active content, the traversal can also create a path to stored cross-site scripting.
Potential impact
- A user with the required upload rights may move files outside the intended storage directory.
- An SVG placed in a web-accessible location could execute script when served inline.
- Administrators who view the affected content could be exposed to stored cross-site scripting.
- An attacker could potentially use the administrator's session or privileges to take over an account.
General mitigation guidance
Defensive patterns focus on keeping file operations within a fixed storage boundary and treating uploaded content as untrusted.
- Resolve and normalize destination paths, then verify they remain inside the intended directory before performing file operations.
- Prefer generated or strictly allowlisted filenames that do not permit path separators or traversal components.
- Store uploads outside the web root where practical, or serve them from an isolated origin with restrictive content-handling policies.
- Treat SVG and other active formats cautiously; use safe transformation or sanitization patterns, or prevent them from being served as executable inline content.
- Apply least privilege to the application's filesystem access and restrict who can upload or rename files.
How teams detect issues like this
- Use static analysis to identify file operations whose paths incorporate user-controlled names without canonicalization and containment checks.
- Review rename and upload code for path normalization, directory-boundary enforcement, and handling of symbolic links.
- Test policy enforcement to confirm that uploaded files cannot be written or moved outside their designated storage area.
- Monitor file operations and web-root content for unexpected files, traversal-like names, or newly accessible active content.
- Automated code review tools may help identify risky path construction and file-serving patterns.

