CVE-2022-23517: Rails html sanitizer Inefficient Regular Expression Complexity Vulnerability
HIGHCVE-2022-23517 is a HIGH (CVSS 7.5) inefficient regular expression complexity vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Rails html sanitizer libraries in the RubyGems ecosystem. The issue involves inefficient regular expression complexity in rails-html-sanitizer. Remediation is available by upgrading affected packages to version 1.4.4.
CVE-2022-23517 at a Glance
Security Impact
CVSS: 7.5
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:N/I:N/A:H).
How to Fix CVE-2022-23517
To remediate this vulnerability, upgrade all affected Rails html sanitizer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade rails-html-sanitizer to 1.4.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for rails-html-sanitizer
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-23517, inspect your project dependencies for Rails html sanitizer:
inspect dependencies for rails-html-sanitizer
Analyze the terminal output to locate any version of Rails html sanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.4), 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-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Rails html sanitizer, 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
CVE-2022-23517 Affected Rails html sanitizer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
rails-html-sanitizer
|
RubyGems |
< 1.4.4
|
1.4.4
|
References
Frequently Asked Questions
What is CVE-2022-23517?
Which Rails html sanitizer versions are affected?
What version fixes CVE-2022-23517?
Is rails-html-sanitizer affected?
What is the CVSS score of CVE-2022-23517?
What CWE is associated with CVE-2022-23517?
How can I check RubyGems dependencies for CVE-2022-23517?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5x79-w82f-gw8w",
"modified" : "2025-11-04T16:41:23Z",
"published" : "2022-12-13T17:43:02Z",
"aliases" : [ "CVE-2022-23517" ],
"summary" : "Inefficient Regular Expression Complexity in rails-html-sanitizer",
"details" : "## Summary\n\nCertain configurations of rails-html-sanitizer `< 1.4.4` use an inefficient regular expression that is susceptible to excessive backtracking when attempting to sanitize certain SVG attributes. This may lead to a denial of service through CPU resource consumption.\n\n\n## Mitigation\n\nUpgrade to rails-html-sanitizer `>= 1.4.4`.\n\n\n## Severity\n\nThe maintainers have evaluated this as [High Severity 7.5 (CVSS3.1)](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).\n\n\n## References\n\n- [CWE - CWE-1333: Inefficient Regular Expression Complexity (4.9)](https://cwe.mitre.org/data/definitions/1333.html)\n- https://hackerone.com/reports/1684163\n\n\n## Credit\n\nThis vulnerability was responsibly reported by @ooooooo-q (https://github.com/ooooooo-q).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "rails-html-sanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.4.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-5x79-w82f-gw8w"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23517"
}, {
"type" : "WEB",
"url" : "https://github.com/rails/rails-html-sanitizer/commit/56c61c0cebd1e493e8ad7bca2a0191609a4a6979"
}, {
"type" : "WEB",
"url" : "https://hackerone.com/reports/1684163"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rails/rails-html-sanitizer"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rails-html-sanitizer/CVE-2022-23517.yml"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2023/09/msg00012.html"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2024/09/msg00045.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-12-13T17:43:02Z",
"nvd_published_at" : "2022-12-14T17:15:00Z"
}
}