XML Security in Java
Blog post from Semgrep
Java XML security presents a complex challenge due to the diverse range of APIs and inconsistent implementation of security features across them, which can leave applications vulnerable to attacks like XML External Entity (XXE) and exponential entity expansion. Despite Java XML APIs being around since 1998 and having undergone many improvements, their security features are often inconsistent, making it difficult to secure parsers without extensive testing or tools. Researchers Vasilii Ermilov and his colleague conducted a thorough analysis of various Java XML parsing interfaces, such as DOM, SAX, and StAX, using a variety of attack payloads to assess the effectiveness of 16 different security features. They discovered significant discrepancies in how these features protect against XML-related threats, with many features either inconsistently available or ineffective across different classes. The study highlights the necessity of using specific security configurations and tools like Semgrep to ensure secure XML processing, as well as the importance of keeping Java Development Kits (JDKs) updated to avoid known security bugs.