Skip to content

Commit a4a91eb

Browse files
committed
new deserialization sink
1 parent 7544bc8 commit a4a91eb

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,14 @@ private predicate argToMethodStep(Expr tracked, MethodAccess sink) {
414414
* `arg`th argument is tainted.
415415
*/
416416
private predicate taintPreservingArgumentToMethod(Method method, int arg) {
417+
(
418+
method.getDeclaringType().hasQualifiedName("org.apache.wicket.util.crypt", "Base64") and
419+
(
420+
method.getName().matches("decode%") and arg = 0 or
421+
method.getName().matches("encode%") and arg = 0
422+
)
423+
)
424+
or
417425
(
418426
method.getDeclaringType().hasQualifiedName("java.util", "Base64$Encoder") or
419427
method.getDeclaringType().hasQualifiedName("java.util", "Base64$Decoder") or

java/ql/src/semmle/code/java/frameworks/apache/Lang.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@ class TypeApacheRandomStringUtils extends Class {
1010
hasQualifiedName("org.apache.commons.lang3", "RandomStringUtils")
1111
}
1212
}
13+
14+
class MethodApacheSerializationUtilsDeserialize extends Method {
15+
MethodApacheSerializationUtilsDeserialize() {
16+
(
17+
this.getDeclaringType().hasQualifiedName("org.apache.commons.lang", "SerializationUtils") or
18+
this.getDeclaringType().hasQualifiedName("org.apache.commons.lang3", "SerializationUtils")
19+
) and
20+
this.hasName("deserialize")
21+
}
22+
}

java/ql/src/semmle/code/java/security/UnsafeDeserialization.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import semmle.code.java.frameworks.Kryo
22
import semmle.code.java.frameworks.XStream
33
import semmle.code.java.frameworks.SnakeYaml
4+
import semmle.code.java.frameworks.apache.Lang
45

56
class ObjectInputStreamReadObjectMethod extends Method {
67
ObjectInputStreamReadObjectMethod() {
@@ -71,6 +72,9 @@ predicate unsafeDeserialization(MethodAccess ma, Expr sink) {
7172
sink = ma.getAnArgument() and
7273
not exists(SafeKryo sk | sk.hasFlowToExpr(ma.getQualifier()))
7374
or
75+
m instanceof MethodApacheSerializationUtilsDeserialize and
76+
sink = ma.getArgument(0)
77+
or
7478
ma instanceof UnsafeSnakeYamlParse and
7579
sink = ma.getArgument(0)
7680
)

0 commit comments

Comments
 (0)