FlowDroid icon indicating copy to clipboard operation
FlowDroid copied to clipboard

the taint path analysis can't cover parent class method?

Open jimmychanii opened this issue 4 years ago • 1 comments

when I want to check a source-sink path with follows, I can't get any results:

<method signature="&lt;android.app.Activity: android.content.Intent getIntent()&gt;">
    <return type="android.content.Intent">
        <accessPath isSource="true" isSink="false" /> 
    </return>
</method>


<method signature="&lt;android.app.Activity: void startActivity(android.content.Intent)&gt;">
    <param index="0" type="android.content.Intent">
        <accessPath isSource="false" isSink="true">  
        </accessPath>
    </param>
</method>

But when change the source to:

<method signature="&lt;com.example.myapplication.MainActivity: android.content.Intent getIntent()&gt;">
    <return type="android.content.Intent">
        <accessPath isSource="true" isSink="false" /> 
    </return>
</method>

The FlowDroid can get the correct taint path from getIntent() to startActivity(). So, the taint analysis can't cover the source method when it is defined in parent class?

jimmychanii avatar May 21 '20 09:05 jimmychanii

getIntent is a special case, because we handle inter-component communication explicitly through call graph edges between methods such as startActivity and the lifecycle of the receiver activity. The getIntent method therefore accesses the incoming intent object that was passed to startActivity. We implemented this handling by overriding the getIntent method in the target activity, so technically, this is no longer android.app.Activity.getIntent(). I see that it would make sense to have some special handling inside the AndroidSourceSinkManager to also take the overridden inherited method in that case, and not only look at the code that is immediately being calle. Can you have a look at AndroidSourceSinkManager and propose a fix as a merge request?

StevenArzt avatar May 25 '20 06:05 StevenArzt