Is it possible to edit and recompile an iOS Binary?

六月ゝ 毕业季﹏ 提交于 2020-01-31 04:36:58

问题


I have decided to ask this question here after a lot of time spending with Google. But I couldn't able to get the answer for my question yet. Here follows the details:

I have an application and posted to Cydia recently. It has been cracked by someone else and posted it in torrent sites. The interesting part is I have a binary checksum verification mechanism inside and they were able to hack the entire stuff and they created new checksum file based on the changes they have made to the binary. They have edited two functions and decompile it and post it to torrents.

So I have done some research with IDA Pro and saw that its is possible to see the actual implementation of functions and classes. But in order to edit the functions they have to find address of that function and edit it via HEX EDITOR. This is part is confusing to me, is there anybody help me on this? I don’t want to make it "unhackable" :)..Its not that easy I guess. :) But I really want to find out how they hack? :)

My question is how to edit a function in an iOS binary and re-compile it? For example I have a following method in one of my classes.

- (id) getSomething {

   return @"Something";
}

I want to edit the return value of this function.Is that possible??


回答1:


Usually, you don't "re-compile" it. Just feed the file to IDA, look for strings, function calls or whatever you are looking for and then use a hex editor or similar to edit the file on assembly level. In most cases it's enough to simply change a conditional jump into an unconditional jump or a nop (no operation). If you want to change return values, you have to put a little more effort into it, but in my experience you either edit the char sequence right inside the binary file, if it's specified as a constant or initial value - or you just write a completely new function and "copy" the assembler code of it into the original file. You just have to make sure your new function does not take more space than the original - or everything's getting a lot more complex. I hope that's what you were asking for, otherwise just tell us which app you are talking about and we can look deeper into it :)



来源:https://stackoverflow.com/questions/10577406/is-it-possible-to-edit-and-recompile-an-ios-binary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!