Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the Android XmlPullParser handle vulnerabilities?

If I'm using an XmlPullParser in my application is it possible for it to be exposed to vulnerabilities such as "billion laughs"?

What security procedures should be taken when using the XmlPullParser?

like image 794
sameer54321 Avatar asked Nov 08 '22 09:11

sameer54321


1 Answers

By default, the XMlPullParser will not parse entities, so you will not be exposed to such vulnerabilities. But, you will have to deal with exceptions launched when trying to parse undeclared entities. To keep this behavior, you have to ensure that XMlPullParser.FEATURE_PROCESS_DOCDECL is set to false prior any document parsing.

It is also recommended to not validate your XML with DTD coming from unknown source. The best approach for this is to use an embedded DTD in your application and use it to validate the XML.

You can find more on XML Extenal Entities following these links:

  • XXE Processing from OWASP
  • XXE Prevention Cheat Sheet from OWASP
like image 95
Arnaud Develay Avatar answered Nov 15 '22 06:11

Arnaud Develay