Closed
Description
This is a really general, language agnostic question.
For example, i have a javascript file like the following. However, only one source is sanitized. I want to find the flow that passes through the sanitizer.
source1 = window.location
source2 = window.location
sanitized = sanitizer(source2)
sink1 = eval(source1)
sink2 = eval(sanitized)
I'm aware that this problem could be solved by tainted tracking. Adding a barrier that
removes the taint if the flow passes through a MethodInvokeNode
with the name sanitizer
.
I want to solve the problem the other way around. There is a flow from source to sink. I want to check if any intermediate node in between call the sanitizer function.
from
xxx::Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink,
DataFlow::MidPathNode node
where
exists(DataFlow::MidPathNode mid |
mid.getConfiguration() = cfg and
somePredicate(mid.getNode()) and
cfg.hasFlowPath(source, sink)
)
select sink, source, sink,
"Found A Path"
The above snippet prints out both flows. I suppose the issue is that i didn't put constraint in which the mid node has to be in the flow.
Any suggestions would be helpful. I appreciate it.