Fixed: Found a new XXE (XML External Entity Injection) vulnerability in EntityImport (OFBIZ-12304)

The XXE vulnerability can read arbitrary files on the server.

Thanks: thiscodecc for reporting this security issue (post-auth)
This commit is contained in:
Jacques Le Roux
2021-09-13 08:16:49 +02:00
parent 7e00617828
commit a28316b70d
2 changed files with 21 additions and 2 deletions
@@ -806,8 +806,9 @@ public final class UtilValidate {
return true;
}
/** isUrl returns true if the string contains ://
* @param s String to validate
/**
* isUrl returns true if the string contains ://
* @param s String to validate Note: this does not handle "component://" specific to OFBiz
* @return true if s contains ://
*/
public static boolean isUrl(String s) {
@@ -820,6 +821,18 @@ public final class UtilValidate {
return false;
}
/**
* URLInString returns true if the string contains :// and not "component://"
* @param s String to validate
* @return true if s contains :// and not "component://"
*/
public static boolean URLInString(String s) {
if (isEmpty(s) || s.contains("component://")) {
return false;
}
return s.indexOf("://") != -1;
}
/**
* isValidUrl returns true if the string is a valid URL (using Commons UrlValidator)
* @param s String to validate
@@ -832,6 +845,7 @@ public final class UtilValidate {
return UrlValidator.getInstance().isValid(s);
}
/** isYear returns true if string s is a valid
* Year number. Must be 2 or 4 digits only.
*