Skip to content

Commit 0f5ad81

Browse files
authored
chore: add 2 brand new nokogiri advisory (#1041)
1 parent b1e3c15 commit 0f5ad81

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
gem: nokogiri
3+
ghsa: c4rq-3m3g-8wgx
4+
url: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-c4rq-3m3g-8wgx
5+
title: Nokogiri CSS selector tokenizer has regular expression backtracking
6+
date: 2026-05-06
7+
description: |
8+
## Summary
9+
10+
Nokogiri's CSS selector tokenizer contains regular expressions whose construction may result in exponential regex backtracking on adversarial selectors. Three ReDoS vectors are addressed in this release:
11+
12+
1. String-literal tokenization on certain unterminated quoted-string input.
13+
2. String-literal tokenization on a separate class of hex-escape-rich input.
14+
3. Identifier tokenization on hex-escape-rich input.
15+
16+
The public CSS selector methods that funnel through the affected tokenizer are `Nokogiri::CSS.xpath_for`, `Node#css`, `Node#at_css`, `Searchable#search`, and `CSS::Parser#parse`.
17+
18+
19+
## Mitigation
20+
21+
Upgrade to Nokogiri `>= 1.19.3`.
22+
23+
If users are unable to upgrade, two options are available:
24+
25+
- Avoid the use of attacker-controlled text in CSS selectors. Applications that only pass developer-authored selectors to Nokogiri are not directly exposed.
26+
- Set global `Regexp.timeout` (Ruby 3.2+, JRuby 9.4+) to bound parse time.
27+
28+
## Severity
29+
30+
The Nokogiri maintainers have evaluated this as **High Severity** (CVSS 7.5, `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`).
31+
32+
An attacker able to inject user-supplied text into a CSS selector parse method can cause exponential backtracking, resulting in a potential denial of service.
33+
34+
35+
## Resources
36+
37+
- [CWE-1333: Inefficient Regular Expression Complexity](https://cwe.mitre.org/data/definitions/1333.html)
38+
39+
40+
## Credit
41+
42+
Vector 1 was responsibly reported by @colby-swandale. Vectors 2 and 3 were discovered by @flavorjones during the response to the original report.
43+
cvss_v3: 7.5
44+
patched_versions:
45+
- ">= 1.19.3"
46+
related:
47+
url:
48+
- https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-c4rq-3m3g-8wgx
49+
- https://github.com/advisories/GHSA-c4rq-3m3g-8wgx
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
gem: nokogiri
3+
ghsa: v2fc-qm4h-8hqv
4+
url: https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-v2fc-qm4h-8hqv
5+
title: Nokogiri XSLT transform has a memory leak
6+
date: 2026-05-06
7+
description: |
8+
## Summary
9+
10+
Nokogiri's `Nokogiri::XSLT::Stylesheet#transform` leaks a small heap allocation when passed a Ruby string parameter containing a null byte.
11+
12+
For applications that pass attacker-controlled input through `XSLT.transform` parameters, this may be a vector for a denial of service attack against long-running processes.
13+
14+
15+
## Mitigation
16+
17+
Upgrade to Nokogiri `>= 1.19.3`.
18+
19+
Users may also be able to mitigate this issue without upgrading by validating untrusted transform parameters before passing them to `Nokogiri::XSLT::Stylesheet#transform`.
20+
21+
22+
## Severity
23+
24+
The Nokogiri maintainers have evaluated this as **Moderate Severity**, CVSS 5.3.
25+
26+
Each leaked allocation is approximately 24–32 bytes, so meaningful memory growth requires sustained attacker-controlled traffic at high call rates. The bug does not cause memory corruption, information disclosure, or any change in the behavior of the transform itself, and the string-handling exception is raised as expected.
27+
28+
Applications that do not pass raw attacker-controlled bytes to XSLT parameters are unlikely to be affected in practice.
29+
30+
31+
## Resources
32+
33+
- [CWE-401: Missing Release of Memory after Effective Lifetime](https://cwe.mitre.org/data/definitions/401.html)
34+
35+
36+
## Credit
37+
38+
This vulnerability was responsibly reported by @Captainjack-kor.
39+
cvss_v3: 5.3
40+
patched_versions:
41+
- ">= 1.19.3"
42+
related:
43+
url:
44+
- https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-v2fc-qm4h-8hqv
45+
- https://github.com/advisories/GHSA-v2fc-qm4h-8hqv

0 commit comments

Comments
 (0)