Skip to content
GHSA Gp7m 9622 Gcw9

GHSA Gp7m 9622 Gcw9

github.com • November 22, 2026

Vulnerability type: Path traversal (CWE-22) leading to stored Cross-Site Scripting (CWE-79)

Estimated severity: Medium–High

Status: Confirmed dynamically in an isolated local Docker environment (127.0.0.1 only; no third-party system contacted)

The "rename file" action of the Documents & Files module does not validate the user-supplied new file name. An authenticated user who has upload rights in any one documents folder (not a full administrator) can rename an uploaded file to a name containing ../ sequences. The rename moves the file on disk with rename() and the path-restriction guard that should keep the operation inside adm_my_files/ is inactive (it is never configured). As a result the file can be relocated to the Admidio web root, outside the adm_my_files/ directory that is protected by .htaccess and whose downloads are deliberately forced to Content-Disposition: attachment . Once an uploaded SVG sits at the web root it is served directly by Apache as image/svg+xml with no attachment disposition and no nosniff , so a browser renders it and executes the script it contains. This yields a stored XSS on the Admidio origin, reachable by any unauthenticated visitor who opens the link, which can be used against a logged-in administrator (session/account takeover).

src/Documents/Service/DocumentsService.php — renameFile() admidio/src/Documents/Service/DocumentsService.php Lines 393 to 427 in 9c21e94 public function renameFile ( string $ fileUUID ): void { global $ gCurrentSession , $ gL10n ; try { // check form field input and sanitized it from malicious content $ documentsFilesRenameForm = $ gCurrentSession -> getFormObject ( $ _POST [ ' adm_csrf_token ' ]); $ formValues = $ documentsFilesRenameForm -> validate ( $ _POST ); // get recordset of current file from database and throw exception if necessary $ file = new File ( $ this -> db ); $ file -> getFileForDownload ( $ fileUUID ); $ oldFile = $ file -> getFullFilePath (); $ newPath = $ file -> getFullFolderPath () . ' / ' ; $ newFile = $ formValues [ ' adm_new_name ' ] . ' . ' . pathinfo ( $ oldFile , PATHINFO_EXTENSION ); // check if file already exists in filesystem if ( $ newFile !== $ file -> getValue ( ' fil_name ' ) && is_file ( $ newPath . $ newFile )) { throw new Exception ( ' SYS_FILE_EXIST ' , array ( $ newFile )); } else { $ oldName = $ file -> getValue ( ' fil_name ' ); if ( $ newFile !== $ file -> getValue ( ' fil_name ' )) { // rename file in filesystem and database try { FileSystemUtils :: moveFile ( $ oldFile , $ newPath . $ newFile ); } catch ( RuntimeException $ exception ) { throw new Exception ( ' SYS_FILE_RENAME_ERROR ' , array ( $ oldName )); } } $ file -> setValue ( ' fil_name ' , $ newFile ); $ file -> setValue ( ' fil_description ' , $ formValues [ ' adm_new_description ' ]); $ file -> save (); $ formValues = $ documentsFilesRenameForm -> validate ( $ _POST ); // only strips HTML tags . . . $ newFile = $ formValues [ ' adm_new_name ' ] . ' . ' . pathinfo ( $ oldFile , PATHINFO_EXTENSION ); . . . FileSystemUtils :: moveFile ( $ oldFile , $ newPath . $ newFile ); // no filename validation The sibling methods renameFolder() (L464) and saveNewFolder() (L511) do call StringUtils::strIsValidFolderName() ; renameFile() has no equivalent StringUtils::strIsValidFileName() call — this is the gap.

admidio/src/Documents/Service/DocumentsService.php

Lines 393 to 427 in 9c21e94

src/Infrastructure/Utils/FileSystemUtils.php — checkIsInAllowedDirectories() admidio/src/Infrastructure/Utils/FileSystemUtils.php Lines 287 to 302 in 9c21e94 private static function checkIsInAllowedDirectories ( string & $ path ) { $ path = self :: getNormalizedPath ( $ path ); if ( count ( self :: $ allowedDirectories ) === 0 ) { return ; } foreach ( self :: $ allowedDirectories as $ allowedDirectory ) { if ( strpos ( $ path , $ allowedDirectory ) === 0 ) { return ; } } throw new \ RuntimeException ( ' Path " ' . $ path . ' " is not in allowed directory! ' ); } if ( count ( self :: $ allowedDirectories ) === 0 ) { return ; // guard disabled when no allowed directories are configured } FileSystemUtils::setAllowedDirectories() is never called anywhere in the code base, so $allowedDirectories is always empty and the containment check is a no-op for every file-system operation in the application.

admidio/src/Infrastructure/Utils/FileSystemUtils.php

Lines 287 to 302 in 9c21e94

An authenticated account with upload right in at least one Documents folder. This is a per-folder permission a Documents administrator can grant to any role; it does not require the global administrator role.

Documents & Files module enabled (enabled by default).

Verified end to end. The full, from-scratch reproduction (build, run, install, exploit, observed output, cleanup) is in the companion file Admidio__admidio_01_documents-rename-traversal_repro.md .

Observed result (isolated local instance at ):

Upload poc.svg into the default documents folder → stored at adm_my_files/documents_poc/poc.svg .

Baseline: GET /adm_my_files/documents_poc/poc.svg → 403 (htaccess); the official download endpoint serves it as Content-Disposition: attachment + X-Content-Type-Options: nosniff (safe); GET /poc.svg → 404 .

Rename with adm_new_name=../../poc → {"status":"success"} ; DB fil_name becomes ../../poc.svg ; the file is now at the container web root /opt/app-root/src/poc.svg .

GET without any authentication → 200, Content-Type: image/svg+xml, no Content-Disposition, no X-Content-Type-Options, body = the uploaded SVG containing alert('XSS Triggered: ' + document.domain); → executes on the Admidio origin, triggering a popup.

(The script in the PoC triggers a benign alert pop-up to demonstrate execution; no destructive payload or data exfiltration was written, and no live/third-party system was contacted.)

A file can be moved out of the access-controlled, .htaccess -protected adm_my_files/ tree to a location served directly by the web server (e.g. the Admidio web root).

With an SVG payload this is a stored XSS executing in the Admidio origin, deliverable to any unauthenticated visitor by a plain link ( https:// /poc.svg ). An administrator opening the link runs attacker JavaScript in their authenticated session (the app uses same-origin requests with a CSRF token readable by same-origin script), enabling account/instance takeover.

Secondary impact: documents can be relocated outside the permission-controlled area.

Not demonstrated / out of scope: direct code execution. The original file extension is preserved by renameFile() (the new name is adm_new_name + '.' + ) and existing files are not overwritten ( is_file() check), so a .php cannot be planted via this path and no RCE was achieved.

Extracted Entities