Created
June 2, 2021 13:45
-
-
Save artem-smotrakov/7dec100471524152743f143220e8dbc4 to your computer and use it in GitHub Desktop.
Taint-tracking configuration for unsafe RMI objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class BindingUnsafeRemoteObjectConfig extends TaintTracking::Configuration { | |
BindingUnsafeRemoteObjectConfig() { this = "BindingUnsafeRemoteObjectConfig" } | |
override predicate isSource(DataFlow::Node source) { | |
exists(ConstructorCall cc | cc = source.asExpr() | | |
hasVulnerableMethod(cc.getConstructedType().getASupertype*()) | |
) | |
} | |
override predicate isSink(DataFlow::Node sink) { | |
exists(MethodAccess ma | ma.getArgument(1) = sink.asExpr() | | |
ma.getMethod() instanceof BindMethod | |
) | |
} | |
override predicate isAdditionalTaintStep(DataFlow::Node fromNode, DataFlow::Node toNode) { | |
exists(MethodAccess ma, Method m | m = ma.getMethod() | | |
m.getDeclaringType().hasQualifiedName("java.rmi.server", "UnicastRemoteObject") and | |
m.hasName("exportObject") and | |
not m.getParameterType([2, 4]).(RefType).hasQualifiedName("java.io", "ObjectInputFilter") and | |
ma.getArgument(0) = fromNode.asExpr() and | |
ma = toNode.asExpr() | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment