Skip to content

Commit f7a0654

Browse files
committed
prevent resolveProxyClass bypass
Signed-off-by: ceki <ceki@qos.ch>
1 parent 249b81f commit f7a0654

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

logback-core/src/main/java/ch/qos/logback/core/net/HardenedObjectInputStream.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ protected Class<?> resolveClass(ObjectStreamClass anObjectStreamClass) throws IO
113113
return super.resolveClass(anObjectStreamClass);
114114
}
115115

116+
/**
117+
* There is no reason to have proxy classes in logback deserialization, so we just
118+
* throw an exception here to prevent any potential bypasses that could be achieved
119+
* through proxy classes.
120+
*
121+
* @param interfaces the list of interface names that were
122+
* deserialized in the proxy class descriptor
123+
* @return
124+
* @throws IOException
125+
* @throws ClassNotFoundException
126+
* @since 1.5.34
127+
*/
128+
@Override
129+
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
130+
throw new InvalidClassException("Unauthorized deserialization attempt ", Arrays.toString(interfaces));
131+
}
132+
116133
private boolean isWhitelisted(String incomingClassName) {
117134
for (String javaClass : JAVA_CLASSES) {
118135
if (incomingClassName.equals(javaClass))

0 commit comments

Comments
 (0)