Anti-debug scenario: Our most commonly used dynamic tool is Ida, Ida's dynamic Debug port defaults to 23946, we can view the Android system through/PRO/NET/TCP all TCP socket boot Android_server,/proc/net /TCP, port number is 0x5d8a, decimal is 23946
We can use the default debug port 23946来 to implement reverse debugging.The implementation code is as follows: The Android operating system does not allow a socket with multiple identical ports for an IP that may exist simultaneouslySolution: The most common solution to resolve, we do not use the default forwarding port 23946. Android_server provides a command to specify a forwarding portcommand:./android_server-p12345, note there is no space between the port number and the parameterThe port number becomes 0x3039, that is 12345 although this is a simple approach, it is not annoying for a minimalist programmer to designate ports every time. Can we change the port number permanently by changing the default port of the Android_server by reverse android_server.different IDA versions of android_server use the same instruction set, such as IDA6.6 using the arm instruction set, and IDA6.8 using a thumb instruction set. However, the modification scheme is consistent, the author usesThe IDA6.8 android_server of the thumb instruction set.1. Ida opens Android_server and finds the main function, as follows: corresponding binary instruction code
2. Here you need to know a little bit about the ARM directive knowledge, here Ldr R5, =5d8a, a pseudo-directive, =5d8a refers to the instruction and variable (store value is 5d8a) relative offset address, this sentence why the same arm assembly corresponding to 16 binary system is different, because the instruction address is not the same, Causes the offset address to be different. As a rule, the address of this storage 5d8a is at the end of the function.
There is a data_xref on the right, there are two applications, that is, two pseudo-instructions LDR, R5, =0x5d8a address, double-click can be verified. 3. Next we use the binary Editing Tool 010 editor to edit the file offset B8d8 change this value to our specified port number: 12345 (0x3039), save, Test 3. Test OK
Talking about the turning port of Android anti-debugging