Closed amordahl closed 1 year ago
Thanks for the thorough analysis of the issue. Can you open a merge request with a fix?
Hi Steven,
While I would be happy to fix the first issue (i.e., unsound short circuiting), I am unaware of where or how methodSinks is intended to be initialized so I don't yet have a fix. I can continue looking but do you have any insight as to what the intended logic is?
I committed some changes. That might not be the most elegant solution, but it should resolve the immediate problem with methodSinks
.
Hi,
When running FlowDroid under a configuration that sets
codeelimination
toREMOVECODE,
the tool misses flows because the implementation of the InterproceduralConstantValuePropagator is unsound.Test Case
ActivityLifecycle1.apk in DroidBench 3.0.
Expected Output
This is output by the default configuration.
Actual Output
Observations
FlowDroid unsoundly removes the method
connect()
in the APK:By using breakpoints, I was able to identify the problem as being in InterproceduralConstantValuePropagator, specifically in the hasSideEffectsOrCallsSink method. There are two issues I've identified here:
1. Unsound short circuiting.
The following happens in both hasSideEffectsOrCallsSink and hasSideEffectsOrReadsThis:
The logic to determine whether a method can be removed is
This is unsound; we can only terminate early if hasSideEffects is TRUE (i.e., we know we cannot remove the method). If it's FALSE, we need to continue analyzing the method in hasSideEffectsOrCallsSink.
2. Uninitialized methodSinks list.
When
connect()
is checked inhasSideEffectsOrCallsSink
, themethodSinks
structure is empty:Obviously, this should find that
connect()
calls the sinkconn.connect()
.