CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Mobile Section
Apple iOS
IDA + LLDB Tutorial
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="harald4211" data-source="post: 38469" data-attributes="member: 233021"><p><span style="color: #ff4d4d">NOTE:</span></p><p></p><p>iOS 11 is NOT able to run armv7, most devices run on iOS 11. I suggest NOT to hack armv7 binary, so this tutorial is KINDA useless. You can use this tutorial to reduce your knowledge.</p><p></p><p>Hello Everyone!</p><p></p><p>In this topic I'll explain/show you how you hack games with IDA using lldb &/ GDB on armv7</p><p>I'll try to make it as noob friendly as I can, it will be a long tutorial since I'll explain EVERY step.</p><p></p><p>Requirements for this tutorial:</p><p></p><p>- IDA Program</p><p>- Jailbroken Phone to test it</p><p>- Hex Editor</p><p>- The binary of the game we're gonna hack -> get it <a href="https://drive.google.com/file/d/0B_qzxquukQ6RWTZKX2ZkYTJYalE/view?usp=sharing" target="_blank">HERE</a> *</p><p>- The game, get it <a href="https://www.iphonecake.com/app_531184261_.html" target="_blank">HERE</a> & download v1.11</p><p>- LLDB </p><p>- Gameplayer</p><p>- Theos fully setup (not 100% neccesarry) </p><p></p><p>* = When you're hacking armv7, I suggest you to remove aslr from the binary so you don't have to calculate every watchpoint & breakpoint. The binary for this tutorial, is thinned & has ASLR removed.</p><p></p><p>The game we are going to hack is called 'Trigger Fist' a dead shoot game, but good to practice with.</p><p></p><p>First thing to do, is load the binary from above into IDA, with these settings:</p><p>[SPOILER="Settings"]<img src="https://i.imgur.com/KJiUHYd.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Second thing we need to do is replace the binary of the game with the one from above, since we will be using lldb & we don't want aslr to be loaded.</p><p></p><p>To do this, you'll need Filza Manager from Cydia.</p><p>First of all, copy the binary, then go to: /var/containers/bundle/appliciation/'Trigger Fist/TriggerFist.app' & paste.</p><p>Then set the binary premissions like this:</p><p>[SPOILER="Permissions"]<img src="https://i.imgur.com/zcs527w.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>To do this, you click the little 'Info' icon next to the binary name.</p><p></p><p>Alright, everything is set for debugging using lldb <img src="https://iosgods.com/uploads/emoticons/smile.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>First of all we need to know what we're going to hack, which is ammo & grenades.</p><p>So what we're going to do is find the values using Gameplayer, I hope everyone knows how to do that.</p><p>Write them down if you found both values.</p><p></p><p>You can also do this while you're connected with lldb, but every time you search for a value in Gameplayer, you'll need to type 'continue or c' in the lldb window.</p><p>I do this because sometimes the game changes the value even if I haven't closed it.</p><p>Not sure if this also is for this game, but it's up to you how you wanna do it.If you do not know how to find them: Your ammo starts with 30 (atleast for me, if not for you replace numbers from below with yours)[SPOILER]</p><p>- Search for 30 in Gameplayer</p><p>- Shoot one time</p><p>- Search for 29 (or whatever value you got new)</p><p>- Shoot againt</p><p>- Search for 28 (or whatever value you got new)</p><p>- I do get one address from Gameplayer (if you still get more, shoot & search until you get one hit)</p><p>- WRITE THE ADDRESS DOWN!!</p><p></p><p>Your grenades are 2.</p><p>- Search for 2</p><p>- Throw one away</p><p>- Search for 1</p><p>- Throw one away</p><p>- search for 0</p><p>- Die </p><p>- You got 2 grenades again after you died, so search 2</p><p>- Throw one away</p><p>- Search 1</p><p>- Do this until you get ONE hit</p><p>- WRITE THE ADDRESS DOWN!!</p><p></p><p>IT's VERY IMPORTANT YOU DO NOT CLOSE THE APP FROM NOW, BECAUSE Gameplayer ADDRESSES ALWAYS CHANGE AFRER REOPENING APP.[/SPOILER]</p><p>Alright, now we need to debug, so we can get the ida offsets.</p><p></p><p>We need to debug with port 23, on mac you don't need to do anything. </p><p>On windows you run the mux.exe program for it, but if you're on Windows 10 that won't work.</p><p>We need to do it with iFunbox, using the USB Tunnel option in the toolbox tab.</p><p></p><p>First we need to make connection with our phone, by runnning this command in SSH Terminal (open using iFunbox)</p><p></p><p>What is 'PID', not sure what it exactly is, but I do know how to find it <img src="https://iosgods.com/uploads/emoticons/tongue.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p>Open the game, click Gameplayer icon & select the application if it doesn't automaticly.</p><p>This is the PID:</p><p>[SPOILER="PID"]<img src="https://i.imgur.com/syIyepN.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Alright, you typed it in & it should look like this: </p><p>[SPOILER]<img src="https://i.imgur.com/alvP82U.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Now go to your lldb folder & double click lldb.exe</p><p>A command promt will show up, type this: </p><p></p><p>It should look like this:</p><p>[SPOILER]<img src="https://i.imgur.com/jFGqLnf.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>It can take some time to make connection, depends on how fast you connection is.</p><p>When it's connected it will show you this:</p><p>[SPOILER]<img src="https://i.imgur.com/pEbzCcD.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p></p><p>Alright, so we want to know the ida offsets of the gameplayer addresses we have.</p><p>We do this by this command.</p><p></p><p>It should say this when you set a watchpoint:</p><p>[SPOILER]<img src="https://i.imgur.com/ooOz9ow.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Type 'continue' or 'c' in the lldb window to continue the game.</p><p>Make a change in ammo, the game will freeze, this is good!</p><p>The lldb window will look like this: </p><p>[SPOILER]<img src="https://i.imgur.com/wGyy72g.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>This is the ida offset: (marked with <<<<<<<<<) (WRITE IT DOWN + WRITE DOWN TO WHAT THE VALUE CHANGED)</p><p></p><p>Also type 'register read' to know what each register means around the function. (register = R1, R2, R3, etc)</p><p>It will look like this: </p><p>[SPOILER]<img src="https://i.imgur.com/ycMgdTP.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Copy the output & paste it somewhere where you can find it back & type 'ammo' above it.</p><p>How to copy it?</p><p>Select it with your mouse & hit enter, this will copy it. You can 'ctrl + c it' too, but it will ask you to quit lldb & we don't want that.</p><p></p><p>Alright, now type 'continue' or 'c' in lldb to continue the game</p><p>Make a change in grenades, the game will freeze & we know now this is good!</p><p>We also know how the lldb windows looks like & what the ida offset is. (WRITE IT DOWN = WRITE DOWN TO WHAT THE VALUE CHANGED)</p><p></p><p> Type again 'register read' & do the same progress you did with the ammo, but now type 'grenades' above it.</p><p>I suggest you to register read when the you have more then 0 grenades, otherwise it's harder to see which register is the real one.</p><p></p><p>Now we have both, close lldb.</p><p></p><p>Alright, now we know both offsets & what every register means, it's easy peasy to hack.</p><p>Let's look into the ammo function first, it looks like this: </p><p>[SPOILER]<img src="https://i.imgur.com/t2t1pHQ.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Alright, there are most of the times multiply ways to hack something.</p><p>This is the exact code written:</p><p></p><p></p><p>Alright, we also know what all Registers means. lldb gives the values in HEX decimal</p><p>We only know the values in decimal.</p><p>We wrote down what our ammo changed to, which was for me 29.</p><p>29 in hex = 1D</p><p>Register 1 (R1) holds that value, which means that's our ammo.</p><p></p><p>As you can see in the code, we see some R1, R0, R5, R10 etc.</p><p>R1 is which is important for us now.</p><p>As you can see in the code above the 'register read' output, I wrote // after each instruction with a R1 in it.</p><p></p><p>Which are these four:</p><p></p><p>I wrote down what they mean.</p><p></p><p></p><p></p><p>Anyways,</p><p>The sub instruction is the most used way to hack ammo</p><p>Why?</p><p></p><p>Well.. when you shoot, one bullet wil go away.. </p><p>This instruction Substracts 1 from R1 (ammo) into R1 (ammo)</p><p></p><p>We can hack a SUB in diffrent ways.</p><p></p><p>We can also hack it using the first LDR from above & the STR function.</p><p></p><p>How we hack the LDR:</p><p></p><p>How we hack the STR:</p><p></p><p>When you're hacking a binary, you need to know what kind of 'HEX' it is.</p><p></p><p>When you know that you can change the instruction which you like.</p><p>Let's change the SUB instruction to MOV R1, R7</p><p>The outcome in armconverter will be 0710A0E1, because this game is ARM-HEX.</p><p></p><p>Normally you patch the binary manually using a hex editor, somehow this is not working for me on this game.</p><p>Maybe for some others it does I don't know.</p><p>These are the steps if you wanna try it:</p><p></p><p>Load the same binary you loaded into IDA in HxD.</p><p>I suggest you to make a backup though.</p><p></p><p>We need to go to our SUB instruction offset, which is: 1527CC</p><p>How do I know?</p><p>See here: </p><p>[SPOILER]<img src="https://i.imgur.com/EdTFr2p.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Go to that offset in HxD, by doing 'ctrl + G' or 'edit - goto'</p><p>This is it, this is what we're gonna hack.</p><p>[SPOILER]<img src="https://i.imgur.com/SrQqLaB.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Alright, I'm going to hack it by MOV R1, R7 the SUB instruction.</p><p>You can do whatever you prefer, but remember do it in ARM-HEX!!</p><p></p><p>It will look like this:</p><p>[SPOILER]<img src="https://i.imgur.com/HlST6Cx.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /> [/SPOILER]</p><p>Now save it.</p><p>We wanna test it, but we need to sign it first.</p><p>Paste the hacked binary into var/mobile with iFunbox or whatever you like.</p><p></p><p>Type in SSH window: cd /var/mobile & then type: ldid -s TriggerFist </p><p>You're done, </p><p>Now replace it into your application folder like you did before with the same premissions.</p><p></p><p>Test the hack.</p></blockquote><p></p>
[QUOTE="harald4211, post: 38469, member: 233021"] [COLOR=#ff4d4d]NOTE:[/COLOR] iOS 11 is NOT able to run armv7, most devices run on iOS 11. I suggest NOT to hack armv7 binary, so this tutorial is KINDA useless. You can use this tutorial to reduce your knowledge. Hello Everyone! In this topic I'll explain/show you how you hack games with IDA using lldb &/ GDB on armv7 I'll try to make it as noob friendly as I can, it will be a long tutorial since I'll explain EVERY step. Requirements for this tutorial: - IDA Program - Jailbroken Phone to test it - Hex Editor - The binary of the game we're gonna hack -> get it [URL='https://drive.google.com/file/d/0B_qzxquukQ6RWTZKX2ZkYTJYalE/view?usp=sharing']HERE[/URL] * - The game, get it [URL='https://www.iphonecake.com/app_531184261_.html']HERE[/URL] & download v1.11 - LLDB - Gameplayer - Theos fully setup (not 100% neccesarry) * = When you're hacking armv7, I suggest you to remove aslr from the binary so you don't have to calculate every watchpoint & breakpoint. The binary for this tutorial, is thinned & has ASLR removed. The game we are going to hack is called 'Trigger Fist' a dead shoot game, but good to practice with. First thing to do, is load the binary from above into IDA, with these settings: [SPOILER="Settings"][IMG]https://i.imgur.com/KJiUHYd.png[/IMG] [/SPOILER] Second thing we need to do is replace the binary of the game with the one from above, since we will be using lldb & we don't want aslr to be loaded. To do this, you'll need Filza Manager from Cydia. First of all, copy the binary, then go to: /var/containers/bundle/appliciation/'Trigger Fist/TriggerFist.app' & paste. Then set the binary premissions like this: [SPOILER="Permissions"][IMG]https://i.imgur.com/zcs527w.png[/IMG] [/SPOILER] To do this, you click the little 'Info' icon next to the binary name. Alright, everything is set for debugging using lldb [IMG]https://iosgods.com/uploads/emoticons/smile.png[/IMG] First of all we need to know what we're going to hack, which is ammo & grenades. So what we're going to do is find the values using Gameplayer, I hope everyone knows how to do that. Write them down if you found both values. You can also do this while you're connected with lldb, but every time you search for a value in Gameplayer, you'll need to type 'continue or c' in the lldb window. I do this because sometimes the game changes the value even if I haven't closed it. Not sure if this also is for this game, but it's up to you how you wanna do it.If you do not know how to find them: Your ammo starts with 30 (atleast for me, if not for you replace numbers from below with yours)[SPOILER] - Search for 30 in Gameplayer - Shoot one time - Search for 29 (or whatever value you got new) - Shoot againt - Search for 28 (or whatever value you got new) - I do get one address from Gameplayer (if you still get more, shoot & search until you get one hit) - WRITE THE ADDRESS DOWN!! Your grenades are 2. - Search for 2 - Throw one away - Search for 1 - Throw one away - search for 0 - Die - You got 2 grenades again after you died, so search 2 - Throw one away - Search 1 - Do this until you get ONE hit - WRITE THE ADDRESS DOWN!! IT's VERY IMPORTANT YOU DO NOT CLOSE THE APP FROM NOW, BECAUSE Gameplayer ADDRESSES ALWAYS CHANGE AFRER REOPENING APP.[/SPOILER] Alright, now we need to debug, so we can get the ida offsets. We need to debug with port 23, on mac you don't need to do anything. On windows you run the mux.exe program for it, but if you're on Windows 10 that won't work. We need to do it with iFunbox, using the USB Tunnel option in the toolbox tab. First we need to make connection with our phone, by runnning this command in SSH Terminal (open using iFunbox) What is 'PID', not sure what it exactly is, but I do know how to find it [IMG]https://iosgods.com/uploads/emoticons/tongue.png[/IMG] Open the game, click Gameplayer icon & select the application if it doesn't automaticly. This is the PID: [SPOILER="PID"][IMG]https://i.imgur.com/syIyepN.png[/IMG] [/SPOILER] Alright, you typed it in & it should look like this: [SPOILER][IMG]https://i.imgur.com/alvP82U.png[/IMG] [/SPOILER] Now go to your lldb folder & double click lldb.exe A command promt will show up, type this: It should look like this: [SPOILER][IMG]https://i.imgur.com/jFGqLnf.png[/IMG] [/SPOILER] It can take some time to make connection, depends on how fast you connection is. When it's connected it will show you this: [SPOILER][IMG]https://i.imgur.com/pEbzCcD.png[/IMG] [/SPOILER] Alright, so we want to know the ida offsets of the gameplayer addresses we have. We do this by this command. It should say this when you set a watchpoint: [SPOILER][IMG]https://i.imgur.com/ooOz9ow.png[/IMG] [/SPOILER] Type 'continue' or 'c' in the lldb window to continue the game. Make a change in ammo, the game will freeze, this is good! The lldb window will look like this: [SPOILER][IMG]https://i.imgur.com/wGyy72g.png[/IMG] [/SPOILER] This is the ida offset: (marked with <<<<<<<<<) (WRITE IT DOWN + WRITE DOWN TO WHAT THE VALUE CHANGED) Also type 'register read' to know what each register means around the function. (register = R1, R2, R3, etc) It will look like this: [SPOILER][IMG]https://i.imgur.com/ycMgdTP.png[/IMG] [/SPOILER] Copy the output & paste it somewhere where you can find it back & type 'ammo' above it. How to copy it? Select it with your mouse & hit enter, this will copy it. You can 'ctrl + c it' too, but it will ask you to quit lldb & we don't want that. Alright, now type 'continue' or 'c' in lldb to continue the game Make a change in grenades, the game will freeze & we know now this is good! We also know how the lldb windows looks like & what the ida offset is. (WRITE IT DOWN = WRITE DOWN TO WHAT THE VALUE CHANGED) Type again 'register read' & do the same progress you did with the ammo, but now type 'grenades' above it. I suggest you to register read when the you have more then 0 grenades, otherwise it's harder to see which register is the real one. Now we have both, close lldb. Alright, now we know both offsets & what every register means, it's easy peasy to hack. Let's look into the ammo function first, it looks like this: [SPOILER][IMG]https://i.imgur.com/t2t1pHQ.png[/IMG] [/SPOILER] Alright, there are most of the times multiply ways to hack something. This is the exact code written: Alright, we also know what all Registers means. lldb gives the values in HEX decimal We only know the values in decimal. We wrote down what our ammo changed to, which was for me 29. 29 in hex = 1D Register 1 (R1) holds that value, which means that's our ammo. As you can see in the code, we see some R1, R0, R5, R10 etc. R1 is which is important for us now. As you can see in the code above the 'register read' output, I wrote // after each instruction with a R1 in it. Which are these four: I wrote down what they mean. Anyways, The sub instruction is the most used way to hack ammo Why? Well.. when you shoot, one bullet wil go away.. This instruction Substracts 1 from R1 (ammo) into R1 (ammo) We can hack a SUB in diffrent ways. We can also hack it using the first LDR from above & the STR function. How we hack the LDR: How we hack the STR: When you're hacking a binary, you need to know what kind of 'HEX' it is. When you know that you can change the instruction which you like. Let's change the SUB instruction to MOV R1, R7 The outcome in armconverter will be 0710A0E1, because this game is ARM-HEX. Normally you patch the binary manually using a hex editor, somehow this is not working for me on this game. Maybe for some others it does I don't know. These are the steps if you wanna try it: Load the same binary you loaded into IDA in HxD. I suggest you to make a backup though. We need to go to our SUB instruction offset, which is: 1527CC How do I know? See here: [SPOILER][IMG]https://i.imgur.com/EdTFr2p.png[/IMG] [/SPOILER] Go to that offset in HxD, by doing 'ctrl + G' or 'edit - goto' This is it, this is what we're gonna hack. [SPOILER][IMG]https://i.imgur.com/SrQqLaB.png[/IMG] [/SPOILER] Alright, I'm going to hack it by MOV R1, R7 the SUB instruction. You can do whatever you prefer, but remember do it in ARM-HEX!! It will look like this: [SPOILER][IMG]https://i.imgur.com/HlST6Cx.png[/IMG] [/SPOILER] Now save it. We wanna test it, but we need to sign it first. Paste the hacked binary into var/mobile with iFunbox or whatever you like. Type in SSH window: cd /var/mobile & then type: ldid -s TriggerFist You're done, Now replace it into your application folder like you did before with the same premissions. Test the hack. [/QUOTE]
Verification
Post reply
Forums
Mobile Section
Apple iOS
IDA + LLDB Tutorial
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top