-
-
Notifications
You must be signed in to change notification settings - Fork 150
Description
I’m using wire-elements/modal and noticed a potential security risk related to the component state being hydrated from the Livewire request payload.
Environment
Laravel: 12.4.2
Livewire: 3.7.3
wire-elements/modal: 3.0.2
Issue Summary
The Modal component exposes a public property like:
public $components = [];
Because Livewire accepts client-side “updates” during hydration, an attacker can tamper the /livewire/update request payload and attempt to inject unexpected structures/types into the $components property.
Example
{
"updates": {
"components": [
[],
{
"s": "clctn",
"class": "Monolog\Handler\BufferHandler"
}
]
}
}
Expected Behavior
The request should be rejected and hydration should fail when payload is modified (checksum mismatch), and the component should never accept injected object-like structures.
Actual Behavior
In my testing, the payload tampering appears to reach the components state update (or at minimum the property is not strictly validated), which may allow unsafe hydration / unexpected behavior depending on downstream usage.
Security Impact
This could potentially lead to:
unexpected object hydration attempts
unexpected execution paths if $components values are used dynamically
risk increases if any dynamic class resolution is done based on component state
Recommendation / Fix
-
Avoid exposing complex dynamic state as public properties when possible
-
Add strict validation/sanitization for $components updates (allow only whitelisted arrays/strings)
-
Ensure tampered payloads always hard-fail hydration