Skip to content

Commit

Permalink
#4: Security fix: XXEs are now not resolved anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Bischofberger committed Sep 24, 2015
1 parent 6578eab commit eb72dc6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>SAML2 Burp Suite Extension</description>
<groupId>ch.hsr</groupId>
<artifactId>saml-raider</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/helpers/XMLHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ public class XMLHelpers {
* @return DocumentBuilderFactory NamespaceAware
*/
public DocumentBuilderFactory getDBF() {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
return documentBuilderFactory;
try {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
documentBuilderFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING , true);
documentBuilderFactory.setNamespaceAware(true);
return documentBuilderFactory;
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
return null;
}

/**
Expand Down

0 comments on commit eb72dc6

Please sign in to comment.