1 / 19

Interprocedural distributive environment problem (IDE) & EPICC &SOOT

Interprocedural distributive environment problem (IDE) & EPICC &SOOT. Soot 相关网址. Soot 文档 http:// www.sable.mcgill.ca/soot/tutorial/index.html Soot 命令行示例 http://www.bodden.de/2008/08/21/soot-command-line / Soot eclipse 插件 http://www.bodden.de/2008/08/30/soot-eclipse-plugin-tutorial /

Download Presentation

Interprocedural distributive environment problem (IDE) & EPICC &SOOT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Interprocedural distributive environment problem (IDE) & EPICC &SOOT

  2. Soot相关网址 Soot 文档 http://www.sable.mcgill.ca/soot/tutorial/index.html Soot 命令行示例 http://www.bodden.de/2008/08/21/soot-command-line/ Soot eclipse插件 http://www.bodden.de/2008/08/30/soot-eclipse-plugin-tutorial/ Soot 中间过程数据流分析 http://www.bodden.de/2008/09/22/soot-intra/ Soot 自定义分析程序入口点 http://www.bodden.de/2012/07/26/soot-custom-entry-points/ 使用Soot分析Android APP http://www.bodden.de/2013/01/08/soot-android-instrumentation/

  3. Soot 一个开源的、不断扩展的java分析工具,可以分析(class;java;jimple) 实现了向前、向后、向前分支流分析

  4. SOOTAndroid 支持对Android 中dex文件分析 Dex  Jimple -android-jar [android platform path] -process-dir [apk path] -outputformat […..] 其他参数见 Soot options 类

  5. Options.v().set_src_prec(Options.src_prec_apk); 预处理加载apk中dex代码 Soot 需处理main函数,构造伪main函数(Android)

  6. 设置soot参数 加载必要的类 构造伪main 解析问题 定义IFDS/IDE问题 难点 设置入口点 利用问题结果进行分析(难点)

  7. 实现数据流分析要解决的问题 • 初始化流 • 数据流函数问题DefaultIDETabulationProblem • getNormalEdgeFunction • getCallEdgeFunction • getReturnEdgeFunction • getCallToReturnEdgeFunction

  8. Interprocedural distributive environment problem (IDE) 程序表示 点:由一个环境environment表示(符号到值的映射) 操作:有一个环境转换器来表示(distributive environment transfer) Data fact:D  L Data fact 属于 Env( D, L)

  9. G*=(N*, E*) G*: G1,G2,……, Gx表示函数x的有向图,Gmain表示main函数的有向图 每个图有唯一Sp,Ep 一个函数调用用两个节点表示Cs, Er

  10. 一个环境转换器 t:Env(D,L)  Env(D,L) ,作用在边上面 一个IDE数据流问题,需要对有向超图中所有的边都分配一个环境转换器,由环境转换器对边进行解释,以期获得从开始点(source)到目标点(target)的结果

  11. IDE Problem = (G*,D,L,M) G* 有向超图 D 变量(符号)集合 L 格(值域) E*(Env(D,L)  Env(D,L) ), 对超图中所有的边分配一个环境转换器

  12. Epicc 基本参数设置 见options类

  13. 对apk中所有的类都构造一个伪main函数

  14. 将所有类都作为入口点加入soot,自动构造CFG 寻找真的有Intent类选为入口点 只有有Intent对象的类才是要分析的类,选为入口点

  15. 重新设置入口点类 构造tranformer,IDEProblem,解析器,问题求解定义 Soot执行分析

  16. IDE问题流函数(环境转换器) getNormalFlowFunction getCallFlowFunction getReturnFlowFunction getCallToReturnFlowFunction

  17. 只做了componentName,Intentfilter,Intent,Boudle的转换模型只做了componentName,Intentfilter,Intent,Boudle的转换模型 Contentprovide预留,但未做

  18. 想法 可否根据EPICC结果,在startactivity,startService等函数地方进行代码替换,这样可以在一个main函数中把Android的所有组件都连接起来,可以很直接的获得全局的数据流路径为静态分析提供帮助。 如:if() activity1() else() activity2()

  19. InvokeExprinvokeExpr = stmt.getInvokeExpr(); if(invokeExpr.getMethod().getName().equals("onDraw")) { Local tmpRef = addTmpRef(b); Local tmpString = addTmpString(b); // insert "tmpRef = java.lang.System.out;" units.insertBefore(Jimple.v().newAssignStmt( tmpRef, Jimple.v().newStaticFieldRef( Scene.v().getField("").makeRef())), u); // insert "tmpLong = 'HELLO';" units.insertBefore(Jimple.v().newAssignStmt(tmpString, StringConstant.v("HELLO")), u); // insert "tmpRef.println(tmpString);" SootMethodtoCall = Scene.v().getSootClass("java.io.PrintStream").getMethod("void println(java.lang.String)"); units.insertBefore(Jimple.v().newInvokeStmt( Jimple.v().newVirtualInvokeExpr(tmpRef, toCall.makeRef(), tmpString)), u); //check that we did not mess up the Jimpleb.validate(); }

More Related