CVE-2018-20745: Yiisoft/yii2 Yii Incorrectly Implements CORS Vulnerability

MODERATE
Advisory Identifier: GHSA-cr6r-6xm9-ww22
CVSS 5.9
CWE-346
Published
Advisory Summary

CVE-2018-20745 is a MODERATE (CVSS 5.9) yii incorrectly implements cors vulnerability (CWE-346: Origin Validation Error) affecting Yiisoft/yii2 libraries in the Packagist ecosystem. The issue involves yii incorrectly implements cors. Remediation is available by upgrading affected packages to version 2.0.16.

CVE-2018-20745 at a Glance

CVE Identifier CVE-2018-20745
GHSA Identifier GHSA-cr6r-6xm9-ww22
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-346: Origin Validation Error
Affected Product Yiisoft/yii2
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.9

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

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

How to Fix CVE-2018-20745

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.16
Upgrade yiisoft/yii2 to 2.0.16
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-2018-20745, 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.16), 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-346: Origin Validation Error, where the product does not properly verify that the source of data or communication is 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

Yii 2.x through 2.0.15.1 actively converts a wildcard CORS policy into reflecting an arbitrary Origin header value, which is incompatible with the CORS security design, and could lead to CORS misconfiguration security problems.

CVE-2018-20745 Affected Yiisoft/yii2 Versions

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

References

Frequently Asked Questions

What is CVE-2018-20745?
CVE-2018-20745 is a security vulnerability in Yiisoft/yii2 involving Yii Incorrectly Implements CORS under CWE-346: Origin Validation Error.
Which Yiisoft/yii2 versions are affected?
Affected versions include releases prior to 2.0.16 across affected packages: yiisoft/yii2.
What version fixes CVE-2018-20745?
Upgrading to 2.0.16 (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.16. Upgrade your dependency to 2.0.16 or later.
What is the CVSS score of CVE-2018-20745?
CVE-2018-20745 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2018-20745?
CVE-2018-20745 is classified under CWE-346: Origin Validation Error (The product does not properly verify that the source of data or communication is valid.).
How can I check Packagist dependencies for CVE-2018-20745?
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-cr6r-6xm9-ww22",
  "modified" : "2023-08-28T23:18:09Z",
  "published" : "2022-05-14T01:33:07Z",
  "aliases" : [ "CVE-2018-20745" ],
  "summary" : "Yii Incorrectly Implements CORS",
  "details" : "Yii 2.x through 2.0.15.1 actively converts a wildcard CORS policy into reflecting an arbitrary Origin header value, which is incompatible with the CORS security design, and could lead to CORS misconfiguration security problems.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "yiisoft/yii2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.16"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2018-20745"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yiisoft/yii2/issues/16193"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/yiisoft/yii2/pull/16198"
  }, {
    "type" : "WEB",
    "url" : "https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-chen.pdf"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-346" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-28T23:18:09Z",
    "nvd_published_at" : "2019-01-28T08:29:00Z"
  }
}