CVE-2013-1821: Input Validation
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
Event History
Frequently Asked Questions
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.
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.
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.
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.
Is JRuby affected by CVE-2013-1821?
Yes, JRuby versions prior to 1.7.3 are affected by CVE-2013-1821.