XML
acronymKept in this browser · My desk
Stands for: Extensible Markup Language
The World Wide Web Consortium (W3C) markup language for structured documents, a subset of SGML (Standard Generalized Markup Language) in which elements nest properly inside a single root element.
The current edition of XML (Extensible Markup Language) 1.0 is the fifth, a World Wide Web Consortium (W3C) Recommendation of 26 November 2008. It separates two levels: a data object is an XML document only if it is well-formed, and it is valid only if it also has a document type declaration and meets the constraints expressed in it. Breaking a well-formedness rule is a fatal error, after which a conforming processor must stop processing the document normally, which is why one unescaped & or < outside markup can stop a whole import. The DOCTYPE, where entities are declared, is also where XXE (XML external entity) attacks begin.
Where it came from. XML (Extensible Markup Language) was written by a working group formed under the World Wide Web Consortium (W3C) in 1996, first called the SGML Editorial Review Board, chaired by Jon Bosak of Sun Microsystems with Dan Connolly as the W3C's contact. Its goal was to let generic SGML (Standard Generalized Markup Language, ISO 8879:1986) be served, received and processed on the web the way HTML (HyperText Markup Language) already was, so XML is defined as a subset of SGML that the specification describes completely. The first Recommendation is dated 10 February 1998; the fifth edition of 26 November 2008, edited by Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler and François Yergeau, is the current one. Two of its ten design goals explain a lot of later practice: the number of optional features should be kept to the absolute minimum, ideally zero, and terseness in markup is of minimal importance.
Well-formed versus valid. Well-formedness is the grammar every XML processor must enforce. There is exactly one root element, also called the document element, and every other element nests properly inside it; the name in an end-tag must match the name in its start-tag; an attribute name may appear only once in the same tag; and the ampersand and the left angle bracket must not appear literally except as markup delimiters or inside a comment, a processing instruction or a CDATA section. Elsewhere they are written as entity or character references, and XML predefines five entities for that purpose: amp, lt, gt, apos and quot. Validity is the further level: a document type declaration (DOCTYPE) and a document that satisfies the constraints declared in it. Every processor must accept the UTF-8 and UTF-16 encodings of Unicode.
Fatal means fatal. The specification calls a violation of well-formedness a fatal error: the processor must detect and report it, may keep scanning to report further errors, but must not continue normal processing, which means it must not keep passing character data and structure to the application as usual. That rule is deliberate, so a single stray ampersand in a value exported from a database, or a truncated file, makes the whole document unusable rather than slightly wrong.
The versions around it. XML 1.1, whose second edition dates from 16 August 2006, exists mainly for line ends and control characters: it adds NEL (#x85), the line end of IBM mainframe conventions, and the Unicode line separator #x2028; allows character references to the control characters #x1 to #x1F; requires #x7F to #x9F to appear only as references; and still forbids #x0. Namespaces in XML 1.0, in its third edition of 8 December 2009, is the separate recommendation that lets one document mix vocabularies. Request for Comments (RFC) 7303 (July 2014) registers application/xml, keeps text/xml as an alias and standardizes the +xml suffix for other XML-based media types.
Where engineers meet it. The Network Configuration Protocol (NETCONF), RFC 6241 of June 2011, encodes both configuration data and protocol messages in XML and carries its operations as remote procedure calls, so XML is what a router or switch exchanges with an automation system that speaks NETCONF. SAML (Security Assertion Markup Language) 2.0 messages are XML documents, deflated and Base64-encoded into a Uniform Resource Locator (URL) in the Redirect binding or Base64-encoded into a form in the POST binding, which is why single sign-on troubleshooting starts with a decoder.
The DOCTYPE is the attack surface. Entities declared in a DOCTYPE can point outside the document, and the OWASP (Open Worldwide Application Security Project) cheat sheet defines XML external entity (XXE) injection as a processor resolving such an entity from untrusted input, which can expose local files, cause server-side request forgery (SSRF) or exhaust resources. MITRE's Common Weakness Enumeration entry CWE-611 gives the classic payloads: a file:// Uniform Resource Identifier (URI) that reads /etc/passwd back into the response, and an http:// URI that makes the server fetch from hosts the attacker cannot reach, bypassing firewalls or hiding a port scan. Entity expansion is the other half: the billion laughs attack nests entities that each reference the previous one several times until a few hundred bytes expand into gigabytes, and the quadratic blowup repeats one large entity to slip under limits on nesting. Defaults have improved, unevenly: OWASP notes that libxml2 disabled XXE by default from version 2.9, and the Python documentation says Expat neither reads local files nor opens connections by default but that versions before 2.7.2 may still be vulnerable to billion laughs and quadratic blowup. The safe rule in every language is the same: disable document type definitions (DTDs) entirely or reject any DOCTYPE, keep XInclude off, and remember that blocking XXE does not by itself stop every XML denial of service.
Numbers worth remembering: 1998 for the first Recommendation and 26 November 2008 for the fifth edition; one root element; five predefined entities; UTF-8 and UTF-16 mandatory for every processor; and XML 1.1's #x85 and #x2028 as the only new line ends.
Also known as: extensible markup language, xml 1.0, well-formed xml, well-formedness
Sources
- W3C, Extensible Markup Language (XML) 1.0 (Fifth Edition), W3C Recommendation 26 November 2008 (read 2026-10-27): a subset of SGML; an XML document if well-formed, valid if it meets further constraints; exactly one root element, the rest nesting properly; & and < escaped outside markup; well-formedness violations are fatal errors, after which a processor MUST NOT continue normal processing
- W3C, Extensible Markup Language (XML) 1.0 (Fifth Edition), 26 November 2008, editors Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, François Yergeau (read 2026-11-11): Working Group formed under the W3C in 1996, originally the SGML Editorial Review Board, chaired by Jon Bosak of Sun Microsystems, Dan Connolly as W3C contact; the ten design goals, including optional features ideally zero and terseness of minimal importance; ISO 8879:1986; fatal errors; Element Type Match and Unique Att Spec; the five predefined entities; all processors MUST accept UTF-8 and UTF-16
- W3C, Extensible Markup Language (XML) 1.0, W3C Recommendation 10 February 1998 (read 2026-11-11): the first edition and its date
- W3C, Extensible Markup Language (XML) 1.1 (Second Edition), W3C Recommendation 16 August 2006, edited in place 29 September 2006 (read 2026-11-11): NEL (#x85) and #x2028 added as line ends for mainframe interoperability; character references to #x1 to #x1F allowed; #x7F to #x9F only as references; #x0 still forbidden
- W3C, Namespaces in XML 1.0 (Third Edition), W3C Recommendation 8 December 2009 (read 2026-11-11): the current namespaces recommendation
- IETF, RFC 7303, XML Media Types, H. Thompson and C. Lilley, July 2014 (read 2026-11-11): application/xml, application/xml-external-parsed-entity and application/xml-dtd; text/xml as an alias; the +xml suffix; obsoletes RFC 3023
- IETF, RFC 6241, Network Configuration Protocol (NETCONF), June 2011 (read 2026-11-11): XML-based data encoding for configuration data and protocol messages; operations as remote procedure calls; obsoletes RFC 4741
- OWASP Cheat Sheet Series, XML External Entity Prevention (read 2026-11-11): XXE occurs when an XML processor resolves an external entity from untrusted input, exposing local files, causing SSRF or exhausting resources; disable DTDs, reject DOCTYPE, disable external entities and XInclude, limit expansion; libxml2 disabled XXE by default from version 2.9; preventing XXE does not prevent every XML denial of service
- OWASP Foundation, About the OWASP Foundation (read 2026-11-11): the expansion Open Worldwide Application Security Project
- MITRE, CWE-611, Improper Restriction of XML External Entity Reference (read 2026-11-11): file:// URIs read local files such as /etc/passwd; http:// URIs make the server issue requests it should not, bypassing firewalls or hiding port scans; CPU and memory exhaustion
- Python documentation, XML Processing Modules, XML security (read 2026-11-11): Expat by default does not access local files or open network connections; Expat older than 2.7.2 may be vulnerable to billion laughs, quadratic blowup and large tokens; the billion laughs and quadratic blowup attacks described
- OASIS, Bindings for the OASIS Security Assertion Markup Language (SAML) V2.0, OASIS Standard, 15 March 2005 (read 2026-11-11): SAML protocol messages are XML, deflated and base64-encoded for the Redirect binding and base64-encoded in a form for the POST binding