Skip to content
GHSA 4fqv V627 2ggm

GHSA 4fqv V627 2ggm

github.com • November 22, 2026

The Documents & Files module lets a user rename a managed file via modules/documents-files.php?mode=file_rename_save . The handler Admidio\Documents\Service\DocumentsService::renameFile() builds the new file name directly from the user-supplied adm_new_name field without validating it , and then passes the resulting path to FileSystemUtils::moveFile() .

Path separators and .. segments therefore survive, and the file is moved to an arbitrary writable location on the server (missing intermediate directories are created automatically). No FileSystemUtils::setAllowedDirectories() containment is configured anywhere in the application, so the "allowed directories" guard that would normally stop this is a no-op.

The omission is conspicuous because the sibling method renameFolder() in the same class validates the very same form field with StringUtils::strIsValidFolderName() .

src/Documents/Service/DocumentsService.php (master, lines 393–436):

The missing check (compare with the sibling that has it)

renameFile() does neither.

FileSystemUtils::checkIsInAllowedDirectories() returns immediately when the allowed-directory list is empty ( FileSystemUtils.php:304 ), and FileSystemUtils::setAllowedDirectories() is never called anywhere in the code base — the containment guard never runs.

FileSystemUtils::checkFilePreconditions() calls createDirectoryIfNotExists() on the destination's parent directory ( createDirectoryStructure defaults to true ), so missing intermediate directories are silently created.

Same code in the released branch

The identical vulnerable code is present in released v5.0.17 ( src/Documents/Service/DocumentsService.php:299 → FileSystemUtils::moveFile ), while renameFolder is validated there as well.

Step 1: Shell safety and variables

Step 2: Create a fresh file in the folder and capture its UUID

Step 3: Log in and confirm an authenticated session

Step 4: Open the rename form and read its per-form CSRF token

Step 5: Submit the traversal payload as the new name

The payload ../../.. climbs from the folder adm_my_files/documents_demo/TestFolder/ back up to the Admidio web root. The handler appends the original file's extension ( .txt ) automatically.

Step 6: Verify the file escaped its directory

Any authenticated user with upload permission on a documents folder can create/move files to arbitrary writable paths on the server and create arbitrary directories , outside the intended adm_my_files data area — a path-traversal / arbitrary-file-write primitive. On a stock deployment the web-server user typically owns the web root, so attacker-chosen files can be dropped into web-served directories.

The ../ file name is persisted in the database , breaking the module's folder-containment assumption for later download / delete / existence-check operations.

Limitations observed during testing (stated for accuracy): the rename does not overwrite an existing file (an is_file() guard throws first), and the final extension is the original file's allow-listed extension, so a direct .php web shell / RCE was not achieved via this entry point. The primitive is nonetheless a genuine containment escape with real integrity impact.

Extracted Entities

CWE Weaknesses (1)

Platforms (1)

Vulnerabilities (1)