Skip to content

[Java] How to taint data (during deserialization) when nothing is passed as parameter but accessed via a field ? #16474

Closed Answered by atorralba
hugo-syn asked this question in Q&A
Discussion options

You must be logged in to vote

First, there's a couple of misconceptions in your source and sink definitions.

Your isSource predicate is currently saying that the return value of any call inside a callable named readObject is a source. I don't think that's what you want — see below a couple of suggestions to improve this.

Also, your isSink predicate is saying that your sink is any node inside a callable that calls to Runtime.exec. But you probably want to say that your sink is the argument of exec:

predicate isSink(DataFlow::Node sink) {
  exists(MethodCall mc |
    mc.getMethod().hasQualifiedName("java.lang", "Runtime", "exec") and
    sink.asExpr() = mc.getArgument(0)
  )
}

Now, I want to mention that the easiest way…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by hugo-syn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants