sensepost / sensepost/objection

TypeError: cannot read property '$className' of null when running the command 'android hooking get current_activity'

Open
#618 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛bug
Dominant language
Python
Stars
9.4k
Forks
1k
Avg merge
14d 5h
Merged PRs (30d)
1

Description

Hello,

I'm encountering an error while trying to retrieve the current activity using the command 'android hooking get current_activity.'
The specific error message is as follows (I'm using the flag '--debug')
Also, the application is running properly.

A Frida agent exception has occurred.
TypeError: cannot read property '$className' of null
    at <anonymous> (src/android/hooking.ts:235)
    at <anonymous> (src/android/lib/libjava.ts:9)
    at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:12)
    at perform (frida/node_modules/frida-java-bridge/index.js:205)
    at <anonymous> (src/android/lib/libjava.ts:13)
    at Promise (native)
    at wrapJavaPerform (src/android/lib/libjava.ts:14)
    at <anonymous> (src/android/hooking.ts:243)
    at androidHookingGetCurrentActivity (src/rpc/android.ts:41)
    at apply (native)
    at <anonymous> (frida/runtime/message-dispatcher.js:13)
    at c (frida/runtime/message-dispatcher.js:23)

Python stack trace: Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\objection\console\repl.py", line 371, in start_repl
    self.run_command(document)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\objection\console\repl.py", line 185, in run_command
    exec_method(arguments)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\objection\commands\android\hooking.py", line 235, in get_current_activity
    activity = api.android_hooking_get_current_activity()
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\frida\core.py", line 179, in method
    return script._rpc_request("call", js_name, args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\frida\core.py", line 86, in wrapper
    return f(*args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\frida\core.py", line 491, in _rpc_request
    raise result.error
frida.core.RPCException: TypeError: cannot read property '$className' of null
    at <anonymous> (src/android/hooking.ts:235)
    at <anonymous> (src/android/lib/libjava.ts:9)
    at <anonymous> (frida/node_modules/frida-java-bridge/lib/vm.js:12)
    at perform (frida/node_modules/frida-java-bridge/index.js:205)
    at <anonymous> (src/android/lib/libjava.ts:13)
    at Promise (native)
    at wrapJavaPerform (src/android/lib/libjava.ts:14)
    at <anonymous> (src/android/hooking.ts:243)
    at androidHookingGetCurrentActivity (src/rpc/android.ts:41)
    at apply (native)
    at <anonymous> (frida/runtime/message-dispatcher.js:13)
    at c (frida/runtime/message-dispatcher.js:23)

I would appreciate any assistance in resolving this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/android/hooking.ts at line 235 and follow the android hooking get current_activity path through src/rpc/android.ts. Reproduce the command with --debug against a running application, then determine why the activity value is null and define the expected behavior when it is unavailable. Done means the command no longer raises the reported TypeError and communicates its result appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
mobile-dev, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.