A significant new paper has emerged called "A new Approach towards DoS Penetration Testing on Web Services" by Andreas Falkenberg of SEC Consult Deutschland GmbH, and Christian Mainka, Juraj Somorovsky and Joerg Schwenk of Ruhr-University Bochum. In this paper, the authors developed a suite of automated tests for various Denial of Service (DoS) attacks on Web Services, and ran them against different web service stacks. In this post I will describe the attacks that were successful on Apache CXF and how they were fixed.
The authors found that Apache CXF (prior to 2.7.4/ 2.6.7/ 2.5.10) was vulnerable (see CVE-2013-2160) to the following attacks:
CXF uses Woodstox by default as the StAX XML Processor. It was decided that the best place to fix the vulnerabilities was at this level, both to offer protection to other stacks that use Woodstox, and also to remove the performance penalties associated with the DepthRestrictingInterceptor. From Woodstox 4.2.0, new functionality has been added to prevent Denial of Service attacks by restricting the size of XML. It uses the following defaults:
The authors found that Apache CXF (prior to 2.7.4/ 2.6.7/ 2.5.10) was vulnerable (see CVE-2013-2160) to the following attacks:
- Coercive Parsing Attack: The attacker sends a deeply nested XML document to the service.
- Attribute Count Attack: The attacker sends a message with a (very) high attribute count.
- Element Count Attack: The attacker sends a message with a (very) high number of non-nested elements.
- DJBX31A Hash Collision: A specific hash collision attack.
CXF uses Woodstox by default as the StAX XML Processor. It was decided that the best place to fix the vulnerabilities was at this level, both to offer protection to other stacks that use Woodstox, and also to remove the performance penalties associated with the DepthRestrictingInterceptor. From Woodstox 4.2.0, new functionality has been added to prevent Denial of Service attacks by restricting the size of XML. It uses the following defaults:
- Maximum Attributes per Element: 1000.
- Maximum Children per Element: (no effective bound).
- Maximum Stack Depth: 1000.
- Maximum Element Count: (no effective bound).
- Maximum Number of Characters: (no effective bound).
- Maximum Attributes per Element: 500.
- Maximum Children per Element: 50000.
- Maximum Stack Depth: 100.