-
Notifications
You must be signed in to change notification settings - Fork 177
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
How to resolve taint propagation in type cast #96
Comments
Thanks for the detailed and helpful issue description. But I noticed that the steps cannot reproduce the result you give. Anyway, Maybe the following is what you want? - { method: "<java.util.HashMap: java.lang.Object put(java.lang.Object,java.lang.Object)>", from: 1, to: base }
- { method: "<java.util.HashMap: java.lang.Object get(java.lang.Object)>", from: base, to: result, type: "java.lang.String" } |
call-site-mode: true I also set call-site-mode, so it could config through java.util.Map? |
Let me try with the type configuration, thanks |
Currently I do not have a better solution. I think there won't be too many configuration rules based on your actual needs. |
Thanks a lot, master!
It worked in the test case shown above. |
Like this
I also need to config the type com.xxx.xxx.xxx.xxxx.HandleFunctionInfo into the rule? <java.util.Iterator: java.lang.Object next()>", from: base, to: result, type: "com.xxx.xxx.xxx.xxxx.HandleFunctionInfo" } |
I've been thinking about this for a while and realized I've fallen into a trap (Besides, you never posted the run arguments in your description😵💫). Let me re-answer the whole issue. The code snippet
can be analyzed directly to detect the taint flow This was originally the POWER of P/Taint Analysis (taint analysis based on pointer analysis). And you need to set the pointer analysis option Here are my runtime arguments: public class MyMain {
public static void main(String[] args) {
pascal.taie.Main.main(
"-pp",
"-cp", "src/test/resources/pta/taint",
"-m", "ArgToResultMap", // src/test/resources/pta/tain/ArgToResultMap.java contains the above code snippet
"-a", """
pta=
implicit-entries:false;
only-app:false;
distinguish-string-constants:all;
taint-config:src/test/resources/pta/taint/taint-config.yml;
"""
);
}
} |
Description
Hi,
When I was testing the taint analysis plugin, I found an issues in type cast. It seems that current pointer analysis engine could not resolve the assignment relation in type cast now.
I created a test case using the get method of java.util.Map, the signature show below and config into my yaml file.
And The test case code shown below:
The result tir code:
The propagation interrupted in [6@L9] r3 = (java.lang.String) $r2;
In the pta-results.txt, I found r3 was pointed to nothing: []:<ArgToResultMap: void main(java.lang.String[])>/r3 -> []
There maybe analysis wrong in type cast, or here missing the corresponding pointer propagation.
How could I correct or resolve the type cast transfer.
Thanks!
The text was updated successfully, but these errors were encountered: