-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
hi, i try to perform a taint analysis with following statment:
protected void handleSimReady(int phoneId) {
··········
String iccId = (uiccSlot != null) ? IccUtils.stripTrailingFs(uiccSlot.getIccId()) : null;
············
but it cant find any flow between the return of stripTrailingFs() and iccId.my query as follow:
predicate toIccUtilsReturn(DataFlow::Node sink) {
exists(ReturnStmt return,VarAccess vac|
return.getCompilationUnit().toString()="IccUtils"
and
return.getEnclosingCallable().toString()="stripTrailingFs"
and
sink.asExpr()=return.getResult()
)
predicate toSubscriptionInfoUpdater(DataFlow::Node sink) {
exists(LocalVariableDeclExpr iccid |
iccid.getCompilationUnit().toString()="SubscriptionInfoUpdater"
and
iccid.getName()="iccId"
and
sink.asExpr()=iccid
)
}
}
module SensitiveLoggerConfig implements DataFlow::ConfigSig { // 1: module always implements DataFlow::ConfigSig or DataFlow::StateConfigSig
predicate isSource(DataFlow::Node source) {
fromIccRecords(source)
} // 3: no need to specify 'override'
predicate isSink(DataFlow::Node sink) {
toSubscriptionManager(sink)
}
int fieldFlowBranchLimit() { result = 500 }
}
module SensitiveLoggerFlow = TaintTracking::Global<SensitiveLoggerConfig>; // 2: TaintTracking selected
import SensitiveLoggerFlow::PathGraph // 7: the PathGraph specific to the module you are using
from SensitiveLoggerFlow::PathNode source, SensitiveLoggerFlow::PathNode sink // 8 & 9: using the module directly
where SensitiveLoggerFlow::flowPath(source, sink) // 9: using the flowPath from the module
select sink.getNode(), source, sink, "Sink is reached from $@.", source.getNode(), "here"
thank you!