Skip to content

Commit 7de8b48

Browse files
committed
Java: Add taint steps through Jackson serialization methods.
1 parent ce0b72f commit 7de8b48

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

java/ql/src/semmle/code/java/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ private import semmle.code.java.frameworks.Guice
1010
private import semmle.code.java.frameworks.Protobuf
1111
private import semmle.code.java.Maps
1212
private import semmle.code.java.dataflow.internal.ContainerFlow
13+
private import semmle.code.java.frameworks.jackson.JacksonSerializability
1314

1415
/**
1516
* Holds if taint can flow from `src` to `sink` in zero or more
@@ -491,6 +492,11 @@ private predicate taintPreservingArgumentToMethod(Method method, int arg) {
491492
or
492493
exists(ProtobufMessageLite m | method = m.getAParseFromMethod()) and
493494
arg = 0
495+
or
496+
// Jackson serialization methods that return the serialized data
497+
method instanceof JacksonWriteValueMethod and
498+
method.getNumberOfParameters() = 1 and
499+
arg = 0
494500
}
495501

496502
/**
@@ -537,6 +543,12 @@ private predicate taintPreservingArgToArg(Method method, int input, int output)
537543
method.hasName("arraycopy") and
538544
input = 0 and
539545
output = 2
546+
or
547+
// Jackson serialization methods that write data to the first argument
548+
method instanceof JacksonWriteValueMethod and
549+
method.getNumberOfParameters() > 1 and
550+
input = method.getNumberOfParameters() - 1 and
551+
output = 0
540552
}
541553

542554
/**

0 commit comments

Comments
 (0)