Miggo Logo

CVE-2025-48883:
Chrome PHP is missing encoding in `CssSelector`

5.3

CVSS Score
4.0

Basic Information

EPSS Score
0.20128%
Published
5/28/2025
Updated
5/30/2025
KEV Status
No
Technology
TechnologyPHP

Technical Details

CVSS Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Package NameEcosystemVulnerable VersionsFirst Patched Version
chrome-php/chromecomposer< 1.14.01.14.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the CssSelector class within the chrome-php/chrome library, specifically in how CSS selector expressions provided by the user were handled. The commit 34b2b8d1691f4e3940b1e1e95d388fffe81169c8 clearly shows the fix.

Before the patch:

  1. The __construct method stored the raw CSS selector expression.
  2. The expressionCount and expressionFindOne methods directly interpolated this raw expression into JavaScript code strings using sprintf with "%s".

This direct interpolation without proper encoding or sanitization meant that a crafted CSS selector containing special characters (e.g., ", </script>) could break out of the intended JavaScript string and inject arbitrary JavaScript code, leading to a Cross-Site Scripting (XSS) vulnerability.

The patch addresses this by encoding the expression using json_encode with appropriate flags (JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE, JSON_THROW_ON_ERROR) in the constructor. The methods expressionCount and expressionFindOne then use this pre-encoded expression, ensuring that any special characters are safely escaped before being embedded in the JavaScript context. The vulnerable functions are those that handled or used the unencoded expression: the constructor where it was stored, and the two methods that used it to generate JavaScript.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t *SS S*l**tor *xpr*ssions *r* not prop*rly *n*o***, w*i** **n l*** to XSS (*ross-sit* s*riptin*) vuln*r**iliti*s. ### P*t***s T*is is p*t**** in v*.**.*. ### Work*roun*s Us*rs **n *pply *n*o*in* m*nu*lly to t**ir s*l**tors, i* t**y *r*

Reasoning

T** vuln*r**ility li*s in t** `*ssS*l**tor` *l*ss wit*in t** `**rom*-p*p/**rom*` li*r*ry, sp**i*i**lly in *ow *SS s*l**tor *xpr*ssions provi*** *y t** us*r w*r* **n*l**. T** *ommit `****************************************` *l**rly s*ows t** *ix. *