CVE-2020-15148: Yiisoft/yii2 Unsafe Deserialization Vulnerability

HIGH
Advisory Identifier: GHSA-699q-wcff-g9mj
CVSS 8.9
CWE-502
Published
Advisory Summary

CVE-2020-15148 is a HIGH (CVSS 8.9) unsafe deserialization vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Yiisoft/yii2 libraries in the Packagist ecosystem. The issue involves unsafe deserialization in yii 2. Remediation is available by upgrading affected packages to version 2.0.38.

CVE-2020-15148 at a Glance

CVE Identifier CVE-2020-15148
GHSA Identifier GHSA-699q-wcff-g9mj
Severity HIGH
CVSS v3.1 Base Score 8.9
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Yiisoft/yii2
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2020-15148

To remediate this vulnerability, upgrade all affected Yiisoft/yii2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

yiisoft/yii2 fixed: 2.0.38
Upgrade yiisoft/yii2 to 2.0.38
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for yiisoft/yii2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-15148, inspect your project dependencies for Yiisoft/yii2:

inspect dependencies for yiisoft/yii2

Analyze the terminal output to locate any version of Yiisoft/yii2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.38), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Yiisoft/yii2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Remote code execution in case application calls `unserialize()` on user input containing specially crafted string. ### Patches 2.0.38 ### Workarounds Add the following to BatchQueryResult.php: ```php public function __sleep() { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } public function __wakeup() { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } ``` ### For more information If you have any questions or comments about this advisory, [contact us through security form](https://www.yiiframework.com/security).

CVE-2020-15148 Affected Yiisoft/yii2 Versions

1 component(s)
Fixed Versions:
2.0.38
Product / Package Ecosystem Affected Versions Fixed Version
yiisoft/yii2
Packagist
< 2.0.38
2.0.38

References

Frequently Asked Questions

What is CVE-2020-15148?
CVE-2020-15148 is a security vulnerability in Yiisoft/yii2 involving Unsafe deserialization in Yii 2 under CWE-502: Deserialization of Untrusted Data.
Which Yiisoft/yii2 versions are affected?
Affected versions include releases prior to 2.0.38 across affected packages: yiisoft/yii2.
What version fixes CVE-2020-15148?
Upgrading to 2.0.38 (or the latest patched release for your respective branch) resolves the vulnerability.
Is yiisoft/yii2 affected?
Yes, yiisoft/yii2 is affected in releases prior to 2.0.38. Upgrade your dependency to 2.0.38 or later.
What is the CVSS score of CVE-2020-15148?
CVE-2020-15148 has a CVSS v3.1 base score of 8.9 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:H/A:H.
What CWE is associated with CVE-2020-15148?
CVE-2020-15148 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check Packagist dependencies for CVE-2020-15148?
Run the dependency tree command: 'inspect dependencies for yiisoft/yii2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-699q-wcff-g9mj",
  "modified" : "2021-01-07T22:56:34Z",
  "published" : "2020-09-15T18:19:56Z",
  "aliases" : [ "CVE-2020-15148" ],
  "summary" : "Unsafe deserialization in Yii 2",
  "details" : "### Impact\n\nRemote code execution in case application calls `unserialize()` on user input containing specially crafted string.\n\n### Patches\n\n2.0.38\n\n### Workarounds\n\nAdd the following to BatchQueryResult.php:\n\n```php\npublic function __sleep()\n{\n    throw new \\BadMethodCallException('Cannot serialize '.__CLASS__);\n}\n\npublic function __wakeup()\n{\n    throw new \\BadMethodCallException('Cannot unserialize '.__CLASS__);\n}\n```\n\n### For more information\n\nIf you have any questions or comments about this advisory, [contact us through security form](https://www.yiiframework.com/security).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "yiisoft/yii2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.38"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/yiisoft/yii2/security/advisories/GHSA-699q-wcff-g9mj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15148"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yiisoft/yii2/commit/9abccb96d7c5ddb569f92d1a748f50ee9b3e2b99"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/yiisoft/yii2/CVE-2020-15148.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://www.yiiframework.com/news/303/yii-2-0-38"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-09-15T18:19:44Z",
    "nvd_published_at" : null
  }
}