-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Taint Tracking to a LocalVariable #16438
Comments
Hi @mies47 Thanks for your question! There are a couple of problems with your query. I'll first list the issues and then suggest how you may rewrite your query to fix these.
Those are the two issues in your query. Now, let me propose how you might fix these issues:
Finally, since you need to modify your sink to use Combining all of these points, your query becomes: from DataFlow::Node source, DataFlow::Node sink, LocalVariable lv, Function f
where
f.getAParameter() = source.asParameter(1) and
lv.getAnAccess() = [sink.asDefinition().(AssignExpr).getLValue(), sink.asIndirectExpr()] and
lv.getFunction() = f and
TaintTracking::localTaint(source, sink)
select source, sink I hope that helps! Let me know if you have any more questions :) |
@MathiasVP Thank you so much for your detailed explanation. This definitely works. I was just wondering if there are any resources that explain these concepts in detail like you did :) I also used the following yesterday and added
I am trying to take source and sink as pointers. Of course this doesn't count |
Hello,
I'm trying my query on a simple code before moving to my main codebase. Basically, I would like to track all the local taints from all the function arguments to the LocalVariables in that function. This is the simplest version but eventually I want to find all such taints that are coming from an assignment in a loop.
Here's my simple C code:
Here's my simple CodeQL query:
I want to find the following taints:
in -> buff, in -> a
For now the query returns nothing. But if I comment the
TaintTracking::localTaint(source, sink)
line it would return the following:I'm not really sure why this happens and if I should probably define an additional taint step. I'd appreciate any help.
The text was updated successfully, but these errors were encountered: