CVE-2020-15148: Unsafe deserialization in Yii 2

yiisoft/yii2 Updated 02 Oct 2025

Summary

15/09/2020
Yes i
High
8.9

CVE-2020-15148: Unsafe deserialization in Yii 2. Affects yiisoft/yii2 versions < 2.0.38. Fixed in 2.0.38. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Yii 2 is a popular PHP framework used for developing web applications. It provides a set of libraries and tools that enable developers to build robust and secure applications. However, Yii 2 is vulnerable to an unsafe deserialization vulnerability, which can lead to remote code execution if the application calls unserialize() on user input containing a specially crafted string.

Vulnerability Detail

The unsafe deserialization vulnerability in Yii 2 allows an attacker to execute arbitrary code on the server by manipulating the serialized data passed to the unserialize() function. This can be exploited by sending a malicious request to the application, causing it to deserialize the attacker's payload and execute it. The impact of this vulnerability is severe, as it allows an attacker to gain full control over the affected system.

How To Fix

Minimum fixed version

2.0.38

This is the first release that contains the fix.

composer require yiisoft/yii2:2.0.38

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the patched version is not immediately possible, a temporary workaround can be implemented by adding the following code to the BatchQueryResult.php file:

public function __sleep()
{
    throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}

public function __wakeup()
{
    throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

Conclusion

The unsafe deserialization vulnerability in Yii 2 can lead to remote code execution and full compromise of the affected system. It is crucial to upgrade to version 2.0.38 or later to mitigate the risk. If immediate upgrade is not possible, applying the provided workaround can help protect the application. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for yiisoft/yii2 →

Share this vulnerability

FAQ

The impact of this vulnerability is severe, as it allows an attacker to execute arbitrary code on the server, potentially leading to a complete compromise of the affected system.

To fix this vulnerability, you should upgrade your Yii 2 installation to version 2.0.38 or later. Alternatively, you can apply the provided workaround until you are able to upgrade.

Yes, this vulnerability can be exploited remotely by sending a specially crafted request to the affected application.

There are no known instances of this vulnerability being exploited in the wild at the time of this advisory.

For more information about this vulnerability, you can contact the Yii Framework security team through their security form: https://www.yiiframework.com/security

Related vulnerabilities

Recent vulnerabilities recorded for yiisoft/yii2.

How To Fix

Minimum fixed version

2.0.38

This is the first release that contains the fix.

composer require yiisoft/yii2:2.0.38

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback