Spring XML External Entities (XXE) Guide: Examples and Prevention
Blog post from StackHawk
XML is a markup language used to define and categorize data, allowing it to move between servers, but it poses security risks due to features like XML external entities (XXE) that can access external resources, potentially leading to unauthorized data retrieval and server-side request forgery attacks. XXE vulnerabilities occur when XML parsers process these external references without proper validation, posing a significant threat to Java applications, as most Java XML parsers have XXE enabled by default. The Spring framework, widely used for Java applications, has XXE parsing disabled by default, but specific versions in the past had this feature enabled, requiring users to upgrade to patched versions or manually disable XXE parsing when using non-bundled XML parsers. To mitigate XXE vulnerabilities, it is recommended to validate input or disable external entity parsing and consider using JSON or REST APIs as alternatives to XML to avoid such security risks.