CVE-2022-23517: Rails html sanitizer Inefficient Regular Expression Complexity Vulnerability

HIGH
Advisory Identifier: GHSA-5x79-w82f-gw8w
CVSS 7.5
CWE-1333
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2022-23517
GHSA Identifier GHSA-5x79-w82f-gw8w
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1333: Inefficient Regular Expression Complexity
Affected Product Rails html sanitizer
Package Ecosystem RubyGems
Published Date
Last Updated

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).

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 None (C:N)
Integrity None (I:N)
Availability High (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.

rails-html-sanitizer fixed: 1.4.4
Upgrade rails-html-sanitizer to 1.4.4
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 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

## Summary Certain 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. ## Mitigation Upgrade to rails-html-sanitizer `>= 1.4.4`. ## Severity The 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). ## References - [CWE - CWE-1333: Inefficient Regular Expression Complexity (4.9)](https://cwe.mitre.org/data/definitions/1333.html) - https://hackerone.com/reports/1684163 ## Credit This vulnerability was responsibly reported by @ooooooo-q (https://github.com/ooooooo-q).

CVE-2022-23517 Affected Rails html sanitizer Versions

1 component(s)
Fixed Versions:
1.4.4
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?
CVE-2022-23517 is a security vulnerability in Rails html sanitizer involving Inefficient Regular Expression Complexity in rails-html-sanitizer under CWE-1333: Inefficient Regular Expression Complexity.
Which Rails html sanitizer versions are affected?
Affected versions include releases prior to 1.4.4 across affected packages: rails-html-sanitizer.
What version fixes CVE-2022-23517?
Upgrading to 1.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rails-html-sanitizer affected?
Yes, rails-html-sanitizer is affected in releases prior to 1.4.4. Upgrade your dependency to 1.4.4 or later.
What is the CVSS score of CVE-2022-23517?
CVE-2022-23517 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-23517?
CVE-2022-23517 is classified under CWE-1333: Inefficient Regular Expression Complexity (The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.).
How can I check RubyGems dependencies for CVE-2022-23517?
Run the dependency tree command: 'inspect dependencies for rails-html-sanitizer'. 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-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"
  }
}