Skip to content

Commit efcabfe

Browse files
authored
[5.2] Harden FormattedTextLogger against object injection attacks (joomla#44428)
1 parent eedfdaa commit efcabfe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libraries/src/Log/Logger/FormattedtextLogger.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,20 @@ public function __destruct()
144144
}
145145
}
146146

147+
/**
148+
* Prevent object injection attacks by suppressing unserialization of instance with deferred rows
149+
*
150+
* @since __DEPLOY_VERSION__
151+
*
152+
* @throws \Exception
153+
*/
154+
public function __wakeup()
155+
{
156+
if ($this->defer && !empty($this->deferredEntries)) {
157+
throw new \RuntimeException('Can not unserialize in defer mode');
158+
}
159+
}
160+
147161
/**
148162
* Method to add an entry to the log.
149163
*

0 commit comments

Comments
 (0)