XML External Entities (XXE)
ColdFusion Security Guide

What are XML External Entity (XXE) attacks and how can you avoid them in your ColdFusion / Lucee code?
ColdFusion Developer Security Training Online Class

The Risk

By leveraging a XML External Entity or XXE weakness an attacker can read files, cause a denial of service or make external network requests from your server - a Server Side Request Forgery (SSRF).

A Vulnerable Example

Assume you have the following CFML / ColdFusion code:


And the attacker passes the following payload as form.xml:

<?xml version="1.0" ?>
    <!ENTITY xxe SYSTEM "http://httpbin.org/uuid">]>

In this example the attacker defines an an XML External Entity called &xxe; which is defined as the result of calling the url: http://httpbin.org/uuid. Whenever &xxe; appears in the XML document, the XML parser will replace &xxe; with the HTTP result of the url http://httpbin.org/uuid

The attacker could also read any file on the server that your ColdFusion server process has permission to read.

The billion laughs variant

It is possible to cause a denial of service attack as well using XML External Entity processing in an XML document, here's an example called Billion Laughs (via OWASP):

<!DOCTYPE root [

Not so funny actually :-)

Where to look in your CFML code?

Any place in your code the deals with XML is potentially vulnerable to this type of attack. This certainly includes tags and functions like:

In addition certain document formats such as docx, xslx contain xml, and the libraries that parse the files could also be vulnerable.

Mitigating XXE in Adobe ColdFusion

The third argument of the xmlParse function accepts a struct of parser options. You can set allowExternalEntities: false within that struct

xmlParse(xml, false, {allowExternalEntities: false});

This syntax is also supported on Lucee and

Mitigating XXE in Lucee

Lucee provides a mechanism in Application.cfc to control the XML Features:

this.xmlFeatures = {
    externalGeneralEntities: false,
    secure: true,
    disallowDoctypeDecl: true

As of Lucee,, and these settings are enabled by default.

Mitigating XXE at the JVM Level

Java has a builtin XML parsing API called JAXP, which may or may not be used depending on the CFML engine, version or java library that you are using.

Here are some java system properties that you can set to control XML parsing features for the JAXP parser:

Again, this only applies to the JAXP (Java API For XML Parsing), other java based xml parsers such as xerces would ignore these system properties.

Alternatives to XmlParse

If you want to avoid XmlParse all together, you might consider using SafeXMLParse, which is a XML parser written in CFML meant to return a similar structure as XmlParse does without supporting all the dangerous XML features.

Another option is to convert the XML into JSON using the java class org.json.XML which is included in both Adobe ColdFusion and Lucee by default. You can call the toJSONObject and pass your XML String to it, then use deserializeJSON to obtain a CFML structure of the XML content.


The XML to JSON technique was inspired by James Moberg.

Additional Mitigation Techniques

This should be fixed at the code level, however you can limit the potential damage of an XXE attack by restricting the file system permissions, enabling sandbox security or restricting outbound network connections.

Additional Resources

Mitigating with FuseGuard

FuseGuard provides a XMLEntityInjectionFilter which can block requests that contain an XML External Entity definition. You should however always rely on code level fixes instead of WAF layer fixes as they may not block 100% of the possible attack vectors.