C++: wire up models library to DefaultTaintTracking#2657
C++: wire up models library to DefaultTaintTracking#2657rdmarsh2 merged 7 commits intogithub:masterfrom
Conversation
This adds support for arg-to-arg and arg-to-return taint.
| // This is part of the translation of `a[i]`, where we want taint to flow | ||
| // from `a`. | ||
| i2.(PointerAddInstruction).getLeft() = i1 | ||
| // TODO: robust Chi handling |
There was a problem hiding this comment.
Did you mean to remove this TODO comment?
There was a problem hiding this comment.
Yes, because I don't think it belongs here. It probably belongs in the IR data-flow library and the IR itself, which means it should be in a Jira ticket -- I've opened CPP-490.
cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll
Outdated
Show resolved
Hide resolved
| i2 = any(CallInstruction call | | ||
| exists(int indexIn | | ||
| modelTaintToReturnValue(call.getStaticCallTarget(), indexIn) and | ||
| i1 = call.getPositionalArgument(indexIn) |
There was a problem hiding this comment.
Does this also need to account for indirect parameters via IndirectReadSideEffectInstruction?
There was a problem hiding this comment.
Yes it should. I've added three commits to test and implement that functionality. The test I came up with is very contrived since there's almost no flow to indirections without #2667. Hopefully this will be better soon.
There was already a `WriteSideEffectInstruction` class that served as a superclass for all the specific write side effects. This new class serves the same purpose for read side effects.
Until we have better tracking of indirections, these flow rules conflate pointers and their contents.
|
Can/should we update (I'm not completely clear on the relationship between TaintTracking and DefaultTaintTracking, I think the latter is built on top of the former? Also I note DefaultTaintTracking.qll lacks a comment at the top of the file explaining itself, which is not the fault of this PR but something that ought to be addressed) |
|
I'd like to have more tests of |
Done: https://git.semmle.com/Semmle/code/pull/36079 and #2688 . (I've not actually added |
The issue for that test is being tested and fixed on PR github#2686. Adding a test here will cause a semantic merge conflict.
|
Compared to |
rdmarsh2
left a comment
There was a problem hiding this comment.
Looks like we wired the dataflow models into the AST-based dataflow but not the IR-based dataflow, so that's not caused by these changes. LGTM otherwise.
https://jira.semmle.com/browse/CPP-489