Jump to content

Learn how to hack games with IDA, CodeInject and HooKfunction (with example!)


129 posts in this topic

Recommended Posts

Updated (edited)
Hello there:)
Today I want to tell you about Code Inject and MSHook Hacking.
I will explain with a practical example for clarity!
I thank this community and leave this guide. 
Thank you!
 
✔Requirements
Spoiler
IDA PRO
Knowledge about C++ 
 
✔Binary
Spoiler
1.Add this repo http://cydia.iphonecake.com/
2.Install CrackerXI.
3.Turn on all in Settings.
4.Slect app which you want to get binary in Applist.
5.It will save to /var/mobile/Documents/CrackerXI
 
✔Note about Tweak.xm
Spoiler
The latest version of Theos uses Tweak.x instead of Tweak.xm.
These differences are explained at this page:
This can cause errors when compiling code found on the net. (In my case when compiling the code for PrefBundle)
So follow this:
1.Change name from Tweak.x to Tweak.xm
2.Change <ProjectName> _FILES = Tweak.x to <ProjectName> _FILES = Tweak.xm in Makefile.
 
✔ASLR Slide
Spoiler

There is ASLR slide is ARM64 binary, so IDA offset and actual binary offset are shifted by ASLR value.

※You can give IDA offset to vm_WriteData because ASLR considered Automatically in vm_WriteData.h
#import <mach-o/dyld.h>
uint64_t getRealOffset(uint64_t offset){
return _dyld_get_image_vmaddr_slide(0)+offset;
}

✔ARM Insructions

Spoiler

Load

MOV r0, r1 
Move the value of r1 to r0
LDR r0, [r1]
Load from memory r1 to register r0
STR r0, [r1]
Store the value of r0 into r1
Store memory r1 with value of register r0 
 
Branch
Compare previous CMP values
BEQ label
jump to label if values are equal
BNE label
jump to label if values are not equal
etc...
CBZ r0, label
jump to label if r0 is 0
CBNZ r0, label
jump to label if r0 is not 0

 

 
✔CodeInject
Spoiler

Place vm_WriteData.h in your project.

And add this to beginning of the code  
#import <vm_writeData.h>
 
Identify the part to change
1.Change the return value
Look at the processing at the bottom of the function (the part load to X0)
MOV X0, 100
2.Change branch
BEQ X0, label
Change the branch to always jump to any label:
B X0, label (BAL is also ok)
Change the branch to never jump to any label:
NOP
Convert to Hex
1.Load
2.Branch
Enter ARM instruction and copy ARM64 HEX.
Apply Changes
vm_WriteData(0x100000000, 0x00000000);
Change the memory starting from 0x100000000 to 00000000.
 
Ex1:Change instruction to change damage
Spoiler

Hidden Content

React or reply to this topic to see the hidden content & download link. 👀

Ex2:Change branch to change accuracy of weapon

Spoiler

Hidden Content

React or reply to this topic to see the hidden content & download link. 👀

Where should I actually write

Spoiler

It is good to write in %ctor. You can write it like this:

#import <vm_writeData.h>
%ctor {
  vm_WriteData(0x1002B55D8, 0x953E80D2);
}
 
✔MS(Object-C func)
Spoiler

Class name depends on the game Use class name which has applicationDidBecomeActive method!

(Easy to find on Flex)
%hook AppController // class name
-(void)applicationDidBecomeActive:(id)argument { // (type od return value) and method name and (type of argument)
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"test" message:@"Detected App opened!" delegate:nil cancelButtonTitle:@"Continue" otherButtonTitles:nil];
    [alert show];
    return %orig(argument);
}
%end
%orig holds the original function. Since we only want to add processing, we also call the original function.
※You can change the process by changing the argument.
This way is only available for Object-C functions, so if you want to hook a native function you can see in IDA and use MSHook!
 
✔MSHook(Native func)
Spoiler

Import substrate at beginning of code.

#import <substrate.h>
Hook function with offset
MSHookFunction((void *)getRealOffset(0x100000000), (void *)func, (void **)&org_func);
func
func - Function that has a process that you want to overwrite.
org_func - Function that keeps the original processing.
Since MSHookFuntion's void is cast and passed to void type, it is always void.
argument
Be sure to include this pointer first.
 
Ex1:Increase Damage
Spoiler

Hidden Content

React or reply to this topic to see the hidden content & download link. 👀

 

✔NSLog

Spoiler

To check NSLog on a device.

Add Flexing from the BigBoss repository.
You can display the log by pressing and holding three fingers on the application you want to see logs.
It can be used by tapping System Log and enabling it from Setting in the upper right.
NSLog(@"Your Log Text Here");
To display argument values:
%d int
%f float
%c unsigned char
%hi short
 
Ex:Display argument values
Spoiler

You can add it in the function definition that overrides like this.

int getDamage(void* this_, void* UserInfor, unsigned char arg0, float arg1) {
  NSLog(@"getDamage Called! arg0: %c, arg1: %f", arg0, arg1);
  return org_getDamage(this_, UserInfor, arg0, arg1);
}
 
✔Call the native func
 
Ex:Call a function to get user information
Spoiler

Hidden Content

React or reply to this topic to see the hidden content & download link. 👀

✔PrefBundle

Spoiler

https://iosgods.com/topic/444-tutorial-how-to-make-a-preference-bundle/

You can learn about PredBundle easily from the link above.
I only mention here how to add icons.
How to add icons
Add icon.png file to <project>/<prefbundl_project>/Resources/
You have to export with these size:
> icon.png - 29×29
[email protected] - 58×58
[email protected] - 87×87
You can export icon in here: https://appiconmaker.co/
 
p.s. A knowledgeable person would think why I don't talk about debuggers. Unfortunately gdb is displayed as BadCPUType in my environment and watch-point does not work properly in lldb.
Here are some great tutorials if you are interested in them:
 
If there are any mistakes please point in reply !
Enjoy :)
Updated by princessXZ
some stuff
  • Like 269
  • Winner 21
  • Thanks 26
  • Haha 6
  • Agree 8
  • Informative 20
Posted
7 hours ago, mafusuke said:
STR r0, [r1]
Load the value of r0 into r1

Nicely written, note thought that STR stands for store, so it's storing it.
Generally, LDR is used to load something from memory to a register, and STR is used to store something from a register to a memory address.

Posted
3 hours ago, Ted2 said:

Nicely written, note thought that STR stands for store, so it's storing it.
Generally, LDR is used to load something from memory to a register, and STR is used to store something from a register to a memory address.

Thank you! I'll fix that 🙂

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Our picks

    • Groove Journey v4.1.0 Jailed Mod +1
      Modded/Hacked App: Groove Journey By Somtochukwu Mbala
      Bundle ID: com.kaipha.groovejourney
      iTunes Store Link: https://apps.apple.com/us/app/groove-journey/id6736345547?uo=4


      Hack Features:
      - PREMIUM


      iOS Hack Download IPA Link: https://iosgods.com/topic/190862-groove-journey-v311-jailed-mod-1/
      • 41 replies
    • Fishdom v8.9.2 Jailed Cheats +3
      Modded/Hacked App: Fishdom By PLR Worldwide Sales Limited
      Bundle ID: com.playrix.fishdom-freeplay
      iTunes Store Link: https://apps.apple.com/us/app/fishdom/id664575829?uo=4


      Hack Features:
      - Infinite Moves
      - Infinite Boosters
      - Infinite Lives

      NOTE: Play until you reached level 31 on non-hacked version before using this hack - Make sure you connected with GameCenter and Facebook to save your progress


      iOS Hack Download Link: https://iosgods.com/topic/116586-arm64-fishdom-v683-jailed-cheats-3/
      • 745 replies
    • DomiNation Asia By NEXON Company v12.1470.1471 - [ Currencies Freeze & More ]
      Modded/Hacked App: ドミネーションズ -文明創造- (DomiNations) By NEXON Company
      Bundle ID: com.nexon.dominations.asia
      iTunes Store Link: https://itunes.apple.com/jp/app/ドミネーションズ-文明創造-dominations/id1012778321


      Hack Features:
      - Unlimited Crowns/Food/Oil/Gold -> Resources will add instead of subtracting. Works with Crowns. Read note inside the feature for more information! This does not work for speeding up buildings.
      - All Achievements Unlocked 
      - Freeze Crowns/Food/Oil/Gold -> Freezes Resources so they do not decrease when used! This does not work for speeding up buildings.
      - No Citizen Cost 
      - 0 Cost to Speed Up Training Troops
      - 0 Cost to Speed Up Tactics
      - 0 Food Cost to Train Troops
      - 0 Food Cost to Upgrade Troops
      - No Timer to Upgrade Troops
      - 0 Food Cost to Train Spells
      - 0 General Train Cost
      - No General Train CoolDown
      - 0 Food Cost to Build Wonder
      - 0 Food Cost to Research Troops
      - 0 Food Cost to Upgrade Tactics
      - No Timer to Library Research
      - No Timer to Upgrade Spells
      - 0 Cost to Upgrade Buildings
      - 0 Workers Required to Upgrade
      - 0 Crown Cost For Peace

      This hack works on the latest x64 or ARM64 & ARM64e iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, 8, 8 Plus, X, Xr, Xs, Xs Max, 11, 11 Pro, 11 Pro Max, 12, 12 Pro, 12 Pro Max, 12 Mini, 13, 13 Pro, 13 Pro Max, 13 Mini, 14, 14 Plus, 14 Pro, 14 Pro Max, SE, iPod Touch 6G, 7G, iPad Air, Air 2, iPad Pro & iPad Mini 2, 3, 4, 5, 6 and later.


      Global hack(s): https://iosgods.com/topic/50401-ultrahack-dominations-v6660661-40-cheats-iosgods-exclusive/?tab=comments#comment-1582742
      • 1,093 replies
    • Lands of Jail v1.0.7 [+1 Jailed Cheats]
      Modded/Hacked App: Lands of Jail By SINGAPORE JUST GAME TECHNOLOGY PTE. LTD.
      Bundle ID: com.justgame.jails.global
      App Store Link: https://apps.apple.com/us/app/lands-of-jail/id6738469826?uo=4



      🤩 Hack Features

      - Enemy Can't Attack (Enable Before Enter the Stage)

      • 1 reply
    • Lands of Jail v1.0.7 [+1 Cheats]
      Modded/Hacked App: Lands of Jail By SINGAPORE JUST GAME TECHNOLOGY PTE. LTD.
      Bundle ID: com.justgame.jails.global
      App Store Link: https://apps.apple.com/us/app/lands-of-jail/id6738469826?uo=4



      🤩 Hack Features

      - Enemy Can't Attack (Enable Before Enter the Stage)
       
      • 3 replies
    • Obsidian Knight RPG v1.97 [+3 Jailed Cheats]
      Modded/Hacked App: Obsidian Knight RPG By ActFirst Games AB
      Bundle ID: com.actfirstgames.obsidianknight
      iTunes Store Link: https://apps.apple.com/us/app/obsidian-knight-rpg/id6505061490?uo=4



      🚀 Hack Features

      - Unlimited Currency
      - God Mode / Never Die
      - High Damage / OHK
      • 16 replies
    • Obsidian Knight RPG v1.97 [+3 Cheats]
      Modded/Hacked App: Obsidian Knight RPG By ActFirst Games AB
      Bundle ID: com.actfirstgames.obsidianknight
      iTunes Store Link: https://apps.apple.com/us/app/obsidian-knight-rpg/id6505061490?uo=4

       

      🚀 Hack Features

      - Unlimited Currency
      - God Mode / Never Die
      - High Damage / OHK
      • 21 replies
    • Z Survivor: Backpack Shooter v0.59 [+2 Cheats]
      Modded/Hacked App: Z Survivor: Backpack Shooter By Tapped Ltd
      Bundle ID: com.tapped.zsurvivor
      iTunes Store Link: https://apps.apple.com/us/app/z-survivor-backpack-shooter/id6557072922?uo=4



      🤩 Hack Features

      - Debug Menu (Auto Play, Skip Level and more)
      - Never Die
      - Unlimited Resource (Currency, Keys, Blueprints)
      • 5 replies
    • Z Survivor: Backpack Shooter v0.59 [+2 Jailed Cheats]
      Modded/Hacked App: Z Survivor: Backpack Shooter By Tapped Ltd
      Bundle ID: com.tapped.zsurvivor
      iTunes Store Link: https://apps.apple.com/us/app/z-survivor-backpack-shooter/id6557072922?uo=4



      🤩 Hack Features

      - Debug Menu (Auto Play, Skip Level and more)
      - Never Die
      - Unlimited Resource (Currency, Keys, Blueprints)
      • 5 replies
    • Kingdom Survivors v1.0720 [+4 Cheats]
      Modded/Hacked App: Kingdom Survivors By a plant standing on a chair Game Studio HB
      Bundle ID: com.DefaultCompany.MonsJacobSurvivorGame
      iTunes Store Link: https://apps.apple.com/us/app/kingdom-survivors/id1662497248?uo=4



      🚀 Hack Features

      - Never Die
      - Gain Exp (Toggle On gives you exp in battle)
      - Unlock All Characters
      - Add Currency
      • 16 replies
    • Kingdom Survivors v1.0720 [+4 Jailed Cheats]
      Modded/Hacked App: Kingdom Survivors By a plant standing on a chair Game Studio HB
      Bundle ID: com.DefaultCompany.MonsJacobSurvivorGame
      iTunes Store Link: https://apps.apple.com/us/app/kingdom-survivors/id1662497248?uo=4



      Hack Features:

      - Never Die
      - Gain Exp (Toggle On gives you exp in battle)
      - Unlock All Characters
      - Add Currency

      • 12 replies
    • Dwarf Kingdom - Idle Survival v5.2 Debug Menu [+6 Jailed Cheats]
      Modded/Hacked App: Dwarf Kingdom - Idle Survival By PAPER PIGEON YAZILIM VE OYUN GELISTIRME LIMITED SIRKETI
      Bundle ID: com.PaperPigeon.DwarfKingdom
      iTunes Store Link: https://apps.apple.com/us/app/dwarf-kingdom-idle-survival/id6477745778?uo=4



      🤩 Hack Features

      - Debug Menu (Enable cheat and debug menu will open)
       
      • 4 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