Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent serialization of the JApplication object #16587

Closed
nikosdion opened this issue Jun 8, 2017 · 7 comments
Closed

Prevent serialization of the JApplication object #16587

nikosdion opened this issue Jun 8, 2017 · 7 comments

Comments

@nikosdion
Copy link
Contributor

nikosdion commented Jun 8, 2017

The problem

The last few weeks I have come across at least one template provider whose templates, due to negligence and/or lack of understanding of how Joomla! works, tries to store a reference to the JApplication object in an object that ends up in the Joomla! cache. As you know, this means that the object gets serialized on cache save and resumed (woken up) on cache read.

That wouldn't be all that bad except for the fact that JApplication holds transient information such as the JInput object (GET, POST and FILES request data) and the plugins event dispatcher. This opens a security hole since a plugin could now be cached under a Super User and resumed under a plain user. This could easily and plausibly be the case of a content plugin, thus leading to information disclosure.

In the unlikely event the site owner is so profoundly lucky that they do not get a security issue, they will most likely get quirky behavior. Even worse, they are likely to blame the plugin developer -not the offending template developer- for the misbehaving plugins. This is understandable. From the user's point of view there's no way to connect the odd behavior with the template.

Proposed solution

JApplication should have a magic __sleep method like this:

public function__sleep()
{
    die('Application objects are transient and should never be serialized.');
}

Perhaps we could add "Go to your site's administrator backend, System, Global Configuration and set Caching to Off to fix this issue". We could even make this string localizable. Even better, we could like to a Joomla! documentation page explaining the security and behavior aspects of this bug in third party software.

Even though in the short term this could be moderately annoying for the users, in the medium term we are improving the security and reliability of thousands of Joomla! sites and forcing template developers to adopt the same sane security practices that we, core and backend developers, have been following and taking for granted for over a decade.

Tagging @mbabker and @wilsonge since they are qualified to discuss this and we have spoken briefly about it at JaB17. Tagging @PhilETaylor since he knows his security stuff ;) Finally, tagging @rdeutz since he's the release manager of the current branch. Apologies if I forgot someone else, feel free to chip in your opinion.

@PhilETaylor

This comment was marked as abuse.

@PhilETaylor

This comment was marked as abuse.

@mbabker
Copy link
Contributor

mbabker commented Jun 8, 2017

Too much of the application is transient I think to sanely deal with that:

  • Static instances container with singletons
  • JDocument instance options which are request specific
  • System message queue (extracted from the session)
  • A JProfiler instance when debug is enabled
  • The web client (device detection, a per-request thing)
  • A JDocument instance
  • A JSession instance
  • A JLanguage instance
  • A JInput instance

I think we're looking at a case where this object, by design, shouldn't be serialized and stored somewhere as a whole, and definitely shouldn't be unserialized and re-used.

@nikosdion
Copy link
Contributor Author

nikosdion commented Jun 8, 2017 via email

@mbabker
Copy link
Contributor

mbabker commented Jun 8, 2017

Unless there is a strong argument for keeping support, I think this is one class chain where we need to just full stop block serialization. And in general it'd be a good time to review high level parts of the API to sort out where we need to start defining serializable aspects of objects a bit better (i.e. K2 doing something where it serializes a JTable instance which holds the database driver).

@brianteeman
Copy link
Contributor

Well J4 would be a good opportunity to block the serialization - not that I have a clue how

@brianteeman brianteeman added the RFC Request for Comment label Aug 14, 2018
@ghost ghost added the J3 Issue label Apr 4, 2019
@ghost ghost changed the title [RFC] Prevent serialization of the JApplication object Prevent serialization of the JApplication object Apr 20, 2019
@nikosdion
Copy link
Contributor Author

Closing since nobody cares to do anything about it for two years.

@joomla-cms-bot joomla-cms-bot removed the RFC Request for Comment label Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants