XML Signature Wrapping

Cybersecurity Glossary APIs & Server-Side Security

XML Signature Wrapping

An attack that exploits XML signature validation by moving or copying signed elements, tricking the application into using unsigned attacker-controlled content.

XML Signature Wrapping (XSW) is an attack against XML digital signatures where the attacker manipulates the document structure to make the application process unsigned content while signature validation passes on different content.

How It Works

XML signatures reference specific elements by ID. If an application validates the signature on one element but processes a different element with the same ID (or in an expected location), attackers can inject malicious content.

Why It Works

  • Signature validation uses XPath/ID reference
  • Application logic uses different selection method
  • XML allows multiple elements with same ID
  • Libraries may not enforce strict document structure

Prevention

  • Ensure signed element is exactly what's processed
  • Reject documents with duplicate IDs
  • Use strict schema validation
  • Verify assertion is direct child of signed response

See Also