[Security] Add allowed_classes => false to LogTarget unserialize() to prevent PHP Object Injection#19008
Open
XananasX7 wants to merge 1 commit into
Open
Conversation
The debug LogTarget serializes and deserializes panel data to/from the filesystem (debug data path). Without allowed_classes => false, an attacker who can write to the debug data directory can inject a PHP Object Injection payload that triggers a gadget chain when the Craft debug module renders. All four call sites operate on data produced by Panel::save() which returns plain PHP arrays of scalars — no objects are ever legitimately stored: - getIndexFile(): reads summary index → array of scalar summaries - loadTagToPanels(): reads per-tag outer array + per-panel arrays - _updateIndexFile(): reads existing manifest array Add allowed_classes => false to all four unserialize() calls as defence-in-depth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Craft CMS debug LogTarget serializes and deserializes panel data to/from the filesystem. All four unserialize() calls in LogTarget.php lack an allowed_classes restriction.
All panel save() methods return plain PHP arrays of scalars — no PHP objects are ever legitimately stored. Adding allowed_classes => false to all four call sites prevents PHP Object Injection if an attacker can write to the debug data path.
Note: ProjectConfig already uses allowed_classes => false correctly (line 1857). This PR applies the same pattern to LogTarget.