/** * This method iterates over all sources from the FlowDroid-results and extracts the * category of the specific source. If there is no category found, it will return an empty set, * otherwise the correct categories will be added. * @param sourcesInfo: all possible sources from which we try to identify the category * @return: set of categories for specific sink */ private Set<String> getDataIdList(Set<ResultSourceInfo> sourcesInfo){ Set<String> dataIdList = new HashSet<String>(); for(ResultSourceInfo sInfo : sourcesInfo){ if(sInfo.getSource().containsInvokeExpr()){ InvokeExpr invExpr = sInfo.getSource().getInvokeExpr(); for(SourceSinkDefinition meth : sources) { AndroidMethod am = (AndroidMethod) meth.getMethod(); if(am.getSignature().equals(invExpr.getMethod().getSignature())) { dataIdList.add(am.getCategory().toString()); } } } else if (isSourceInfoParameter(sInfo)){ dataIdList.add(unknownCategory); } else throw new RuntimeException("Currently not supported"); } return dataIdList; }
private String getSourceCategory(ResultSourceInfo sourceInfo){ if(sourceInfo.getSource().containsInvokeExpr()){ InvokeExpr invExpr = sourceInfo.getSource().getInvokeExpr(); for(SourceSinkDefinition meth : sources) { AndroidMethod am = (AndroidMethod) meth.getMethod(); if(am.getSignature().equals(invExpr.getMethod().getSignature())){ return am.getCategory().toString(); } } } else if(isSourceInfoParameter(sourceInfo)){ return unknownCategory; } else throw new RuntimeException("Currently not supported"); return null; }
/** * Return true if the method corresponding to the source 'si' is an * Inter Component Communication source method such as "Intent.getExtras()". * @param si * @param cfg * @return */ private boolean isInterComponentSourceNoCallback(ResultSourceInfo si, BiDiInterproceduralCFG<Unit, SootMethod> cfg){ if(!si.getSource().containsInvokeExpr()) return false; InvokeExpr invExpr = si.getSource().getInvokeExpr(); SootMethod sm = invExpr.getMethod(); for(SourceSinkDefinition meth : sources){ AndroidMethod am = (AndroidMethod) meth.getMethod(); if(am.getCategory() == CATEGORY.INTER_APP_COMMUNICATION){ if(am.getSubSignature().equals(sm.getSubSignature())) { log.info("source is: "+ am); return true; } } } return false; }
public JimpleStmtVisitorImpl(Set<SourceSinkDefinition> sources, List<Stmt> jimpleDataFlowStatements, List<AccessPath> accessPathPath, Set<Unit> targetUnits, IInfoflowCFG cfg, Table<List<Stmt>, Stmt, List<List<String>>> splitAPIElementInfos) { this.exprVisitor = new JimpleExprVisitorImpl(sources, this); this.jimpleDataFlowStatements = jimpleDataFlowStatements; this.accessPathPath = accessPathPath; this.targetUnits = targetUnits; this.cfg = cfg; this.splitAPIElementInfos = splitAPIElementInfos; this.smtPrograms = new HashSet<SMTProgram>(); //initial adding of a single SMTProgram currentSMTProgram = new SMTProgram(); smtPrograms.add(currentSMTProgram); }
private boolean isSourceMethod(InvokeExpr invoke) { for(SourceSinkDefinition source : sources) { String sourceMethodSign = source.getMethod().getSignature(); if(invoke.getMethod().getSignature().equals(sourceMethodSign)) return true; } return false; }
@Override public Set<SourceSinkDefinition> getAllMethods() { Set<SourceSinkDefinition> sourcesSinks = new HashSet<>( sourceList.size() + sinkList.size() + neitherList.size()); sourcesSinks.addAll(sourceList); sourcesSinks.addAll(sinkList); sourcesSinks.addAll(neitherList); return sourcesSinks; }
public PolicyEnforcementPoint(Map<String, EventInformation> eventInformation, Set<SourceSinkDefinition> sources, Set<SourceSinkDefinition> sinks, AndroidEntryPointCreator entryPointCreator){ this.allEventInformation = eventInformation; this.sources = sources; this.sinks = sinks; this.entryPointCreator = entryPointCreator; }
private boolean isMethodInterComponentSink(SootMethod sm) { for (SourceSinkDefinition meth : sinks) { AndroidMethod am = (AndroidMethod) meth.getMethod(); if(am.getCategory() == CATEGORY.INTER_APP_COMMUNICATION){ if(am.getSubSignature().equals(sm.getSubSignature())) return true; } } return false; }
public JimpleExprVisitorImpl(Set<SourceSinkDefinition> sources, JimpleStmtVisitorImpl stmtVisitor) { this.sources = sources; this.stmtVisitor = stmtVisitor; }
public SMTConverter(Set<SourceSinkDefinition> sources) { this.sources = sources; }
public FuzzerResultsAvailableHandler(Set<SourceSinkDefinition> sources, Set<Unit> targetUnits) { this.sources = sources; this.targetUnits = targetUnits; }
@Override public Set<SourceSinkDefinition> getSources() { if (sourceList == null || sinkList == null) parse(); return this.sourceList; }
@Override public Set<SourceSinkDefinition> getSinks() { if (sourceList == null || sinkList == null) parse(); return this.sinkList; }