yiisoft Yii2 Deserialization Vulnerability in PHPUnit MockClass Remote Code Execution

Vulnerability

A critical deserialization vulnerability has been identified in yiisoft Yii2 versions through 2.0.39. The issue arises in the 'generate' function of 'phpunit\src\Framework\MockObject\MockClass.php', where untrusted data is deserialized without proper validation. This vulnerability can be exploited remotely, leading to arbitrary command execution.

Impact

Exploitation of this vulnerability allows for arbitrary code execution on the server where the affected Yii2 version is running.

Reproduction

To reproduce this vulnerability, upload a crafted PHP object that exploits the deserialization flaw into an application running Yii2 version 2.0.39 or earlier. The object should be designed to execute arbitrary PHP code when the application deserializes it. Once the object is deserialized, the embedded code will be executed on the server.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
7.5
exploitability
8.7
remediation
0.0
relevance
0.0
threat
6.4
urgency
2.9
incentive
5.8

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.