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

Support output of Android byte[]s #176

Open
aph3rson opened this issue Jan 25, 2019 · 8 comments
Open

Support output of Android byte[]s #176

aph3rson opened this issue Jan 25, 2019 · 8 comments

Comments

@aph3rson
Copy link
Contributor

There's some preliminary information here on outputting a byte[] from Frida's JS environment.

@aph3rson aph3rson changed the title Support output of byte[]s Support output of Android byte[]s Jan 25, 2019
@leonjza
Copy link
Member

leonjza commented Jan 26, 2019

Hey, does this relate to using a byte array instead of the base64 encoding used for file transfers, or does this relate to something else?

@aph3rson
Copy link
Contributor Author

aph3rson commented Jan 27, 2019

This is related to hooking an Android method - a custom encryption method I'm trying to reverse takes in/outputs an array of bytes. These are outputted in the Objection console as [object Object].

@leonjza
Copy link
Member

leonjza commented Jan 28, 2019

I think I understand! We will have to sniff the argument type on the hook I think and handle byte arrays if we come across them separately. Keeping this one open.

@mirkorobocop
Copy link

+1, would love to see this function in objection

@leonjza
Copy link
Member

leonjza commented Oct 1, 2019

I would need a test case to replicate to work on this.

@mirkorobocop
Copy link

@leonjza
so here i have sample apk with this code:

public class MainActivity extends AppCompatActivity {

    private Button mButton;

    public byte[] a(){
        byte[] bArr = new byte[8];
        new SecureRandom().nextBytes(bArr);
        return bArr;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mButton = findViewById(R.id.clickButton);
        mButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view)
            {
                a();
            }
        });
    }
}

apk link: https://mega.nz/#!aUR3AQgA!v8klzQvZpaVcUO-g2m9svkYKLCYzcmEA0bG7OBDJRNQ

adb install app-debug.apk
objection -g com.example.myapplication explore
Using USB device `Samsung XXX`
Agent injected and responds ok!

     _   _         _   _
 ___| |_|_|___ ___| |_|_|___ ___
| . | . | | -_|  _|  _| | . |   |
|___|___| |___|___|_| |_|___|_|_|
      |___|(object)inject(ion) v1.7.5

     Runtime Mobile Exploration
        by: @leonjza from @sensepost

[tab] for command suggestions
com.example.myapplication on (samsung: 9) [usb] # android hooking watch class_method com.example.myapplication.MainActivity.a --dump-args --dump-return
(agent) Attempting to watch class com.example.myapplication.MainActivity and method a.
(agent) Hooking com.example.myapplication.MainActivity.a()
(agent) Registering job pbjx954xbxb. Type: watch-method for: com.example.myapplication.MainActivity.a

now i click on button in app and get console output:

com.example.myapplication on (samsung: 9) [usb] # (agent) [pbjx954xbxb] Called com.example.myapplication.MainActivity.a()
(agent) [pbjx954xbxb] Return Value: [object Object]

@jj0e
Copy link

jj0e commented Jun 12, 2021

Hey guys, I’m bumping this hoping to see if it’s still on the radar. I would love to contribute to this myself since it’s something that I need quite urgently, however I’m not expert enough with objection codebase or frida to implement in a timely manner. With that being said, I’m willing to contribute financially if you’re able to implement this ASAP. Please let me know if/what example cases you may need. Thanks

@leonjza
Copy link
Member

leonjza commented Jun 12, 2021

This being an open issue means it's still on the radar. However, I am just spread too thin at the moment to look at this right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants