Skip to content
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 taint class instance #48

Closed
raylax opened this issue Aug 24, 2023 · 1 comment
Closed

How to taint class instance #48

raylax opened this issue Aug 24, 2023 · 1 comment

Comments

@raylax
Copy link

raylax commented Aug 24, 2023

Hi~

java code

String tainted = xxx;
StringBuilder sb = new StringBuilder();
sb.append(tainted);
sink(sb.toString());

jimple IR

$stack7 = new java.lang.StringBuilder;
specialinvoke $stack7.<java.lang.StringBuilder: void <init>()>();
sb = $stack7;
$stack8 = virtualinvoke sb.<java.lang.StringBuilder: java.lang.StringBuilder append(java.lang.String)>(tainted);
$stack9 = virtualinvoke sb.<java.lang.StringBuilder: java.lang.String toString()>();
specialinvoke this.<ClassA: void sink(java.lang.String)>($stack9);

How to mark sb when the parameter passed to method append is tainted?

my code

if (callArgs[0].equivTo(source.value)) {
    ret.add(invokeExpr.base) // maybe not working
    ret.add(leftOp)
}

Thanks :)

@ericbodden
Copy link
Member

Hello. I am not sure what's going wrong in your case. Taint generation usually happens within the call-to-return-flow function. Is this where your code is located?

Cheers
Eric

@raylax raylax closed this as completed Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants