The vulnerability lies in the insecure deserialization of action objects stored in the database. The root cause is the use of PHP's unserialize() function on data retrieved from the magic_links.action column without proper integrity checks or a sufficiently strict class allowlist. An attacker with the ability to write to the database (e.g., via SQL injection) could insert a malicious serialized PHP object. When a user clicks the corresponding magic link, the MagicLinkController::access method is called, which triggers the deserialization of this malicious object through either MagicLink::getActionAttribute (calling the vulnerable legacyGetAction) or ResponseAction::run. This would lead to the execution of arbitrary code on the server.
The patch addresses this by completely removing the legacy deserialization logic that used unserialize() insecurely. It now exclusively relies on a new signed serialization mechanism (ActionSerializable), and any attempt to use the old, insecure format results in a LegacyActionFormatException, preventing the vulnerability from being triggered. The functions MagicLink::legacyGetAction and Security/Serializable/LegacyAllowClasses.php were removed entirely, as they were central to the insecure implementation.