Skip to content

Commit fcc0078

Browse files
committed
Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
Prevents generics markup in string type names.
1 parent e786da4 commit fcc0078

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ public SafeObjectInputStream(InputStream in) throws IOException {
6464
@Override
6565
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
6666
String className = classDesc.getName();
67-
// DenyList exploits; eg: don't allow RMI here
68-
if (className.contains("java.rmi")) {
67+
// DenyList
68+
if (className.contains("java.rmi") // Don't allow RMI
69+
|| className.contains("<")) { // Prevent generics markup in string type names
6970
throw new InvalidClassException(className, "Unauthorized deserialisation attempt");
7071
}
7172
if (!allowlistPattern.matcher(className).find()) {

0 commit comments

Comments
 (0)