CVE-2021-28965: XML round-trip vulnerability in REXML
Posted by mame on 5 Apr 2021
There is an XML round-trip vulnerability in REXML gem bundled with Ruby. This vulnerability has been assigned the CVE identifier CVE-2021-28965. We strongly recommend upgrading the REXML gem.
Details
When parsing and serializing a crafted XML document, REXML gem (including the one bundled with Ruby) can create a wrong XML document whose structure is different from the original one. The impact of this issue highly depends on context, but it may lead to a vulnerability in some programs that are using REXML.
Please update REXML gem to version 3.2.5 or later.
If you are using Ruby 2.6 or later:
- Please use Ruby 2.6.7, 2.7.3, or 3.0.1.
- Alternatively, you can use
gem update rexmlto update it. If you are using bundler, please addgem "rexml", ">= 3.2.5"to yourGemfile.
If you are using Ruby 2.5.8 or prior:
- Please use Ruby 2.5.9.
- You cannot use
gem update rexmlfor Ruby 2.5.8 or prior. - Note that Ruby 2.5 series is now EOL, so please consider upgrading Ruby to 2.6.7 or later as soon as possible.
Affected versions
- Ruby 2.5.8 or prior (You can NOT use
gem update rexmlfor this version.) - Ruby 2.6.6 or prior
- Ruby 2.7.2 or prior
- Ruby 3.0.0
- REXML gem 3.2.4 or prior
Credits
Thanks to Juho Nurminen for discovering this issue.
History
- Originally published at 2021-04-05 12:00:00 (UTC)
Recent News
Ruby 3.2.10 Released
Ruby 3.2.10 has been released.
Posted by hsbt on 14 Jan 2026
Ruby 4.0.1 Released
Ruby 4.0.1 has been released.
Posted by k0kubun on 13 Jan 2026
Ruby 4.0.0 Released
We are pleased to announce the release of Ruby 4.0.0. Ruby 4.0 introduces “Ruby Box” and “ZJIT”, and adds many improvements.
Posted by naruse on 25 Dec 2025
A New Look for Ruby's Documentation
Following the ruby-lang.org redesign, we have more news to celebrate Ruby’s 30th anniversary: docs.ruby-lang.org has a completely new look with Aliki—RDoc’s new default theme.
Posted by Stan Lo on 23 Dec 2025