Skip to content

Commit 01fcfcc

Browse files
committed
Security fix: Prevent XXE attack on source/sink definition file
1 parent 81317f4 commit 01fcfcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/source/parsers/xml/XMLSourceSinkParser.java

+5
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,11 @@ protected XMLSourceSinkParser(ICategoryFilter categoryFilter) {
484484
protected void parseInputStream(InputStream stream) {
485485
SAXParserFactory pf = SAXParserFactory.newInstance();
486486
try {
487+
// Prevent XXE
488+
pf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
489+
pf.setFeature("http://xml.org/sax/features/external-general-entities", false);
490+
pf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
491+
487492
SAXParser parser = pf.newSAXParser();
488493
parser.parse(stream, new SAXHandler());
489494
} catch (ParserConfigurationException e) {

0 commit comments

Comments
 (0)