CVE-2020-15146: Sylius/resource bundle Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-h6m7-j4h3-9rf5
CVSS 9.6
CWE-917 CWE-74
Published
Advisory Summary

CVE-2020-15146 is a CRITICAL (CVSS 9.6) remote code execution vulnerability (CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')) affecting Sylius/resource bundle libraries in the Packagist ecosystem. The issue involves remote code execution in syliusresourcebundle. Remediation is available by upgrading affected packages to version 1.4.7, 1.5.2, 1.6.4, 1.3.14.

CVE-2020-15146 at a Glance

CVE Identifier CVE-2020-15146
GHSA Identifier GHSA-h6m7-j4h3-9rf5
Severity CRITICAL
CVSS v3.1 Base Score 9.6
CWE Classification CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')
Affected Product Sylius/resource bundle
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 9.6

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

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

How to Fix CVE-2020-15146

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

sylius/resource-bundle fixed: 1.4.7
Upgrade sylius/resource-bundle to 1.4.7
sylius/resource-bundle fixed: 1.5.2
Upgrade sylius/resource-bundle to 1.5.2
sylius/resource-bundle fixed: 1.6.4
Upgrade sylius/resource-bundle to 1.6.4
sylius/resource-bundle fixed: 1.3.14
Upgrade sylius/resource-bundle to 1.3.14
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 sylius/resource-bundle

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-15146, inspect your project dependencies for Sylius/resource bundle:

inspect dependencies for sylius/resource-bundle

Analyze the terminal output to locate any version of Sylius/resource bundle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.7), 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-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection'), where the product constructs all or part of an expression language (el) statement in a framework such as a java server page (jsp) using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended el statement before it is executed. In Sylius/resource bundle, 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 Request parameters injected inside an expression evaluated by `symfony/expression-language` package haven't been sanitized properly. This allows the attacker to access any public service by manipulating that request parameter, allowing for Remote Code Execution. The vulnerable versions include: `<=1.3.13 || >=1.4.0 <=1.4.6 || >=1.5.0 <=1.5.1 || >=1.6.0 <=1.6.3`. ### Example ```yaml sylius_grid: grids: foo: fields: bar: options: baz: "expr:service('sylius.repository.product').find($id)" ``` In this case, `$id` can be prepared in a way that calls other services. If you visit `/route?id="~service('doctrine').getManager().getConnection().executeQuery("DELETE * FROM TABLE")~"`, it will result in a following expression `expr:service('repository').find(""~service('doctrine').getManager().getConnection().executeQuery("DELETE * FROM TABLE")~"")`, which will execute a query on the currently connected database. To find a vulnerability in your application, look for any routing definition that uses request parameters inside expression language. ### Patches This issue has been patched for versions 1.3.14, 1.4.7, 1.5.2 and 1.6.4. Versions prior to 1.3 were not patched. ### Workarounds The fix requires adding `addslashes` in `OptionsParser::parseOptionExpression` to sanitize user input before evaluating it using the expression language. ```php - return is_string($variable) ? sprintf('"%s"', $variable) : $variable; + return is_string($variable) ? sprintf('"%s"', addslashes($variable)) : $variable; ``` ### Acknowledgements This security issue has been reported by Craig Blanchette (@isometriks), thanks a lot! ### For more information If you have any questions or comments about this advisory: * Email us at [security@sylius.com](mailto:security@sylius.com)

CVE-2020-15146 Affected Sylius/resource bundle Versions

4 component(s)
Fixed Versions:
1.4.71.5.21.6.41.3.14
Product / Package Ecosystem Affected Versions Fixed Version
sylius/resource-bundle
Packagist
≥ 1.4.0
< 1.4.7
1.4.7
sylius/resource-bundle
Packagist
≥ 1.5.0
< 1.5.2
1.5.2
sylius/resource-bundle
Packagist
≥ 1.6.0
< 1.6.4
1.6.4
sylius/resource-bundle
Packagist
≥ 1.0.0
< 1.3.14
1.3.14

References

Frequently Asked Questions

