GHSA-84W7-HPVM-RXX2
ReDoS - expand_shorthand! regex (RE_FUNCTIONS) backtracks exponentially on an unclosed CSS function value
Overview
Description
SUMMARY
expand_shorthand! (and the expand_dimensions_shorthand! it calls) runs the RE_FUNCTIONS regex over declaration values. That regex has a nested quantifier inside a group that can recurse, so on a value that opens a CSS function and never closes it, the match degrades into exponential backtracking. A CSS string of a few dozen bytes pins one CPU core for minutes to hours.
IMPACT
Any code that parses untrusted CSS and then expands shorthands is affected. That includes premailer, whose adapters call expand_shorthand! while inlining styles, so an application that runs premailer over attacker-supplied email or user CSS can be stalled by a tiny payload. The property has to be one of the dimension shorthands (margin, padding, border-*), all of which an attacker can name freely.
Source: OX vulnerability database
Severity
UNKNOWN
No CVSS vector in the source. Severity comes from the advisory.
Affected packages · 1
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| RubyGems | css_parser | — | 3.2.0 |
Open a package to see all its vulnerabilities.
Operating systems
No Linux distribution reports this ID.
References
- github.com https://github.com/premailer/css_parser/blob/master/CHANGELOG.md#version-320
- github.com https://github.com/premailer/css_parser/compare/v3.1.0...v3.2.0
- github.com https://github.com/premailer/css_parser/security/advisories/GHSA-84w7-hpvm-rxx2
- rubygems.org https://rubygems.org/gems/css_parser/versions/3.2.0
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.