CVE-2013-1821: Input Validation

Published Feb 22, 2013
·
Updated

An unrestricted entity expansion flaw was reported in Ruby that can lead to a denial of service in REXML. When reading text nodes from an XML document, the REXML parser could be coerced into allocating extremely large string objects which could consume all available memory on the system.

Impacted code would look similar to the following:

document = REXML::Document.new somexmldoc document.root.text

In this case, when the 'text' method is called, entities will be expanded. An attacker could send a relatively small XML document that, when the entities were resolved, would consume extremely large amounts of memory on the target system. It is noted that this vulnerability is similar to the 'Billion Laughs' attack, and is also related to CVE-2013-1664 (Python).

The upstream advisory has a work-around patch that limits the size of entity substitutions.

External References:

http://www.ruby-lang.org/en/news/2013/02/22/rexml-dos-2013-02-22/

Other sources

lib/rexml/text.rb in the REXML parser in Ruby before 1.9.3-p392 allows remote attackers to cause a denial of service (memory consumption and crash) via crafted text nodes in an XML document, aka an XML Entity Expansion (XEE) attack.

MITRE

When reading text nodes from an XML document, the REXML parser can be coerced in to allocating extremely large string objects which can consume all of the memory on a machine, causing a denial of service.

Jruby resolves this bug in version 1.7.3 as noted in https://www.jruby.org/2013/02/21/jruby-1-7-3.html

Affected Software

17 affected componentsFixes available
maven/org.jruby:jruby<1.7.3
1.7.3
redhat/ruby<1.9.3
1.9.3
redhat/ruby<2.0.0
2.0.0
ruby-lang Ruby<=1.9.3
ruby-lang Ruby=1.9
ruby-lang Ruby=1.9.1
ruby-lang Ruby=1.9.2
ruby-lang Ruby=1.9.3
ruby-lang Ruby=1.9.3-p0
ruby-lang Ruby=1.9.3-p125
ruby-lang Ruby=1.9.3-p194
ruby-lang Ruby=1.9.3-p286
ruby-lang Ruby=1.9.3-p383
ruby-lang Ruby=2.0
ruby-lang Ruby=2.0.0
ruby-lang Ruby=2.0.0-rc1
ruby-lang Ruby=2.0.0-rc2

Event History

Feb 22, 2013
Data Sourced
via Red Hat·03:46 PM
DescriptionSeverityAffected Software
Apr 9, 2013
CVE Published
via MITRE·09:00 PM
Data Sourced
via MITRE·09:00 PM
Description
May 17, 2022
Advisory Published
03:23 AM

Frequently Asked Questions

1

What is the severity of CVE-2013-1821?

CVE-2013-1821 is classified as a medium-severity vulnerability due to its potential to cause denial of service.

2

How do I fix CVE-2013-1821?

To fix CVE-2013-1821, upgrade Ruby to version 1.9.3 or later, or JRuby to 1.7.3 or later.

3

What are the impacts of CVE-2013-1821?

The impacts of CVE-2013-1821 include the possibility of exhausting system memory due to unrestricted entity expansion in XML parsing.

4

Which Ruby versions are affected by CVE-2013-1821?

Ruby versions prior to 1.9.3, including all 1.9.x versions, are affected by CVE-2013-1821.

5

Is JRuby affected by CVE-2013-1821?

Yes, JRuby versions prior to 1.7.3 are affected by CVE-2013-1821.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203