FlowDroid icon indicating copy to clipboard operation
FlowDroid copied to clipboard

Detect source method ignoring subsequent data flow tracking

Open TDklm opened this issue 1 year ago • 3 comments

I want to detect whether some sensitive methods are used in Apk. I can modify these methods into the form like <android.location.Location: double getLongitude()> -> SOURCE in SourcesAndSinks.txt. I do not need to trace the data flow of the method.. I know Flowdroid can realize my requirements, but I don't know where to modify the code and implement it. If you know, please tell me, thanks a lot.

TDklm avatar May 11 '24 03:05 TDklm

If you have a better or more concise choice for this question, please let me know and I would greatly appreciate it.

TDklm avatar May 11 '24 03:05 TDklm

You can do this with Soot alone by just loading the APK, iterating over the classes in the scene, iterating over all methods in the scene, and checking whether a certain method invokes the target API:

for (SootClass sc : Scene.v().getApplicationClasses()) {
  for (SootMethod sm : sc.getMethods()) {
    if (sm.isConcrete()) {
      for (Unit u : sm.retrieveActiveBody().getUnits()) {
        Stmt s = (Stmt) u;
        if (s.containsInvokeExpr()) {
          InvokeExpr iexpr = s.getInvokeExpr();
          if (iexpr.getTarget().getSignature().equals("<android.location.Location: double getLongitude()>))) {
            // You found a call to your API
          }
        }
      }
    }
  }
}

I just wrote this code down and haven't compiled it, so there might be typos.

StevenArzt avatar May 11 '24 20:05 StevenArzt

Thank you, I will try it.

TDklm avatar May 18 '24 01:05 TDklm

Since there has not been any further activity on this issue, I assume that the question has been answered.

StevenArzt avatar Sep 17 '24 21:09 StevenArzt