User tests: Successful: Unsuccessful:
Pull Request resolves #
This PR adds allowed_classes to unserialize() calls in several Joomla cache controller and search components.
Affected locations:
libraries/src/Cache/Controller/ — PageController, OutputController, ViewCacheController, CallbackControllercomponents/com_finder/src/Model/SearchModel.php — deserializes search state from sessionRisk: Without allowed_classes, an attacker who can write to the cache backend or session can trigger PHP Object Injection. For file-based caches the risk requires filesystem write access, but for Redis/Memcached backends a compromised shared cache server is sufficient.
Fix: Restrict each unserialize() to only the specific classes legitimately stored in each location.
unserialize() calls in cache controllers and com_finder have no class restrictions.
unserialize() is restricted to only the expected classes at each call site.
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_finder Front End Libraries |
Apologies @brianteeman — PR description has been updated with the full template including summary, testing instructions, before/after results, and documentation checkboxes.
| Title |
|
||||||
| Labels |
Added:
Updates Requested
PR-5.4-dev
|
||
Thanks @SniperSister for the detailed feedback. The latest commits (specifically 55fadc18 and the merge 60342fbe) address your b/c concerns with a two-phase fallback strategy.
For cache controllers (Page, Output, View, Callback):
The implementation tries secure deserialization first, then falls back for old cache entries:
// Try secure deserialization first
$data = @unserialize($trimmed, ['allowed_classes' => false]);
// Fallback for backward compatibility: if secure unserialize failed
// and the serialized data is not boolean false
if ($data === false && $trimmed !== 'b:0;') {
// Legacy fallback to preserve existing cache entries that store objects
$data = unserialize($trimmed);
}two-phase fallback strategy.
that’s not a fallback strategy - it’s just killing any potential security benefit any and makes the changes completely irrelevant.
There was a reason that you were given a template to complete when you submitted this PR. Please update your pr with the required information. You can find the template here https://github.com/joomla/joomla-cms/blob/5.4-dev/.github/PULL_REQUEST_TEMPLATE.md
In addition please read https://github.com/joomla/joomla-cms/security