Note: The purpose of this article is only to Exchange learning, not commercial use, otherwise, the author is not responsible for the consequences.
Well, it's not really careless, it's premeditated. There's someone else on hand. A library, but do not know how one of the interfaces is implemented, and then think of a crack.
The first is to grab the packet, look at the POST request sent, through the URL to see the parameters I need the value, parameter name is ***id. Then throw it into Ida and find some more dubious method names.
See Get****withkey: This method, from the name should be what I want to look for, so write down the function offset address and put it on the phone to debug. (I have a jailbreak environment dedicated to debugging programs) on how to disassemble the Debug app on your phone click here. because I want to crack is a static library, is used in my own code, so you can directly in Xcode disassembly of their own code, breakpoints down to the location of the. A library method, debug code through Xcode's lldb, so it is convenient to view the value in the register. The next breakpoint is broken *0xnnnnnnnn, when debugging, the menu selection always shows the assembly code,
Stepping, see below is entered in the target function:
By the way, some look at the basis of assembly code, the master ignores: R0 is the return value of the function, if the object is returned is the object's pointer address. R1~r4 are saved as parameters, SP is the stack base address, if there are multiple parameters, then save to this stack address. To save the field before the start of the function, the register that the push needs to use, and the last function to restore the field before the pop, the Register Saved by the POPs. Note also that there is a BL 0x1004ef3f0 directive (or BLX), this is a jump to the specified address execution, usually the address of the function, so if you step through the process (next) to execute this command, print the value of r0: PO $r 0, which is the function of the return of the stored the result.
Always Stepping (NI), the discovery function entered a get***h method, the return value is the value of the parameter I am looking for, that the real core should be within this function.
So in here, careful stepping, and output register value, found that this method first decrypted a few encrypted strings, should be the key function name, in order to prevent others to solve the processing, the author where I think there will be my egg pain will be debugging his code . In fact, with these several key words can know the function of the internal implementation, and finally to the implementation of the results are SHA1. In spite of the dynamic invocation and the encryption of the method name, the execution always exposes the body, which demonstrates the power of GDB (LLDB). Finally, according to the decrypted method name, guessed the realization way, so the most valuable secret of this library is solved.
in order to protect the privacy of the text, some sensitive names have been hidden .
"IOS" accidentally cracked someone else's static library