-
Notifications
You must be signed in to change notification settings - Fork 105
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
Reproduce #2
Comments
You can visit /proc/[pid]/maps, and see if the gadget address belongs to libhwui.so. Take note that the address must be divisible by 4, and it must fall into a r-x (executable) region. Also you can try to see the logcat for the crashlog to see what is wrong. Btw do you mind uploading your libhwui.so here? I can have quick look. |
Executable region: Gadget is at address 0x0000000000159b80 (got it with ROPgadget tool) . Adding it to the base address, you get 0x7710f36b80 which is in the correct range. I uploaded my libhwui.so (https://www.dropbox.com/s/rszjep2ucci67yn/libhwui.so?dl=0). Thanks. |
I checked. The gadget is fine. What did you see in the logcat when WhatsApp crashed? Also, did you check if PC register was controlled before proceeding to the exploitation. You can comment out the below lines to double-check if you could control the PC register.
If it works right, you will see PC = 0xdeadbeeefffffffc in the crashlog in the logcat:
|
This is my logcat:
|
PC was controlled. Then everything seems right to me
I think you may try to change the command to
and see if test.txt is created onto the sdcard |
I put the address of gadget 1 as 0x730A639B80, but I'm getting 0x00000000001baba8:
Btw, address is different because base address has changed since I restarted the phone. |
I suspect that you find gadget in a libhwui.so that is different from the one on the phone. Can you
and check if 0x1baba8 is the address of your gadget in libhwui.so |
This is weird. The libhwui.so I sent you is the same one that I got from the phone. I will check again. |
The gadget is clearly at 0x0000000000159b80
730a4e0000 + 159b80 = 730A639B80 <= What I'm using |
This is really weird to me, how did you get system() address? |
I can get it in two ways, either by running nm, getting the address then adding it to base address of libc.so:
Or by running a remote GDB session, attaching to remote process and then doing:
|
I wrote a simple app to find gadget directly on the phone and generate the gif file on the phone. https://github.com/awakened1712/CVE-2019-11932/blob/master/app-debug.apk You can install it with
If it finds the gadget, you'll see the below lines in the logcat
|
Your code works. It gives that the gadget is at location 0x0f8b80. I tested it and got reverse shell connecting back (it connects and directly disconnects for some reasons...). But why do you think Ropgadget gave me a wrong address (0x159b80) ? Could it be a bug? In fact, I previously examined the location it gave me with gdb and showed something else but I trusted it anyway... What do you usually use to search for ROP gadgets on ARM? |
Strange, I used ROPgadget too when I was developing the exploit. I had no problem. If it does not work for you, you can try to manually disassemble the binary and search for gadgets by yourself with regular expression. For example:
|
I removed by previous comment, I just didn't notice the 0x is missing in #24. Did you try to search with Ropgadget? |
I remember that I did. Probably I just didn't look at the address. Because once I found a suitable gadget, I will just look up for the gadget in IDA Pro to confirm it's in the text section. |
I'm going to investigate why RopGadget is giving me wrong address for the gadget. Meanwhile, what Android system image you used in your video (while testing on the simulator) ? |
It was on a real Pixel 2XL. I used an app to cast the screen onto the desktop. |
why the address must be divisible by 4 ? |
How do i find the address of the gadget and system? |
I downloaded the apk file. The application gives the correct system() and gadget address and creates a gif. But I listen to netcat 4444 port, but nothing happens. What else am I supposed to do? Do I need to replace the code in the application with the IP address of my own computer? |
Yes you need to, the shell script in the apk provided only writes a file |
Has anyone managed to work on 32 bit architecture? I have a device (Samsung SM-J810M) that has 64 bit processor, but Android 9 - 32 bit. I've already verified that the getInfo structure has 112 bytes, also found gadget 0x00146138: ldr r2, [r0, # 0x14]; adds r0, # 0x18; blx r2 in libhwui.so, which apparently would work. The gif I'm producing has the same structure as the example not_kitty.double-fre.armv7.gif, with 212 bytes and 4 frames.
However, the PC is not jumping to the gadget region. Not even with the not_kitty.double-fre.armv7.gif gif: Following is the crash dump: 11-08 17:16:14.922 28440 28440 F DEBUG : backtrace: Anyone have any idea what is going on? Could it be due to the device being 64 bit with Android 32? |
Probably you are on an older Android device. The exploit only works from Android 8.1 and above. |
The apk seems to be not available.Can you please reupload? |
I believe there is a race condition problem. Code ex: I was able to call system and run code on a Motorola 1952-2. But with WhatsApp it is not possible. Interesting that I've teste on many Android 9.0 32-bit devices: The GIF is correct, but I think there is a race condition or maybe malloc implementation varies from device to device. |
So which device did the exploit fail? |
All failed with WhatsApp. |
Hello, I got ROP gadget at address 0x00159b80
0x00159b80: ldr x8, [x19, #0x18]; add x0, x19, #0x20; blr x8;
I added this address to the base address of libhwui.so (0x7710ddd000). I also got the system address and changed these in the code, but the exploit is not working. Process gets segfault and doesn't connect to my netcat listener. I'm testing on Android 9.
Any idea?
The text was updated successfully, but these errors were encountered: