I am developing an Android application using
android:minSdkVersion="14"
In this application, you need to parse xml. For this I use a DOM parser like this
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = null; Document doc = null; try { dBuilder = dbFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); }
But when the code is checked for security, I got two security issues in line
dBuilder = dbFactory.newDocumentBuilder(); which
1.XML Entity Expansion Injection (XML Bomb)
2.XML Implementation of external objects (attack XXE)
After some research, I added the line dbFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
But now I get an exception when this line is executed
javax.xml.parsers.ParserConfigurationException: http:
Can someone help me?
source share