No Code Attached Yet bug
avatar muhme
muhme
7 Sep 2026

What happened?

  1. Upload ZIP archive in template manager
  2. Click 'Extract Here'

Version

5.4

Expected result

ZIP archive files are extracted

Actual result

Extracting ZIP archive fails with two red errors:

  • Archive file not found.
  • Failed to extract the archive file.

System Information

Found in testing #47859 with JBT.

With Xdebug I see https://github.com/joomla/joomla-cms/blob/dc5ac482f8d927c1749ef97e43b2fc9fde926e13/administrator/components/com_templates/src/Model/TemplateModel.php#L1838-1847

$path = "/var/www/html/templates/cassiopeia/test/Heiko.zip"
$file = "Heiko.zip"
...
if (file_exists(Path::check($path . '/' . $fileName))) {

appends the file name a second time and therefore fails.

It may be introduced with #35998 in 4.1.0 and I am confused, if the issue is true, how then the PR that I am testing, was tested by the contributer?

I tested extracting ZIP in Joomla 4.0.6 is working and fails in 4.1.5.

Additional Comments

No response

avatar muhme muhme - open - 7 Sep 2026
avatar joomla-cms-bot joomla-cms-bot - change - 7 Sep 2026
Labels Added: No Code Attached Yet bug
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Sep 2026
avatar muhme
muhme - comment - 7 Sep 2026

As the bug is very easy to reproduce, it would be great if someone else could confirm it.

avatar richard67
richard67 - comment - 7 Sep 2026

Hmm, the code here indeed looks wrong (5.4-dev same as 6.1-dev):

$relPath = base64_decode($file);
$explodeArray = explode('/', $relPath);
$fileName = end($explodeArray);
$path = $this->getBasePath() . base64_decode($file);
if (file_exists(Path::check($path . '/' . $fileName))) {

Besides the fact that it uses base64_decode($file) 2 times instead of reusing $relPath the 2nd time, it appends '/' . $fileName to $path at 2 places, and that seems wrong to me as $path still includes the file name at the end.

So on 6.1-dev I can reproduce the issue as described.

However, on a current 5.4-dev branch I cannot reproduce it as the template manager does not allow to upload any unsafe files, e.g. PHP or Zip files.

For the reasons see the description in my PR #48080 .

The input filter already filters out the file name and so I get "No file was found." and "Failed to upload file.".

avatar richard67
richard67 - comment - 7 Sep 2026

Hmm, the code here indeed looks wrong (5.4-dev same as 6.1-dev):

$relPath = base64_decode($file);
$explodeArray = explode('/', $relPath);
$fileName = end($explodeArray);
$path = $this->getBasePath() . base64_decode($file);
if (file_exists(Path::check($path . '/' . $fileName))) {

Besides the fact that it uses base64_decode($file) 2 times instead of reusing $relPath the 2nd time, it appends '/' . $fileName to $path at 2 places, and that seems wrong to me as $path still includes the file name at the end.

So on 6.1-dev I can reproduce the issue as described.

However, on a current 5.4-dev branch I cannot reproduce it as the template manager does not allow to upload any unsafe files, e.g. PHP or Zip files.

For the reasons see the description in my PR #48080 .

The input filter already filters out the file name and so I get "No file was found." and "Failed to upload file.".

Update: It seems the reason for that is because the Zip file which I have used contains a PHP file.

avatar richard67
richard67 - comment - 7 Sep 2026

It may be introduced with #35998 in 4.1.0 and I am confused, if the issue is true, how then the PR that I am testing, was tested by the contributer?

Is was indeed introduced with PR #35998 .

avatar joomdonation
joomdonation - comment - 7 Sep 2026

The issue should be fixed by PR #48386, code quality is improved and necessary security checks are added to avoid path traversal as well.

avatar joomdonation
joomdonation - comment - 7 Sep 2026

The issue should be fixed by PR #48386, code quality is improved and necessary checks are added to avoid path traversal as well.

avatar richard67
richard67 - comment - 7 Sep 2026

The issue should be fixed by PR ...

It definitely is fixed by that PR.

avatar muhme muhme - change - 10 Sep 2026
Status New ⇒ Closed
Closed_Date 0000-00-00 00:00:00 ⇒ 2026-09-10 11:57:35
Closed_By ⇒ muhme
avatar muhme muhme - close - 10 Sep 2026

Add a Comment

Login with GitHub to post a comment