CVE-2020-13756: Sabberworm/php css parser Sabberworm PHP CSS Parser Code Vulnerability

CRITICAL
Advisory Identifier: GHSA-phrq-v4q2-hmq6
CVSS 9.8
CWE-94 CWE-20
Published
Advisory Summary

CVE-2020-13756 is a CRITICAL (CVSS 9.8) sabberworm php css parser code vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Sabberworm/php css parser libraries in the Packagist ecosystem. The issue involves sabberworm php css parser code injection vulnerability in allselectors(). Remediation is available by upgrading affected packages to version 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1.

CVE-2020-13756 at a Glance

CVE Identifier CVE-2020-13756
GHSA Identifier GHSA-phrq-v4q2-hmq6
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Sabberworm/php css parser
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 9.8

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

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

How to Fix CVE-2020-13756

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

sabberworm/php-css-parser fixed: 8.3.1
Upgrade sabberworm/php-css-parser to 8.3.1
sabberworm/php-css-parser fixed: 8.2.1
Upgrade sabberworm/php-css-parser to 8.2.1
sabberworm/php-css-parser fixed: 8.1.1
Upgrade sabberworm/php-css-parser to 8.1.1
sabberworm/php-css-parser fixed: 8.0.1
Upgrade sabberworm/php-css-parser to 8.0.1
sabberworm/php-css-parser fixed: 7.0.4
Upgrade sabberworm/php-css-parser to 7.0.4
sabberworm/php-css-parser fixed: 6.0.2
Upgrade sabberworm/php-css-parser to 6.0.2
sabberworm/php-css-parser fixed: 5.2.1
Upgrade sabberworm/php-css-parser to 5.2.1
sabberworm/php-css-parser fixed: 5.1.3
Upgrade sabberworm/php-css-parser to 5.1.3
sabberworm/php-css-parser fixed: 5.0.9
Upgrade sabberworm/php-css-parser to 5.0.9
sabberworm/php-css-parser fixed: 4.0.1
Upgrade sabberworm/php-css-parser to 4.0.1
sabberworm/php-css-parser fixed: 3.0.1
Upgrade sabberworm/php-css-parser to 3.0.1
sabberworm/php-css-parser fixed: 2.0.1
Upgrade sabberworm/php-css-parser to 2.0.1
sabberworm/php-css-parser fixed: 1.0.1
Upgrade sabberworm/php-css-parser to 1.0.1
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 sabberworm/php-css-parser

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-13756, inspect your project dependencies for Sabberworm/php css parser:

inspect dependencies for sabberworm/php-css-parser

Analyze the terminal output to locate any version of Sabberworm/php css parser in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.3.1), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Sabberworm/php css parser, 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

Sabberworm PHP CSS Parser before 8.3.1 calls eval on uncontrolled data, possibly leading to remote code execution if the function allSelectors() or getSelectorsBySpecificity() is called with input from an attacker.

CVE-2020-13756 Affected Sabberworm/php css parser Versions

13 component(s)
Fixed Versions:
8.3.18.2.18.1.18.0.17.0.46.0.25.2.15.1.35.0.94.0.13.0.12.0.11.0.1
Product / Package Ecosystem Affected Versions Fixed Version
sabberworm/php-css-parser
Packagist
≥ 8.3.0
< 8.3.1
8.3.1
sabberworm/php-css-parser
Packagist
≥ 8.2.0
< 8.2.1
8.2.1
sabberworm/php-css-parser
Packagist
≥ 8.1.0
< 8.1.1
8.1.1
sabberworm/php-css-parser
Packagist
≥ 8.0.0
< 8.0.1
8.0.1
sabberworm/php-css-parser
Packagist
≥ 7.0.0
< 7.0.4
7.0.4
sabberworm/php-css-parser
Packagist
≥ 6.0.0
< 6.0.2
6.0.2
sabberworm/php-css-parser
Packagist
≥ 5.2.0
< 5.2.1
5.2.1
sabberworm/php-css-parser
Packagist
≥ 5.1.0
< 5.1.3
5.1.3
sabberworm/php-css-parser
Packagist
≥ 5.0.0
< 5.0.9
5.0.9
sabberworm/php-css-parser
Packagist
≥ 4.0.0
< 4.0.1
4.0.1
sabberworm/php-css-parser
Packagist
≥ 3.0.0
< 3.0.1
3.0.1
sabberworm/php-css-parser
Packagist
≥ 2.0.0
< 2.0.1
2.0.1
sabberworm/php-css-parser
Packagist
≥ 1.0.0
< 1.0.1
1.0.1

References

Frequently Asked Questions

What is CVE-2020-13756?
CVE-2020-13756 is a security vulnerability in Sabberworm/php css parser involving Sabberworm PHP CSS Parser Code injection vulnerability in allSelectors() under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Sabberworm/php css parser versions are affected?
Affected versions include releases prior to 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1 across affected packages: sabberworm/php-css-parser.
What version fixes CVE-2020-13756?
Upgrading to 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sabberworm/php-css-parser affected?
Yes, sabberworm/php-css-parser is affected in releases prior to 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1. Upgrade your dependency to 8.3.1, 8.2.1, 8.1.1, 8.0.1, 7.0.4, 6.0.2, 5.2.1, 5.1.3, 5.0.9, 4.0.1, 3.0.1, 2.0.1, 1.0.1 or later.
What is the CVSS score of CVE-2020-13756?
CVE-2020-13756 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2020-13756?
CVE-2020-13756 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Packagist dependencies for CVE-2020-13756?
Run the dependency tree command: 'inspect dependencies for sabberworm/php-css-parser'. 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-phrq-v4q2-hmq6",
  "modified" : "2025-11-03T21:51:16Z",
  "published" : "2022-03-26T00:15:22Z",
  "aliases" : [ "CVE-2020-13756" ],
  "summary" : "Sabberworm PHP CSS Parser Code injection vulnerability in allSelectors()",
  "details" : "Sabberworm PHP CSS Parser before 8.3.1 calls eval on uncontrolled data, possibly leading to remote code execution if the function allSelectors() or getSelectorsBySpecificity() is called with input from an attacker.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.3.0"
      }, {
        "fixed" : "8.3.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.2.0"
      }, {
        "fixed" : "8.2.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.1.0"
      }, {
        "fixed" : "8.1.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.0.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0"
      }, {
        "fixed" : "6.0.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.2.0"
      }, {
        "fixed" : "5.2.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.1.0"
      }, {
        "fixed" : "5.1.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.0.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "sabberworm/php-css-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-13756"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sabberworm/PHP-CSS-Parser/commit/2ebf59e8bfbf6cfc1653a5f0ed743b95062c62a4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/sabberworm/php-css-parser/CVE-2020-13756.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sabberworm/PHP-CSS-Parser/releases/tag/8.3.1"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2025/10/msg00013.html"
  }, {
    "type" : "WEB",
    "url" : "https://packetstormsecurity.com/files/cve/CVE-2020-13756"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/157923/Sabberworm-PHP-CSS-Code-Injection.html"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/fulldisclosure/2020/Jun/7"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-26T00:15:22Z",
    "nvd_published_at" : "2020-06-03T14:15:12Z"
  }
}