CVE-2025-58767: Rexml Denial of Service Vulnerability

LOW
Advisory Identifier: GHSA-c2f4-jgmc-q2r5
CWE-776 CWE-400
Published
Advisory Summary

CVE-2025-58767 is a LOW denial of service vulnerability (CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')) affecting Rexml libraries in the RubyGems ecosystem. The issue involves rexml has dos condition when parsing malformed xml file. Remediation is available by upgrading affected packages to version 3.4.2.

CVE-2025-58767 at a Glance

CVE Identifier CVE-2025-58767
GHSA Identifier GHSA-c2f4-jgmc-q2r5
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')
Affected Product Rexml
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2025-58767

To remediate this vulnerability, upgrade all affected Rexml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rexml fixed: 3.4.2
Upgrade rexml to 3.4.2
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 rexml

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-58767, inspect your project dependencies for Rexml:

inspect dependencies for rexml

Analyze the terminal output to locate any version of Rexml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.4.2), 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-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion'), where the product uses xml documents and allows their structure to be defined with a document type definition (dtd), but it does not properly control the number of recursive definitions of entities. In Rexml, 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

### Impact The REXML gems from 3.3.3 to 3.4.1 have a DoS vulnerability when parsing XML containing multiple XML declarations. If you need to parse untrusted XMLs, you may be impacted to these vulnerabilities. ### Patches REXML gems 3.4.2 or later include the patches to fix these vulnerabilities. ### Workarounds Don't parse untrusted XMLs. ### References * https://www.ruby-lang.org/en/news/2025/09/18/dos-rexml-cve-2025-58767/ : An announcement on www.ruby-lang.org

CVE-2025-58767 Affected Rexml Versions

1 component(s)
Fixed Versions:
3.4.2
Product / Package Ecosystem Affected Versions Fixed Version
rexml
RubyGems
≥ 3.3.3
< 3.4.2
3.4.2

References

Frequently Asked Questions

What is CVE-2025-58767?
CVE-2025-58767 is a security vulnerability in Rexml involving REXML has DoS condition when parsing malformed XML file under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion').
Which Rexml versions are affected?
Affected versions include releases prior to 3.4.2 across affected packages: rexml.
What version fixes CVE-2025-58767?
Upgrading to 3.4.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rexml affected?
Yes, rexml is affected in releases prior to 3.4.2. Upgrade your dependency to 3.4.2 or later.
What CWE is associated with CVE-2025-58767?
CVE-2025-58767 is classified under CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion') (The product uses XML documents and allows their structure to be defined with a Document Type Definition (DTD), but it does not properly control the number of recursive definitions of entities.).
How can I check RubyGems dependencies for CVE-2025-58767?
Run the dependency tree command: 'inspect dependencies for rexml'. 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-c2f4-jgmc-q2r5",
  "modified" : "2025-09-19T14:41:30Z",
  "published" : "2025-09-17T18:26:48Z",
  "aliases" : [ "CVE-2025-58767" ],
  "summary" : "REXML has DoS condition when parsing malformed XML file",
  "details" : "### Impact\n\nThe REXML gems from 3.3.3 to 3.4.1 have a DoS vulnerability when parsing XML containing multiple XML declarations.\nIf you need to parse untrusted XMLs, you may be impacted to these vulnerabilities.\n\n### Patches\n\nREXML gems 3.4.2 or later include the patches to fix these vulnerabilities.\n\n### Workarounds\n\nDon't parse untrusted XMLs.\n\n### References\n\n* https://www.ruby-lang.org/en/news/2025/09/18/dos-rexml-cve-2025-58767/ : An announcement on www.ruby-lang.org",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rexml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.3.3"
      }, {
        "fixed" : "3.4.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 3.4.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/security/advisories/GHSA-c2f4-jgmc-q2r5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-58767"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/5859bdeac792687eaf93d8e8f0b7e3c1e2ed5c23"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ruby/rexml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rexml/CVE-2025-58767.yml"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2025/09/18/dos-rexml-cve-2025-58767"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-776" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-17T18:26:48Z",
    "nvd_published_at" : "2025-09-17T18:15:52Z"
  }
}