Jan 7, 2026·5 min read·9 visits
Yii2's `__set()` magic method allows attaching 'Behaviors' (mixins) dynamically using keys starting with `as `. Due to missing type validation, an attacker can pass a class definition instead of a Behavior. The framework passes this definition to `Yii::createObject()`, allowing the instantiation of ANY class in the autoloader. This leads to RCE via destructor gadgets.
A critical unsafe reflection vulnerability in the Yii Framework 2 core component system allows attackers to execute arbitrary code by manipulating magic methods used for behavior attachment. By injecting a crafted payload into a model via mass assignment, attackers can trick the framework into instantiating arbitrary classes (like gadgets in Guzzle) leading to RCE.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
yiisoft/yii2 YiiSoft | < 2.0.49.4 | 2.0.49.4 |
| Attribute | Detail |
|---|---|
| CWE | CWE-470 (Unsafe Reflection) |
| CVSS v3.1 | 9.1 (Critical) |
| Attack Vector | Network (POST/JSON) |
| Exploit Status | High (PoC Available & Bypass Active) |
| EPSS Score | 0.29% |
| Related CVE | CVE-2024-58136 (Bypass) |
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')