Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
Prevents generics markup in string type names. Conflict handled by hand framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
This commit is contained in:
@@ -65,8 +65,9 @@ public final class SafeObjectInputStream extends ObjectInputStream {
|
||||
@Override
|
||||
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
|
||||
String className = classDesc.getName();
|
||||
// BlackList exploits; eg: don't allow RMI here
|
||||
if (className.contains("java.rmi")) {
|
||||
// DenyList
|
||||
if (className.contains("java.rmi") // Don't allow RMI
|
||||
|| className.contains("<")) { // Prevent generics markup in string type names
|
||||
throw new InvalidClassException(className, "Unauthorized deserialisation attempt");
|
||||
}
|
||||
if (!whitelistPattern.matcher(className).find()) {
|
||||
|
||||
Reference in New Issue
Block a user