@@ -23,10 +23,17 @@ private import semmle.code.java.frameworks.google.Gson
2323private import semmle.code.java.frameworks.apache.Lang
2424private import semmle.code.java.Reflection
2525
26- private class ObjectInputStreamReadObjectMethod extends Method {
27- ObjectInputStreamReadObjectMethod ( ) {
26+ private class ObjectInputReadObjectMethod extends Method {
27+ ObjectInputReadObjectMethod ( ) {
28+ this .getDeclaringType ( ) .getASourceSupertype * ( ) instanceof TypeObjectInput and
29+ this .hasName ( "readObject" )
30+ }
31+ }
32+
33+ private class ObjectInputStreamReadUnsharedMethod extends Method {
34+ ObjectInputStreamReadUnsharedMethod ( ) {
2835 this .getDeclaringType ( ) .getASourceSupertype * ( ) instanceof TypeObjectInputStream and
29- ( this .hasName ( "readObject" ) or this . hasName ( " readUnshared") )
36+ this .hasName ( "readUnshared" )
3037 }
3138}
3239
@@ -147,7 +154,11 @@ private module SafeKryoFlow = DataFlow::Global<SafeKryoConfig>;
147154 */
148155predicate unsafeDeserialization ( MethodCall ma , Expr sink ) {
149156 exists ( Method m | m = ma .getMethod ( ) |
150- m instanceof ObjectInputStreamReadObjectMethod and
157+ m instanceof ObjectInputReadObjectMethod and
158+ sink = ma .getQualifier ( ) and
159+ not DataFlow:: exprNode ( sink ) .getTypeBound ( ) instanceof SafeObjectInputStreamType
160+ or
161+ m instanceof ObjectInputStreamReadUnsharedMethod and
151162 sink = ma .getQualifier ( ) and
152163 not DataFlow:: exprNode ( sink ) .getTypeBound ( ) instanceof SafeObjectInputStreamType
153164 or
0 commit comments