What is CVE-2020-15146?
CVE-2020-15146 is a security vulnerability in Sylius/resource bundle involving Remote Code Execution in SyliusResourceBundle under CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection').
Which Sylius/resource bundle versions are affected?
Affected versions include releases prior to 1.4.7, 1.5.2, 1.6.4, 1.3.14 across affected packages: sylius/resource-bundle.
What version fixes CVE-2020-15146?
Upgrading to 1.4.7, 1.5.2, 1.6.4, 1.3.14 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sylius/resource-bundle affected?
Yes, sylius/resource-bundle is affected in releases prior to 1.4.7, 1.5.2, 1.6.4, 1.3.14. Upgrade your dependency to 1.4.7, 1.5.2, 1.6.4, 1.3.14 or later.
What is the CVSS score of CVE-2020-15146?
CVE-2020-15146 has a CVSS v3.1 base score of 9.6 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2020-15146?
CVE-2020-15146 is classified under CWE-917: Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection') (The product constructs all or part of an expression language (EL) statement in a framework such as a Java Server Page (JSP) using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended EL statement before it is executed.).
How can I check Packagist dependencies for CVE-2020-15146?
Run the dependency tree command: 'inspect dependencies for sylius/resource-bundle'. 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-h6m7-j4h3-9rf5",
  "modified" : "2021-11-19T15:36:47Z",
  "published" : "2020-08-19T19:52:30Z",
  "aliases" : [ "CVE-2020-15146" ],
  "summary" : "Remote Code Execution in SyliusResourceBundle",
  "details" : "### Impact\n\nRequest parameters injected inside an expression evaluated by `symfony/expression-language` package haven't been sanitized properly. This allows the attacker to access any public service by manipulating that request parameter, allowing for Remote Code Execution.\n\nThe vulnerable versions include: `<=1.3.13 || >=1.4.0 <=1.4.6 || >=1.5.0 <=1.5.1 || >=1.6.0 <=1.6.3`.\n\n### Example\n\n```yaml\nsylius_grid:\n    grids:\n        foo:\n            fields:\n                bar:\n                    options:\n                        baz: \"expr:service('sylius.repository.product').find($id)\"\n```\n\nIn this case, `$id` can be prepared in a way that calls other services. \n\nIf you visit `/route?id=\"~service('doctrine').getManager().getConnection().executeQuery(\"DELETE * FROM TABLE\")~\"`, it will result in a following expression `expr:service('repository').find(\"\"~service('doctrine').getManager().getConnection().executeQuery(\"DELETE * FROM TABLE\")~\"\")`, which will execute a query on the currently connected database.\n\nTo find a vulnerability in your application, look for any routing definition that uses request parameters inside expression language.\n\n### Patches\n\nThis issue has been patched for versions 1.3.14, 1.4.7, 1.5.2 and 1.6.4. Versions prior to 1.3 were not patched.\n\n### Workarounds\n\nThe fix requires adding `addslashes` in `OptionsParser::parseOptionExpression` to sanitize user input before evaluating it using the expression language.\n\n```php\n- return is_string($variable) ? sprintf('\"%s\"', $variable) : $variable;\n+ return is_string($variable) ? sprintf('\"%s\"', addslashes($variable)) : $variable;\n```\n\n### Acknowledgements\n\nThis security issue has been reported by Craig Blanchette (@isometriks), thanks a lot!\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Email us at [security@sylius.com](mailto:security@sylius.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/resource-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.0"
      }, {
        "fixed" : "1.4.7"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/resource-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.5.0"
      }, {
        "fixed" : "1.5.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/resource-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.6.0"
      }, {
        "fixed" : "1.6.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sylius/resource-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.3.14"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-h6m7-j4h3-9rf5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15146"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Sylius/SyliusResourceBundle/commit/73d9aba182947473a5935b31caf65ca263091e00"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/sylius/resource-bundle/CVE-2020-15146.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Sylius/SyliusResourceBundle"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74", "CWE-917" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-19T19:50:49Z",
    "nvd_published_at" : "2020-08-20T01:17:00Z"
  }
}