Skip to content

[Bug]: Arguments for staticinvoke in JAssignStmt appear to be missing after DEX conversion #1381

@main-force

Description

@main-force

I am encountering an issue while analyzing the OWASP UnCrackable-Level1.apk with SootUp. It seems that arguments for a staticinvoke call are not being correctly represented in the Jimple body after conversion from a DEX file.

Smali Representation
When I disassemble the target APK, the Smali code clearly shows the arguments (v1, v2) being passed to Base64.decode:

.method public static a(Ljava/lang/String;)Z
    .locals 5

    const-string v0, "8d127684cbc37c17616d806cf50473cc"

    const-string v1, "5UJiFctbmgbDoLXmpL12mkno8HT4Lv8dlat8FxR2GOc="

    const/4 v2, 0x0

    invoke-static {v1, v2}, Landroid/util/Base64;->decode(Ljava/lang/String;I)[B

    move-result-object v1

    new-array v2, v2, [B

However, when I process the APK with SootUp and view the corresponding Jimple, the arguments for the staticinvoke are missing in its textual representation. Even when accessing the InvokeExpr object programmatically, the getArgs() method returns an empty list.

Class: sg.vantagepoint.uncrackable1.a
  - Method: <sg.vantagepoint.uncrackable1.a: boolean a(java.lang.String)>
    - Body Instructions:
        > $u5 := @parameter0: java.lang.String   [JIdentityStmt]
        > $u0 = "8d127684cbc37c17616d806cf50473cc"   [JAssignStmt]
        > $u1 = "5UJiFctbmgbDoLXmpL12mkno8HT4Lv8dlat8FxR2GOc="   [JAssignStmt]
        > $u2 = 0   [JAssignStmt]
        > $stack = staticinvoke <android.util.Base64: byte[] decode(java.lang.String,int)>()   [JAssignStmt]
        > $u1 = $stack   [JAssignStmt]
        > $u2 = newarray (byte)[$u2]   [JAssignStmt]

I have noticed that this issue seems to occur when the result of a staticinvoke is assigned to a variable (in this case, $stack). The variables that should have been used as arguments ($u1, $u2) are prepared right before the call.

This leads to my questions:

  • Is this the expected behavior?
  • If it is, even though the arguments are not explicitly listed, why does the .getArgs() method on the corresponding AbstractInvokeExpr return an empty list when the necessary arguments are clearly available in the preceding statements?

PS: I am still new to the SootUp framework, so I apologize if I have misunderstood something. Any guidance or clarification on this would be greatly appreciated.

Version

Latest develop branch

CPG

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions