REXML ReDoS Vulnerability in Ruby Packages: CVE-2024-49761

ruby-rexml Updated 02 Oct 2025

Summary

28/10/2024
N/A
Yes i
High
7.5

CVE-2024-49761: REXML is an XML toolkit for Ruby. Affects ruby-rexml across 3 version ranges.

< 3.3.9-r0 < ce59f2eb1aeb371fe1643414f06618dbe031979f < f5c772fc7cbe9f5b58d962939fcb1c7e3fb1cfa6

Fixed in 3.3.9-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

REXML is an XML toolkit for Ruby, widely used for parsing and manipulating XML data. It provides a simple and efficient way to handle XML documents, making it a popular choice among Ruby developers. However, prior to version 3.3.9, REXML contained a ReDoS (Regular Expression Denial of Service) vulnerability that could be exploited when parsing specially crafted XML documents with numerous digits in hex numeric character references.

Vulnerability Detail

The vulnerability arises from the way REXML processes hex numeric character references in XML. Specifically, when an XML document contains many digits between &# and x...; in a hex numeric character reference (&#x...;), it can lead to excessive backtracking in the regular expression engine, causing significant performance degradation or even denial of service. This issue affects Ruby versions prior to 3.3.9, with Ruby 3.1 being the only maintained version vulnerable to this flaw. If exploited, attackers could craft XML inputs that would consume excessive CPU resources, potentially leading to service outages.

How To Fix

Minimum fixed version

3.3.9-r0

This is the first release that contains the fix.

sudo apk add --upgrade ruby-rexml

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid processing XML documents that contain hex numeric character references with excessive digits. If possible, validate and sanitize XML inputs before parsing them with REXML to mitigate the risk of exploitation.

Conclusion

CVE-2024-49761 highlights a critical ReDoS vulnerability in the REXML gem for Ruby, affecting versions prior to 3.3.9. It is crucial for developers using vulnerable Ruby versions to update their packages promptly to avoid potential denial of service attacks. Implementing input validation can also help mitigate risks.

See every vulnerability recorded for ruby-rexml →

Share this vulnerability

FAQ

CVE-2024-49761 is a vulnerability in the REXML gem for Ruby that allows for a ReDoS attack through specially crafted XML documents.

Ruby versions prior to 3.3.9 are affected, with Ruby 3.1 being the only maintained version vulnerable to this issue.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected by this vulnerability.

If updating is not possible, consider implementing input validation and sanitization to mitigate the risk of exploitation.

Yes, the patch is included in REXML gem version 3.3.9 and later. It is recommended to update to this version or higher.

Related vulnerabilities

Recent vulnerabilities recorded for ruby-rexml.

How To Fix

Minimum fixed version

3.3.9-r0

This is the first release that contains the fix.

sudo apk add --upgrade ruby-rexml

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback