I found an inconsistency concerning taint propagation with lists. Please consider the following code:
List<Boolean> lvar = new ArrayList<Boolean>();
Boolean bvar = true;
lvar.add(source()); // Adds tainted data to the list
lvar.add(bvar);
sink(bvar); // Flagged as leak by FlowDroid
FlowDroid reports this as a leak, as it seems to taint bvar from the tainted list lvar. But if we reverse the order of the list add statements, no leaks are found:
List<Boolean> lvar = new ArrayList<Boolean>();
Boolean bvar = true;
lvar.add(bvar);
lvar.add(source()); // Adds tainted data to the list
sink(bvar); // NOT flagged as leak by FlowDroid
This issue seems to only affect the java wrapper classes for primitive types (I tested it with Boolean and Integer) as for example with String no false positive is reported.
If relevant, my SourcesAndSinks.xml looks like this
<sinkSources>
<category id="NO_CATEGORY" description="no_category">
<method signature="{package-name}.MainActivity: java.lang.Boolean source()>">
<return type="java.lang.Boolean">
<accessPath isSource="true" isSink="false">
</accessPath>
</return>
</method>
<method signature="{package-name}.MainActivity: void sink(java.lang.Boolean)>">
<param index="0" type="java.lang.Boolean">
<accessPath isSource="false" isSink="true"/>
</param>
</method>
</category>
</sinkSources>
and I call FlowDroid via the command line
java -jar ./soot-infoflow-cmd-2.13.0-jar-with-dependencies.jar \
-a {path-to-apk} \
-s ./SourcesAndSinks.xml \
-o ./out.xml \
-p {path-to-android-platforms-folder} \
--mergedexfiles
Update: added category description to SourcesAndSinks.xml (was always there for this issue, I just posted an outdated version before)
I found an inconsistency concerning taint propagation with lists. Please consider the following code:
FlowDroid reports this as a leak, as it seems to taint
bvarfrom the tainted listlvar. But if we reverse the order of the list add statements, no leaks are found:This issue seems to only affect the java wrapper classes for primitive types (I tested it with
BooleanandInteger) as for example withStringno false positive is reported.If relevant, my SourcesAndSinks.xml looks like this
and I call FlowDroid via the command line
Update: added category description to SourcesAndSinks.xml (was always there for this issue, I just posted an outdated version before)