J3 Issue ?
avatar mbabker
mbabker
10 Feb 2019

Steps to reproduce the issue

The design of Joomla's libraries directory was to be a directory to store files for a named library extension, i.e. the "joomla" library extension corresponds to libraries/joomla. Over the years, this path has been misused and abused to introduce new paths for core files without consideration for the library extension type (in effect, the library extension type is just a "special" files extension type since it has no other system meaning). As a result, it is possible to create a library extension named "cms", "legacy", "src", or "vendor" and this could in theory catastrophically destroy a website.

Expected result

Only library extensions should be installed to the libraries directory.

Actual result

Files and folders not related to the library extension type are present in the libraries directory without any form of safeguard to prevent catastrophic destruction of a Joomla installation.

Additional Comments

Suggest the deprecation of the library extension type in favor of using the files extension type since in effect the library extension type is just a files extension in an explicit path and something that can be discover installed. If there is no intention to deprecate this extension type, then two changes should be made: moving non-library extension directories to another location and introducing some kind of functionality to library extensions that actually creates a benefit to their use.

avatar mbabker mbabker - open - 10 Feb 2019
avatar joomla-cms-bot joomla-cms-bot - change - 10 Feb 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Feb 2019
avatar algomaster99
algomaster99 - comment - 11 Feb 2019

Hello @mbabker ! I wish to contribute but I am unable to setup the project. I am stuck on the step where I have to run npm ci.
Also I had to add --ignore-platform-reqs when I had to run composer install.

avatar mbabker
mbabker - comment - 11 Feb 2019

This issue is not specific to 4.0 and should only be addressed on that branch only if fixing it requires B/C breaks (3.x does not require you to run Composer or NPM).

avatar algomaster99
algomaster99 - comment - 11 Feb 2019

@mbabker From which branch should I clone? And where can I find the setup instructions for contributing?

avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Mar 2019
Status New Discussion
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Mar 2019

@mbabker can you please answer the Question?

avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Status Discussion Information Required
avatar franz-wohlkoenig franz-wohlkoenig - change - 28 Mar 2019
Category Libraries
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar mbabker
mbabker - comment - 24 May 2019

This really needs to be addressed with some urgency, if you don't believe me build a "src" library extension that installs files in the "libraries/src" directory and see how long it takes you to FUBAR a Joomla installation. Or, ya know, just ignore a huge concern in the system architecture that allows users and developers to too easily break Joomla; wouldn't be the first time architectural concerns I've raised have been ignored (most likely because I'm the one raising them).

avatar wilsonge wilsonge - assigned - 24 May 19
avatar mbabker mbabker - change - 19 Jul 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-07-19 15:52:55
Closed_By mbabker
avatar mbabker mbabker - close - 19 Jul 2019
avatar wilsonge wilsonge - change - 11 Nov 2019
Status Closed New
Closed_Date 2019-07-19 15:52:55
Closed_By mbabker
avatar wilsonge wilsonge - reopen - 11 Nov 2019
avatar mbabker
mbabker - comment - 17 Dec 2019

Given the JSST elected to not treat this as a security issue, I am now publicly posting the detailed writeup as to why this should have been considered one, as emailed to the JSST on November 8.


Why is this a security issue? Through the Joomla extension installer, a properly crafted package can be installed that can replace the core files in the following directories:

  • libraries/cms
  • libraries/legacy
  • libraries/php-encryption
  • libraries/src
  • libraries/vendor

The Joomla architecture expects that only Joomla library extensions are contained within the libraries directory, adding new folders to this path without creating library extensions is therefore discouraged.

A proper fix for this issue would be to move all code that is not a library extension to another path (the cms, legacy, src, and vendor directories at a minimum). Considering that would either force a new root directory and would probably create upgrade issues trying to remove/replace such a large number of files, two other acceptable alternatives are available:

  1. Register library extensions for all core paths within the Joomla application database
  2. Introduce a blacklist in the library extension installer to prohibit installing a library extension matching the name of a protected core directory

The JSST considered this to not be a security issue because a default installation of Joomla only authorizes super users access to com_installer. However, this is not adequate enough of a security mechanism as the root issue lies within the Installer library API which can be extended and directly implemented by extensions which may or may not make as strict of ACL checks as core does. Therefore, relying on com_installer as the sole security mechanism is not acceptable.

A proof of concept package can be downloaded from https://www.babdev.com/downloads/destructor.zip

avatar Bakual
Bakual - comment - 17 Dec 2019

A blacklist sounds like a simple and effective way to deal with the issue. Or is there some downside I don't see to having a blacklist for library names?

avatar mbabker
mbabker - comment - 17 Dec 2019

A blacklist is the simplest and probably most maintainable solution given the limited number of reserved directories inside the libraries folder.

avatar Bakual
Bakual - comment - 17 Dec 2019

Please test #27300
Closing as we have a PR.

avatar Bakual Bakual - change - 17 Dec 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-12-17 22:18:11
Closed_By Bakual
avatar Bakual Bakual - close - 17 Dec 2019

Add a Comment

Login with GitHub to post a comment