Jump to content

IDA + LLDB Tutorial [Noob Friendly]


95 posts in this topic

Recommended Posts

Updated (edited)

NOTE:

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. I will be making a simulair tutorial for arm64 binaries.

 

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 -> get it HERE
- Jailbroken Phone to test it
- Hex Editor
- The binary of the game we're gonna hack -> get it HERE *
- The game, get it HERE & download v1.11
- LLDB -> For Windows, go HERE & for Mac go HERE
- Gameplayer
- Theos fully setup (not 100% neccesarry, but since you're learn hacking.. why not?) -> Setup Tutorial

* = When you're hacking armv7, I suggest you to remove aslr from the binary using THIS site, 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

rR3OiqD.png

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

lqn9j63.png


To do this, you click the little 'Info' icon next to the binary name.

 

Alright, everything is set for debugging using lldb :)

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.

 

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.

See THIS topic to do this with Windows 10

First we need to make connection with our phone, by runnning this command in SSH Terminal (open using iFunbox)
 

debugserver 127.0.0.1:23 --attach=PID 

What is 'PID', not sure what it exactly is, but I do know how to find it :p
Open the game, click Gameplayer icon & select the application if it doesn't automaticly.
This is the PID: 

Spoiler

EJtwJBQ.png

Alright, you typed it in & it should look like this: 

Spoiler

u6C69i3.png

Now go to your lldb folder & double click lldb.exe
A command promt will show up, type this: 

process connect connect://127.0.0.1:23


It should look like this:

Spoiler

D2sAm7V.png

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

vSsMa32.png

Alright, so we want to know the ida offsets of the gameplayer addresses we have.
We do this by this command 
 

w s e -- 0xgameplayeraddress

which is for me

w s e -- 0x1501ca6c //ammo 
and
w s e -- 0x0ebcec60 //grenades

It should say this when you set a watchpoint:

Spoiler

7nhuFZ4.png

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

UOkhNHp.png


This is the ida offset: (marked with <<<<<<<<<) (WRITE IT DOWN + WRITE DOWN TO WHAT THE VALUE CHANGED)

(lldb) Process 86864 stopped
* thread #1: tid = 0x15350, 0x001527d4 TriggerFist`___lldb_unnamed_function1$$TriggerFist + 1382346, stop reason = watchpoint 3
    frame #0: 0x001527d4 TriggerFist`___lldb_unnamed_function1$$TriggerFist + 1382346
TriggerFist`___lldb_unnamed_function1$$TriggerFist + 1373466:
-> 0x1527d4 <<<<<<<<<<<<<<<:  mov    r0, #0x1
   0x1527d8:  strb   r0, [r10, #430]
   0x1527dc:  mov    r0, #0x1

Also type 'register read' to know what each register means around the function. (register = R1, R2, R3, etc)
It will look like this: 

Spoiler

A8SwSH8.png


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

onaxkHE.png

Alright, there are most of the times multiply ways to hack something.
This is the exact code written:

LDR             R0, [R10,#0x88]
LDR             R0, [R0,#0x70]
CMP             R5, R0
BLT             loc_152764
LDR             R0, [R10,#0x88]
LDR             R1, [R0,#0xAC] //
SUB             R1, R1, #1 //
STR             R1, [R0,#0xAC] //
MOV             R0, #1  ; The address where it drops us
STRB            R0, [R10,#0x1AE]
MOV             R0, #1
STRB            R0, [R10,#0x1AF]
LDR             R0, [R10,#0x1CC]
ADD             R0, R0, #1
STR             R0, [R10,#0x1CC]
LDR             R0, [R10,#0x88]
VLDR            S0, [R0,#0x68]
VCVT.F64.F32    D2, S0
VCVT.F32.F64    S0, D2
VSTR            S0, [R10,#0x284]
LDR             R0, [R10,#0x174]
LDR             R1, =(unk_C80D00 - 0x15281C) //
B               loc_152814

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.

Spoiler

General Purpose Registers:
        r0 = 0x1501c9c0
        r1 = 0x0000001d <-----> our ammo
        r2 = 0x00000001
        r3 = 0x15308038
        r4 = 0x00000001
        r5 = 0x00000001
        r6 = 0x00000058
        r7 = 0x00e3da94
        r8 = 0x00000000
        r9 = 0x00000000
       r10 = 0x16734cc0
       r11 = 0x00e3d374
       r12 = 0x0068f80c  TriggerFist.__TEXT.__text + 6866268
        sp = 0x00e3d374
        lr = 0x00608044  TriggerFist.__TEXT.__text + 6311316
        pc = 0x001527d4  TriggerFist.__TEXT.__text + 1373476
      cpsr = 0x60000010

 

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:
 

Spoiler

LDR             R1, [R0,#0xAC] //Loads the value stored in R0,#0xAC into R1 (#0xAC is a sort of variable, likely for ammo, R0 is holding a adress for some object)
SUB             R1, R1, #1 // Substracts the value of one from R1 (ammo) into R1 (ammo)
STR             R1, [R0,#0xAC] //Stores R1 (ammo) into what's stored in R0,#0xAC (#0xAC is a sort of variable, likely for ammo, R0 is holding a adress for some object)
LDR             R1, =(unk_C80D00 - 0x15281C) //I've no idea, it does load something into our ammo atleast.

 

 

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.

1. NOP the instruction, what this does is skip the instruction and does nothing
2. Change the #1 to #0, which would substract 0 from our ammo.
3. Change the SUB to ADD, which would ADD ammo instead of substracting.
4. Change the SUB to MOV R1, R7, which would move the value of 803 millioin into our ammo.

We can also hack it using the first LDR from above & the STR function.

How we hack the LDR:

- LDR R1, [R0,#0xAC] to LDR R1, [R7,#0xAC] --> What this does is load R7 (803 million) into our ammo instead of what the normal value should be.

This works because it's loading uninitialized memory into R0

How we hack the STR:

- STR R1, [R0,#0xAC] to STR R7, [R0,#0xAC] --> what this does is stores R7 into R0,#AC] instead of storing our normal ammo.

When you're hacking a binary, you need to know what kind of 'HEX' it is.
How to find out:

Spoiler

 

1. go to: http://armconverter.com  @DiDA :wub:
2. copy the ida instruction into the box & click convert (SUB R1, R1, #1 in this example)
3. you see under you've diffrent outcomes
4. go back to IDA
5. select the sub instruction & click hex view, there will be highlighted number, compare this with armconverter & see which one is the same.

6. Now you know what kind of HEX it is & you can hack.

 

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

7XzQ8L5.png

Go to that offset in HxD, by doing 'ctrl + G' or 'edit - goto'
This is it, this is what we're gonna hack.

Spoiler

LkmnVN9.png

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

sttQdgg.png

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, if it doesn't work see this topic by @shmooSign Binary Topic

Now replace it into your application folder like you did before with the same premissions.

Test the hack.

I'm using a Code Injection Template with Theos, if you never used theos, you need to set this up.
If you do paste this nic template into your /var/theos/templates/iphone/HERE
Link to template: Code Injection Template made by @DiDA

 

You set up a project like you normally do & change the tweak.xm, which looks like this:

Spoiler

d54n94Q.png

Change it to this: 

D91RAQs.png

Why? 

The first offset, is the ida hex offset & the second is the hacked offset.

Compile it & test it.

The grenades function is for you guys, you can try this on your own!
You guys have the 'read register' output, so you can do it!

Let me know if you succeed :)

Hope you learned something :)

PS: there will come some more advanced tutorial soon, also with lldb.

 

Another game you can practice with is Sniper 3D, ammo is easy & resources are same offsets but maybe more 'challenging '

 

Credits:

- @Ted2

- @shmoo see his comment, he fixed some errors: HERE

Updated by RudePerson
Fixed some things through Shmoo's comment.
  • Like 30
  • Winner 7
  • Thanks 9
  • Haha 2
  • Agree 4
  • Informative 4
Posted

@Goran this is not Coin Dozer, coin dozer will be in my more 'advanced tutorial'

the watchpoints you get from coin dozer, are not directly the right addresses. So that's why I'll cover that in my more advanced & it will be a video.

  • Thanks 1
Posted

Register read -all gives you all the registers ;)

Posted
3 hours ago, Ted2 said:

@Goran this is not Coin Dozer, coin dozer will be in my more 'advanced tutorial'

the watchpoints you get from coin dozer, are not directly the right addresses. So that's why I'll cover that in my more advanced & it will be a video.

m8 this can be done on android also right 

Guest
This topic is now closed to further replies.
  • Our picks

    • Idle Police Tycoon - Cops Game Cheats v1.28 +3
      Modded/Hacked App: Idle Police Tycoon - Cops Game By Codigames SL
      Bundle ID: com.codigames.idle.police.department.tycoon.cop
      App Store Link: https://apps.apple.com/us/app/idle-police-tycoon-cops-game/id1521444735?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Infinite Cash
      - No Ads (Clam rewards / criminal without watching ads)
      - All Managers Hired

       

      Non-Jailbroken Hack: https://iosgods.com/topic/133424-idle-police-tycoon-cops-game-v128-jailed-cheats-3/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/133421-idle-police-tycoon-cops-game-cheats-v128-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 256 replies
    • Zombie Waves-shooting game v2.1.8 Jailed Cheats +6
      Modded/Hacked App: Zombie Waves-shooting game By FUN FORMULA PTE. LTD.
      Bundle ID: com.ddup.zombiewaves.zw
      App Store Link: https://apps.apple.com/us/app/zombie-waves-shooting-game/id6443760593?uo=4

       

      📌 Mod Requirements

      - Non-Jailbroken/Jailed or Jailbroken iPhone or iPad.
      - Sideloadly or alternatives.
      - Computer running Windows/macOS/Linux with iTunes installed.

       

      🤩 Hack Features

      - God Mode
      - Infinite Ammo
      - No Reload
      - Increase Magnet Range
      - High Damage X10
      - High Fire Rate

       

      ⬇️ iOS Hack Download IPA Link: https://iosgods.com/topic/201966-zombie-waves-shooting-game-v212-jailed-cheats-6/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 60 replies
    • Hungry Shark World v7.3.3 +9 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Hungry Shark World By Ubisoft
      Bundle ID: com.ubisoft.hungrysharkworld
      iTunes Store Link: https://apps.apple.com/us/app/hungry-shark-world/id1046846443?uo=4


      Hack Features:
      - Coin Modifier
      - Gem Modifier
      - Pearl Modifier
      - Unlock All
      - Freeze Health
      - Freeze Boost
      - Season Pass Unlocked
      - Score Multiplier
      - No Gravity
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 296 replies
    • Minions World v1.2.4 [ +5 APK MOD ] Currency Max
      Mod APK Game Name: Minions World
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.mikapps.minionsconquest&hl=en

      🤩 Hack Features

      - Unlimited Gems
      - Unlimited Gold
      - Unlimited Energy
      - Unlimited Silver Keys
      - Unlimited Golden Keys
      • 0 replies
    • Galaxy War: Falltopia Shooter v1.0.194 [ +12 APK MOD ] ADS NO
      Mod APK Game Name: Galaxy War: Falltopia Shooter
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.threehp013.idle.plane.shooting.space.force.game

      🤩 Hack Features

      - ADS NO / Rewards Free
      - Speed Boost Active
      - Currency / NO Need
      - Resources / NO Need
      - Defensec Pass
      - Upgrade Pass
      - Season Pass
      - Battle Pass
      - Blessings Active
      - HP / Equip & Unequip
      - ATK / Equip & Unequip
      - Def / Equip & Unequip
      • 1 reply
    • OnceWorld v1.1.2 +2 Jailed Cheats [ Damage + More ]
      Modded/Hacked App: OnceWorld By PONIX LLC
      Bundle ID: work.ponix.onceworld
      App Store Link: https://apps.apple.com/us/app/onceworld/id6753948618?uo=4

       


      🤩 Hack Features

      - Damage Multiplier
      - God Mode
        • Informative
        • Agree
        • Thanks
        • Like
      • 30 replies
    • Dawn of Zombies: Survival Game v2.274.3032 +6 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Dawn of Zombies: Survival Game By VISTREX LIMITED
      Bundle ID: com.survival.dawn
      iTunes Store Link: https://apps.apple.com/us/app/dawn-of-zombies-survival-game/id1465954247?uo=4


      Hack Features:
      - Damage Multiplier
      - Defence Multiplier
      - Speed Multiplier
      - Split Hack
      - No Energy Cost
      - Max Level -> Earn some XP.


      Jailbreak required hack(s): [Mod Menu Hack] Dawn of Zombies: Survival Game v2.250 +6 Cheats [ Damage & Defence ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 299 replies
    • Wool Craze -Yarn Color Sort 3D v4.9 [ +4 Jailed ] Currency Max
      Modded/Hacked App: Wool Craze -Yarn Color Sort 3D By Hero Linkage Technology Co., Ltd.
      Bundle ID: com.color.wool.blast
      App Store Link: https://apps.apple.com/us/app/wool-craze-yarn-color-sort-3d/id6744317674?uo=4

      🤩 Hack Features

      - Unlimited Coins
      - Unlimited Stars
      - Unlimited Life
      - Unlimited Booster
        • Haha
      • 0 replies
    • Wool Craze -Yarn Color Sort 3D v4.9 [ +4 Cheats ] Currency Max
      Modded/Hacked App: Wool Craze -Yarn Color Sort 3D By Hero Linkage Technology Co., Ltd.
      Bundle ID: com.color.wool.blast
      App Store Link: https://apps.apple.com/us/app/wool-craze-yarn-color-sort-3d/id6744317674?uo=4

      🤩 Hack Features

      - Unlimited Coins
      - Unlimited Stars
      - Unlimited Life
      - Unlimited Booster
        • Like
      • 0 replies
    • Hello Town: Merge & Succeed v3.2 [ +3 Cheats ] Currency Max
      Modded/Hacked App: Hello Town By Springcomes Co., Ltd.
      Bundle ID: com.spcomes.hellotown
      iTunes Store Link: https://apps.apple.com/us/app/hello-town/id6737850281?uo=4


      Hack Features

      - Diamonds
      - Gold
      - Energy Freeze



      For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
        • Agree
        • Thanks
        • Winner
        • Like
      • 33 replies
    • Hello Town: Merge & Succeed v3.2 [ +3 Jailed ] Currency Max
      Modded/Hacked App: Hello Town By Springcomes Co., Ltd.
      Bundle ID: com.spcomes.hellotown
      iTunes Store Link: https://apps.apple.com/us/app/hello-town/id6737850281?uo=4

       

      Hack Features

      - Diamonds
      - Gold
      - Energy Freeze



      Jailbreak required iOS hacks: https://iosgods.com/forum/5-game-cheats-hack-requests/
      Modded Android APKs: https://iosgods.com/forum/68-android-section/
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 32 replies
    • Dragon Wings: RPG Shoot em up v1.16.1 [ +5 Cheats ] Currency Max
      Modded/Hacked App: Dragon Wings: RPG Shoot 'em up By Spirit Bomb Company Limited
      Bundle ID: rpg.arcade.space.shooter.dragon.wings
      App Store Link: https://apps.apple.com/us/app/dragon-wings-rpg-shoot-em-up/id6741735947?uo=4

       

      🤩 Hack Features

      - Super Card Active

      - Gems

      - Gold

      - Never Die

      - ATK 
        • Informative
        • Agree
        • Like
      • 35 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines