MagicLink: Insecure Deserialization of MagicLink Actions Leads to Remote Code Execution
The advisory, in context
Description
MagicLink stores serialized action objects in the magic_links.action database column and deserializes them without integrity validation or class allowlisting in src/MagicLink.php and src/Actions/ResponseAction.php. An attacker with the ability to manipulate database records (e.g., via SQL injection or compromised admin access) could inject malicious serialized objects containing arbitrary closures, leading to Remote Code Execution (RCE) when the magic link is visited.
Resolution
The vulnerability has been mitigated through HMAC-signed serialization using the application key, class allowlisting restricted to ActionAbstract subclasses and framework classes, strict type validation preventing arbitrary object storage, and backward compatibility support for legacy data via allowed_classes in unserialize(). Implementation includes a new Serializable security class with signing/verification, refactored getter/setter methods in MagicLink.
Affected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
From 2.0.0 before 2.25.1
Fixed in 2.25.1
48 explicitly affected versions
v2.0.0, v2.1.0, v2.10.0, v2.10.1, v2.10.2, v2.11.0, v2.12.0, v2.12.1, v2.12.2, v2.13.0, v2.14.0, v2.14.1, v2.15.0, v2.16.0, v2.16.1, v2.17.0, v2.18.0, v2.19.0, v2.2.0, v2.2.1, v2.2.2, v2.20.0, v2.21.00, v2.21.1, v2.21.2, v2.22.0, v2.23.0, v2.24.0, v2.24.1, v2.24.2, v2.24.3, v2.24.4, v2.24.5, v2.24.6, v2.24.7, v2.25.0, v2.3.0, v2.4.0, v2.5.0, v2.5.1, v2.5.2, v2.6.0, v2.7.0, v2.8.0, v2.8.1, v2.9.0, v2.9.1, v2.9.2
View affected-version evidence
{
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.25.1"
}
],
"type": "ECOSYSTEM"
}
],
"versions": [
"v2.0.0",
"v2.1.0",
"v2.10.0",
"v2.10.1",
"v2.10.2",
"v2.11.0",
"v2.12.0",
"v2.12.1",
"v2.12.2",
"v2.13.0",
"v2.14.0",
"v2.14.1",
"v2.15.0",
"v2.16.0",
"v2.16.1",
"v2.17.0",
"v2.18.0",
"v2.19.0",
"v2.2.0",
"v2.2.1",
"v2.2.2",
"v2.20.0",
"v2.21.00",
"v2.21.1",
"v2.21.2",
"v2.22.0",
"v2.23.0",
"v2.24.0",
"v2.24.1",
"v2.24.2",
"v2.24.3",
"v2.24.4",
"v2.24.5",
"v2.24.6",
"v2.24.7",
"v2.25.0",
"v2.3.0",
"v2.4.0",
"v2.5.0",
"v2.5.1",
"v2.5.2",
"v2.6.0",
"v2.7.0",
"v2.8.0",
"v2.8.1",
"v2.9.0",
"v2.9.1",
"v2.9.2"
]
}