Information Required PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar arib06
arib06
1 Jul 2026
  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

The template manager reads the file to act on from the base64 file request parameter and builds an absolute path from it. save(), deleteFile(), renameFile() and copyFile() pass that path to File::write / File::delete / rename / File::copy after only Path::clean(), which normalizes separators but leaves .. intact. The read path getSource() already runs the same value through Path::check(); these mutating methods now do the same, so a file value that decodes to a ../ sequence is rejected instead of resolving outside the template directory.

Testing Instructions

Log in to the backend as a user with template edit rights and open a template in Templates: Customise. Capture the template.save (or the deleteFile / renameFile / copyFile task) request and set the file parameter to Li4vLi4vLi4vLi4vdG1wL3gucGhw (base64 of ../../../../tmp/x.php), which passes the cmd input filter unchanged.

Actual result BEFORE applying this Pull Request

The request writes, deletes, renames or copies a file outside the active template directory.

Expected result AFTER applying this Pull Request

The operation is refused and the target stays contained to the template directory, matching how getSource() already validates the read path.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar arib06 arib06 - open - 1 Jul 2026
avatar arib06 arib06 - change - 1 Jul 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jul 2026
Category Administration com_templates
avatar richard67
richard67 - comment - 1 Jul 2026

Testing Instructions

Log in to the backend as a user with template edit rights

From what I know, the file handling functions of the template manager are hard limited to superusers only, and that cannot be changed by any ACL.

@arib06 Please report back which kind of user you have used for your issue, superuser or not.

avatar brianteeman
brianteeman - comment - 1 Jul 2026

From what I know, the file handling functions of the template manager are hard limited to superusers only, and that cannot be changed by any ACL.

Correct and as a superuser you could do whatever you wanted anyway so even with this restriction in place it won't stop a super user being able to move wherever they want to in the filesystem. All you can doo is to hack yourself

avatar brianteeman
brianteeman - comment - 1 Jul 2026

and isnt this a duplicate of #47851

avatar richard67
richard67 - comment - 1 Jul 2026

and isnt this a duplicate of #47851

Yes, obviously, except of some slight difference.

avatar arib06
arib06 - comment - 1 Jul 2026

You're right on both counts. I tested with a super user, not a lower-privileged account, and since these template file tools are super-user-only that's the only role that ever reaches this code. A super user already has full filesystem access by other means, so I agree this isn't a real privilege boundary, my testing note was misleading on that.

And yes, it overlaps #47851, which makes the same Path::check() fix and also covers cropImage/resizeImage. No point keeping two, so I'll close this in favour of that one. Thanks both.

avatar arib06
arib06 - comment - 1 Jul 2026

Closing as a duplicate of #47851, which covers the same paths plus cropImage/resizeImage.

avatar arib06 arib06 - change - 1 Jul 2026
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2026-07-01 14:25:05
Closed_By arib06
Labels Added: Information Required PR-5.4-dev
avatar arib06 arib06 - close - 1 Jul 2026

Add a Comment

Login with GitHub to post a comment