XML parsers Denial of Service attacks target XML parsers, which are software components responsible for parsing and interpreting XML documents.
XML files are complex data structures. When a malicious user is able to submit an XML file, it triggers complex processing that may overwhelm the parser. Most of the time, those complex processing are enabled by default, and XML parsers do not take preventive measures against Denial of Service attacks.
When an attacker successfully exploits the vulnerability, it can lead to a Denial of Service (DoS) condition.
Affected system becomes unresponsive or crashes, rendering it unavailable to legitimate users. This can have severe consequences, especially for critical systems that rely on continuous availability, such as web servers, APIs, or network services.
In some cases, XML parsers Denial of Service attacks can be used as a part of larger-scale amplification attacks. By leveraging the vulnerability, attackers can generate a disproportionately large response from the targeted system, amplifying the impact of their attack. This can result in overwhelming network bandwidth and causing widespread disruption.
import javax.xml.parsers.DocumentBuilderFactory; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false); // Noncompliant
import javax.xml.parsers.DocumentBuilderFactory; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
import org.dom4j.io.SAXReader; SAXReader xmlReader = new SAXReader(); xmlReader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false); // Noncompliant
import org.dom4j.io.SAXReader; SAXReader xmlReader = new SAXReader(); xmlReader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
import org.jdom2.input.SAXBuilder; SAXBuilder builder = new SAXBuilder(); builder.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false); // Noncompliant
import org.jdom2.input.SAXBuilder; SAXBuilder builder = new SAXBuilder(); builder.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);