-
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 config to result[*] rule for return array type in taint analysis #98
Comments
TL;DR: For your given code snippet, with a static analysis perspective, the expectation is as follows: flowchart LR
A[taints]
B["NewObj ... newarray java.lang.String[...]"]
C["NewObj ... newarray java.lang.String[...][*]"]
D["TaintObj"]
A --> |points-to| B
C --> |points-to| D
Intuitively, configuring the pointer analysis option with |
I configured the propagation rule as you said and set only-app=false, but the taint propagation path is still missing in the final taint-flow-graph.dot taint flow graph. |
Could you please share your entire Tai-e project with me, either via file upload or by providing a link to your GitHub repository? This will allow me to reproduce the issue with one-click. |
我调试了下,发现返回值类型为数组时,pfg将taint变量直接指向了taints变量,但是在处理ArrayLoad的时候是从taints的数组指针指向LValue,导致传播中断了,我改为了new String[]{taint}之后,IR中会出现ArrayStore,所以会将taint指向new String[]的数组指针,后续load就会连续,所以这种情况应该怎么处理 |
Thanks for writing this issue in Chinese, it makes it very easy for a few of us developers to read. However, Tai-e is a project with an international focus, and we aim to keep our community discussions in as widely accessible a language as possible, which is English. This helps us share our open-source progress with interested individuals from all over the world. Kindly consider using English for communication in the future. We appreciate your understanding. Thank you. Again, could you please share your entire Tai-e project with me, either via file upload or by providing a link to your GitHub repository? This will allow me to reproduce the issue with one-click. |
Thank you ❤️ for uploading the modified files separately, but for convenience, please package the entire project so that I can execute it directly, such as https://github.com/Tai-e/Tai-e-Examples/tree/master/MinimalReproducibleExample-0069. Besides, I have checked the repo, and found that the Tai-e's arguments is missing. |
Thank you very much for your patience. When I looked at the example you gave, I found that my problem is the same as the problem in # 69 of the example, and I saw that you explained in # 69 that you need to modify the TFGBuilder.buildComplete method implementation by yourself. But I'm going to try to modify the TransferHandler to add the taint variable to the edge of the array ArrayIndexNode on the PFG. I wonder if I'm doing this right? Thanks again. |
To address this, I spent my time implementing a prototype that demonstrates the solution of both Issue 69 and this current issue. In this commit Tai-e/Tai-e-Examples@8ec1d9a, I modified Tai-e's class implementation to output the complete TFG as well as one of the shortest paths for each taint flow. After running this example, three key files will be generated in the output directory:
|
Is |
No. The return type of |
Description
Hi,
When I test some cases that return type is array and as transfer, such as String.split. I doubt how to correct config the rule.
My test sample:
The transfer rule configured below.
- { method: "<java.lang.String: java.lang.String[] split(java.lang.String)>", from: base, to: result, type: "java.lang.String[]" }
could transfer to "String[] taints", but var s2 is not tainted after get taints[1].
or
- { method: "<java.lang.String: java.lang.String[] split(java.lang.String)>", from: base, to: "result[*]", type: "java.lang.String[]" }
I also tested, but could not transfer to "String[] taints".
Could you provide guidance on how to configure correctly to detect this ArgToResultStringSplit case.
Thanks!
The text was updated successfully, but these errors were encountered: