C++: Prepare cpp/cleartext-transmission for IR-based use-use dataflow#10838
Conversation
… IR-based use-use dataflow.
geoffw0
left a comment
There was a problem hiding this comment.
Looks like a fair improvement, in addition to preparing for use-use flow. The three newly incorrect test results appear to come from taint being blocked by operations of the form buffer[255] = 0, which it probably shouldn't be.
Its nice to see three previously [NOT DETECTED] results are now detected.
Indeed, I also noticed this. This seems like a new bug in dataflow that should be fixed. I've created https://github.com/github/codeql-c-team/issues/1294 for this. I don't think this should block this PR, however. |
2ba94f7
into
github:mathiasvp/replace-ast-with-ir-use-usedataflow
This is a rather large change. Since we now have use-use flow we don't need to search backwards from a use of a variable with a name that implies that it's sensitive. Instead, we can just mark that variable use as a source, and dataflow will continue from there.
This means that it requires a bit more work to block taint if there's some evidence somewhere for the data being encrypted. To see why, consider this example:
We can now just mark the use of
password2on line 3 as a source, and dataflow will end up as an argument tox. However, since we now start on line 3, the encryption isn't actually part of the dataflow path anymore.To fix this, I've added two additional taint-tracking configurations: One that checks the source (i.e.,
password2on line 3 in the example above) flows to some encryption, and one that checks if encrypted data flows to the sink (i.e., thesendargument on line 4).There are a couple of new FPs/missing flows. I think we can tweak the source/sinks to fix these, but this fixes most of the regressions, though.