Skip to content

Inconsistent taint propagation with lists resulting in false positive #779

Description

@draftyfrog

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()&gt;">
            <return type="java.lang.Boolean">
                <accessPath isSource="true" isSink="false">
                </accessPath>
            </return>
        </method>
        <method signature="{package-name}.MainActivity: void sink(java.lang.Boolean)&gt;">
            <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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions