Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. yiisoft/yii2
  4. ›
  5. CVE-2024-4990

CVE-2024-4990: Unsafe Reflection in base Component class in yiisoft/yii2

June 2, 2024 (updated April 1, 2025)

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

  • github.com/FriendsOfPHP/security-advisories/blob/master/yiisoft/yii2/CVE-2024-4990.yaml
  • github.com/advisories/GHSA-cjcc-p67m-7qxm
  • github.com/yiisoft/yii2
  • github.com/yiisoft/yii2/blob/master/framework/CHANGELOG.md
  • github.com/yiisoft/yii2/commit/628d406bfafb80fc32147837888c0057d89a021e
  • github.com/yiisoft/yii2/commit/62d081f18c3602d09e7d075bba3a0ca5c313f0b4
  • github.com/yiisoft/yii2/pull/20183
  • github.com/yiisoft/yii2/security/advisories/GHSA-cjcc-p67m-7qxm
  • huntr.com/bounties/4fbdd965-02b6-42e4-b57b-f98f93415b8f
  • nvd.nist.gov/vuln/detail/CVE-2024-4990

Code Behaviors & Features

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 →

Affected versions

All versions before 2.0.49.4

Fixed versions

  • 2.0.49.4

Solution

Upgrade to version 2.0.49.4 or above.

Impact 9.1 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')

Source file

packagist/yiisoft/yii2/CVE-2024-4990.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:14:41 +0000.