My application uses JDK6. I have to fix the XXE vulnerability in my code, able to find solution as below. But the below code works only with JDK7. I have a limitation to fix this without upgrading to JDK7. The code I found as fix is
TransformerFactory tf = TransformerFactory.newInstance();
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
So far I tried to use the following code. But it did not fix the issue.
TransformerFactory tf = TransformerFactory.newInstance(); tf.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING, true);