Open draftyfrog opened 2 months ago
Please provide your precise FlowDroid configuration. The taint analysis should normally not look at if
statements at all, unless you enable implicit flows (which I would advise against, unless you really need it).
Implicit flows are not enabled, I call FlowDroid via
java -jar ./soot-infoflow-cmd-2.13.0-jar-with-dependencies.jar \
-a {path-to-apk} \
-s ./SourcesAndSinks.xml \
-o ./out.xml \
-d \
-p {path-to-android-platforms-folder}
and my SourcesAndSinks.xml
looks like this:
<sinkSources>
<category id="NO_CATEGORY">
<method signature="{package-name}.MainActivity: java.lang.String source()>">
<return type="java.lang.String">
<accessPath isSource="true" isSink="false">
</accessPath>
</return>
</method>
<method signature="{package-name}.MainActivity: void sink(java.lang.String)>">
<param index="0" type="java.lang.String">
<accessPath isSource="false" isSink="true"/>
</param>
</method>
</category>
</sinkSources>
After tinkering around a little I found that the -d
argument for merging all the dex files seems to be the culprit - if a remove -d
from my call, FlowDroid doesn't find the leak anymore.
Update: After tinkering around a little more I figured that my current setup doesn't find any leaks at all withouth the --mergedexfiles
(-d
) option. So maybe thats not the culprit for this false positive as it just turns off all leaks.
I've found a bug in the FlowDroid command line tool.
Consider the following code:
FlowDroid reports one leak for the sink in
onCreate
. This false positive only happens in the combination "calling thesanitize
function within a loop and having the if-statement inside the function". If theif
is removed or the call tosanitize
is moved out of the loop, FlowDroid reports no leaks. Even if we add another calls = sanitize(source());
between the loop and the sink-call, no false positive is reported.