CVE-2024-4990: Unsafe Reflection in base Component class in yiisoft/yii2
Yii2 supports attaching Behaviors to Components by setting properties having the format 'as <behaviour-name>'
.
Internally this is done using the __set()
magic method. If the value passed to this method is not an instance of the Behavior
class, a new object is instantiated using Yii::createObject($value)
. However, there is no validation check that verifies that $value
is a valid Behavior
class name or configuration. An attacker that can control the content of the $value variable can then instantiate arbitrary classes, passing parameters to their constructors and then invoking setter methods.
References
Detect and mitigate CVE-2024-4990 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →