CVE-2021-28965: Rexml REXML Round-trip Instability Vulnerability

HIGH
Advisory Identifier: GHSA-8cr8-4vfw-mr7h
CVSS 7.5
CWE-115 CWE-611
Published
Advisory Summary

CVE-2021-28965 is a HIGH (CVSS 7.5) rexml round-trip instability vulnerability (CWE-115: Misinterpretation of Input) affecting Rexml libraries in the RubyGems ecosystem. The issue involves rexml round-trip instability. Remediation is available by upgrading affected packages to version 3.2.5.

CVE-2021-28965 at a Glance

CVE Identifier CVE-2021-28965
GHSA Identifier GHSA-8cr8-4vfw-mr7h
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-115: Misinterpretation of Input
Affected Product Rexml
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:H/A:N).

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 High (I:H)
Availability None (A:N)

How to Fix CVE-2021-28965

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.2.5
Upgrade rexml to 3.2.5
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-2021-28965, 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.2.5), 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-115: Misinterpretation of Input, where the product misinterprets an input, whether from an attacker or another product, in a security-relevant fashion. 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

The REXML gem before 3.2.5 in Ruby before 2.6.7, 2.7.x before 2.7.3, and 3.x before 3.0.1 does not properly address XML round-trip issues. An incorrect document can be produced after parsing and serializing.

CVE-2021-28965 Affected Rexml Versions

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

References

NVD — CVE-2021-28965 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-28965
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/2fe62e29094d95921d7e19abbd2e26b23d78dc5b
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/3c137eb119550874b2b3e27d12b733ca67033377
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/6a250d2cd1194c2be72becbdd9c3e770aa16e752
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/9b311e59ae05749e082eb6bbefa1cb620d1a786e
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/a659c63e37414506dfb0d4655e031bb7a2e73fc8
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/f7bab8937513b1403cea5aff874cbf32fd5e8551
Security Fix Commit FIX COMMIT
https://github.com/ruby/rexml/commit/f9d88e4948b4a43294c25dc0edb16815bd9d8618
hackerone.com/reports/1104077 WEB
https://hackerone.com/reports/1104077
Rexml Source Repository REPOSITORY
https://github.com/ruby/rexml
Rexml Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rexml/CVE-2021-28965.yml
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WTVFTLFVCSUE5CXHINJEUCKSHU4SWDMT
rubygems.org/gems/rexml WEB
https://rubygems.org/gems/rexml
Rexml Security Information SECURITY
https://security.netapp.com/advisory/ntap-20210528-0003
www.ruby-lang.org/en/news/2021/04/05/... WEB
https://www.ruby-lang.org/en/news/2021/04/05/xml-round-trip-vulnerability-in-rexml-cve-2021-28965

Frequently Asked Questions

What is CVE-2021-28965?
CVE-2021-28965 is a security vulnerability in Rexml involving REXML round-trip instability under CWE-115: Misinterpretation of Input.
Which Rexml versions are affected?
Affected versions include releases prior to 3.2.5 across affected packages: rexml.
What version fixes CVE-2021-28965?
Upgrading to 3.2.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rexml affected?
Yes, rexml is affected in releases prior to 3.2.5. Upgrade your dependency to 3.2.5 or later.
What is the CVSS score of CVE-2021-28965?
CVE-2021-28965 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:H/A:N.
What CWE is associated with CVE-2021-28965?
CVE-2021-28965 is classified under CWE-115: Misinterpretation of Input (The product misinterprets an input, whether from an attacker or another product, in a security-relevant fashion.).
How can I check RubyGems dependencies for CVE-2021-28965?
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-8cr8-4vfw-mr7h",
  "modified" : "2022-08-22T19:43:17Z",
  "published" : "2021-04-30T17:30:37Z",
  "aliases" : [ "CVE-2021-28965" ],
  "summary" : "REXML round-trip instability",
  "details" : "The REXML gem before 3.2.5 in Ruby before 2.6.7, 2.7.x before 2.7.3, and 3.x before 3.0.1 does not properly address XML round-trip issues. An incorrect document can be produced after parsing and serializing. ",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rexml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-28965"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/2fe62e29094d95921d7e19abbd2e26b23d78dc5b"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/3c137eb119550874b2b3e27d12b733ca67033377"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/6a250d2cd1194c2be72becbdd9c3e770aa16e752"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/9b311e59ae05749e082eb6bbefa1cb620d1a786e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/a659c63e37414506dfb0d4655e031bb7a2e73fc8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/f7bab8937513b1403cea5aff874cbf32fd5e8551"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ruby/rexml/commit/f9d88e4948b4a43294c25dc0edb16815bd9d8618"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/1104077"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ruby/rexml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rexml/CVE-2021-28965.yml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WTVFTLFVCSUE5CXHINJEUCKSHU4SWDMT"
  }, {
    "type" : "WEB",
    "url" : "https://rubygems.org/gems/rexml"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20210528-0003"
  }, {
    "type" : "WEB",
    "url" : "https://www.ruby-lang.org/en/news/2021/04/05/xml-round-trip-vulnerability-in-rexml-cve-2021-28965"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-115", "CWE-611" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-22T16:31:39Z",
    "nvd_published_at" : "2021-04-21T07:15:00Z"
  }
}