tainted-documentbuilderfactory-xxe-spring
Billion Laughs Attack
. It is our recommendation to secure this parser against XXE attacks by configuring the DocumentBuilder parser with factory.setFeature(http://apache.org/xml/features/disallow-doctype-decl, true)
. Alternatively, the following configurations also provide protection against XXE attacks. factory.setExpandEntityReferences(false)
, factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true)
, factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "")
, or enabling both factory.setFeature("http://xml.org/sax/features/external-general-entities", false)
and factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
. For more information, see: Java XXE prevention