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:01 +02:00
parent 24c72edc4c
commit 9b5c721c2a
2 changed files with 21 additions and 2 deletions
@@ -741,8 +741,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) {
@@ -755,6 +756,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
@@ -767,6 +780,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.
*