-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cant find taint flow in a LocalVariable statement #15972
Comments
Can you provide the full source code of your |
The main problem is that dataflow doesn't go "to" a LocalVariableDeclExpr, rather it goes from the RHS of an initialiser or assignment straight to a read of the same variable. Therefore you want something like
A few other notes:
|
Tested with: package testpkg;
public class Test {
public static String stripTrailingFs() { return null; }
protected void handleSimReady(int phoneId, Object uiccSlot) {
String iccId = (uiccSlot != null) ? Test.stripTrailingFs() : null;
}
} |
thats very helpfull! thank you so much! |
I've encountered another issue regarding the propagation of tainted data through arrays. I'm not sure if I've made a mistake in my query. The code I'm trying to analyze is as follows:
In this code snippet, I aim to consider the return value of getIccId() as a source of tainted data (it has been verified that the propagation from fromIccRecords to iccId is correct). Below is my query script:
Would you please review my approach and let me know if there are any issues? |
It isn't clear from your example how the array carrying the tainted getIccId return is supposed to get to updateSubscriptionInfoByIccId. For example, this works: public class Test {
public int source() { return 0; }
public void sink(int x) { }
private int[] arr;
public void test(int key) {
arr[key] = source();
otherMethod(key);
}
public void otherMethod(int key) {
sink(arr[key]);
}
} import java
import semmle.code.java.dataflow.TaintTracking
predicate toSubscriptionManager(DataFlow::Node sink) {
sink.asExpr() = any(MethodCall mc | mc.getCallee().hasName("sink")).getArgument(0)
}
predicate fromIccRecords(DataFlow::Node source) {
source.asExpr() = any(MethodCall mc | mc.getCallee().hasName("source"))
}
module SensitiveLoggerConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
fromIccRecords(source)
}
predicate isSink(DataFlow::Node sink) {
toSubscriptionManager(sink)
}
int fieldFlowBranchLimit() { result = 500 }
}
module TaintFlow = TaintTracking::Global<SensitiveLoggerConfig>;
import TaintFlow::PathGraph
from TaintFlow::PathNode source, TaintFlow::PathNode sink
where TaintFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "a flow to $@.",
source.getNode(), "" Note that I use the argument to the |
thankyou, i think the problem is the "static" ,please try with following sample:
|
Thanks, we've confirmed that's a true problem and are investigating how best to fix it. |
hi, i try to perform a taint analysis with following statment:
but it cant find any flow between the return of stripTrailingFs() and iccId.my query as follow:
thank you!
The text was updated successfully, but these errors were encountered: