6

I would like to ask if anyone knows how to solve the above mentioned problem I encounter. I was reverse engineering an apk, and met a part where static analysis with IDA Pro is not enough, so I thought that I could use the android_server provided by IDA Pro to debug the .so library during runtime. However, I kept getting an error from IDA Pro when trying to attach to any process within my emulator: 'The debugger could not attach to the selected process. This can perhaps indicate the process was just terminated, or that you don't have the necessary privileges.' I used adb to push the android_server to my emulator, and then used adb shell and executed the script as root, but I'm still having this error. Any ideas on what am I doing wrong? Thanks in advance!

2 Answers 2

2

As mentioned, you have pushed the android_server to your emulator and executed it. So I guess you may forget forward your data from your development machine to your emulator.

As you executed the android_server, you can see Listening on 0.0.0.0:23946... in your emulator, which means android_server could kown what it should do by getting information from the emulator's port 23946. Now, you need transfer the information from IDA to your emulator.

To do this, you need:

  1. In IDA, click Debugger -> Select Debugger, choose a debugger accroding to your condition. For me, I choose Remote Linux Debugger.

  2. Click Debugger -> Process Options, and set hostname to 127.0.0.1, then set port to 23946 or some other port you want, which your IDA could use to send information.

  3. In your development machine, as Windows, open cmd or powershell, enter adb forward tcp:23946 tcp:23946, so that your IDA can send data to your android_server. For more details for adb forward, please see https://developer.android.com/studio/command-line/adb#forwardports

  4. If fortunately, now, in IDA, click Debugger -> Attach to process, you may see the processes list, which means success.

0
0

I saw such issue in following situations:

  1. When you run android_server as non-root user (without prior call to su).
  2. When you run it with wrong working directory (as '/data/local/tmp/android_serverinstead ofcd /data/local/tmp/ && ./android_server`).

So, please make you sure that you do everything exactly in correct way:

su
cd /data/local/tmp
./android_server

Otherwise it may not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.