Jump to content

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


132 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 276
  • Winner 22
  • Thanks 26
  • Haha 6
  • Agree 8
  • Informative 21
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

    • Universe Invader 2: Alien War v1.0.8 [ +12 Cheats ] Currency Max
      Modded/Hacked App: Universe Invader 2: Alien War By GCENTER VIET NAM TECHNOLOGY JOINT STOCK COMPANY
      Bundle ID: com.GCenter.com.universe.invaders.alien.war.attack.V2
      App Store Link: https://apps.apple.com/us/app/universe-invader-2-alien-war/id6739988487?uo=4

       
      🤩 Hack Features

      - Auto Win

      - ViP Point

      - Gems

      - Coins

      - Energy

      - Booster

      - Keys +2

      - Life

      - DMG

      - Zone Unlock [ No Need Star ]

      - Ship & Dron Unlock Cost 0
      • 0 replies
    • Universe Invader 2: Alien War v1.0.8 [ +12 Jailed ] Currency Max
      Modded/Hacked App: Universe Invader 2: Alien War By GCENTER VIET NAM TECHNOLOGY JOINT STOCK COMPANY
      Bundle ID: com.GCenter.com.universe.invaders.alien.war.attack.V2
      App Store Link: https://apps.apple.com/us/app/universe-invader-2-alien-war/id6739988487?uo=4


      🤩 Hack Features

      - Auto Win

      - ViP Point

      - Gems

      - Coins

      - Energy

      - Booster

      - Keys +2

      - Life

      - DMG

      - Zone Unlock [ No Need Star ]

      - Ship & Dron Unlock Cost 0
      • 0 replies
    • Solo Leveling:Arise v1.2.77 Jailed Cheats +2
      Modded/Hacked App: Solo Leveling:Arise By Netmarble Corporation
      Bundle ID: com.netmarble.sololv
      iTunes Store Link: https://apps.apple.com/us/app/solo-leveling-arise/id1662742277?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Immunte to Physical Damage
      - Multiply Attack



      iOS Hack Download IPA Link: https://iosgods.com/topic/184739-solo-levelingarise-v1265-jailed-cheats-2/
      • 395 replies
    • Agar.io v2.30.2 Jailed Cheats +1
      Modded/Hacked App: Agar.io by Miniclip SA
      Bundle ID: com.miniclip.agar.io
      iTunes Store Link: https://itunes.apple.com/us/app/agar-io/id995999703?mt=8&uo=4&at=1010lce4



      Hack Features:
      - Normal Mode Zoom Hack - Tested with value 0.08 - More Zoom = More Small Value
      - BR Mode Zoom Hack - Tested with value 0.08 - More Zoom = More Small Value


      Hack Download Link: https://iosgods.com/topic/82572-arm64-agario-v230-jailed-cheats-1/
      • 1,262 replies
    • [ Arknights China ] 明日方舟 Cheats v2.6.01 +8
      Modded/Hacked App: 明日方舟 By Shanghai Hypergryph Network Technology Co., Ltd.
      Bundle ID: com.hypergryph.arknights
      iTunes Store Link: https://apps.apple.com/cn/app/%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F/id1454663939?uo=4


      Hack Features:
      - God Mode
      - Frozen Enemies
      - One Hit Kill
      - Instant - Win
      - No Deploy Cost
      - Multiply Damage
      - Multiply Defense
      - Multiply Character Speed


      iOS Hack Download Link: https://iosgods.com/topic/149509-arknights-china-%E6%98%8E%E6%97%A5%E6%96%B9%E8%88%9F-cheats-v1560-8/
      • 310 replies
    • PewDiePie's Tuber Simulator Cheats v2.55.0 +3
      Modded/Hacked App: PewDiePie's Tuber Simulator By Outerminds Inc.
      Bundle ID: com.outerminds.tubular
      iTunes Store Link: https://apps.apple.com/us/app/pewdiepies-tuber-simulator/id1093190533?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 Subscriber
      - Infinite Views
      - Infinite Bux

      NOTE: Please complete tutorial first before enabling the hacks otherwise it won't work

      NOTe 2: Please make a youtube video to get some views first (without hack) then before enable infinite views

       

      Non-Jailbroken Hack: https://iosgods.com/topic/86411-pewdiepies-tuber-simulator-v2450-jailed-cheats-3/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/86366-pewdiepies-tuber-simulator-cheats-v2460-3/
      • 1,155 replies
    • Battle Legion - Mass Battler Cheats v4.3.8 +4
      Modded/Hacked App: Battle Legion - Mass Battler By GODSPEED GAMING SOLUTIONS PRIVATE LIMITED
      Bundle ID: com.traplight.battleslides
      iTunes Store Link: https://apps.apple.com/us/app/battle-legion-mass-battler/id1435133042?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

      - Multiply Attack
      - Multiply Defense
      - Instant Win
      - Enemies Don't Move
      - Enemies Don't Attack

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/129669-battle-legion-mass-battler-cheats-v424-4/
      • 574 replies
    • Honkai Impact 3 (SEA) Cheats v8.3.0 +2 [ Multiply Attack & Defense ]
      Modded/Hacked App: Honkai Impact 3 By COGNOSPHERE PTE. LTD.
      Bundle ID: com.miHoYo.bh3oversea
      iTunes Store Link: https://apps.apple.com/ph/app/honkai-impact-3/id1299582178?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

      - Multiply Attack
      - Multiply Defense

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/134285-honkai-impact-3-sea-cheats-v810-2-multiply-attack-defense/
      • 496 replies
    • SnapEdit - Remove Objects AI Modded v5.9.4 +1
      Modded/Hacked App: SnapEdit - Remove Objects AI By SilverAI Joint Stock Company
      Bundle ID: com.sfun.snapedit
      App Store Link: https://apps.apple.com/us/app/snapedit-remove-objects-ai/id1611282499?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

      - PREMIUM

       

      Free Non-Jailbroken Hack: https://iosgods.com/topic/197205-snapedit-remove-objects-ai-v594-jailed-mod-1/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/175364-snapedit-remove-objects-ai-modded-v594-1/
      • 97 replies
    • Subnautica v1.21.82617 +100++ Jailed Cheats [ Developer Menu ]
      Modded/Hacked App: Subnautica By Unknown Worlds Entertainment, Inc.
      Bundle ID: com.UnknownWorlds.Subnautica
      App Store Link: https://apps.apple.com/us/app/subnautica/id6478639011?uo=4

       
       

      🤩 Hack Features

      - Developer Menu -> Pause the game and you will see a Developer Menu button.

      For all developer commands, go here.
      • 5 replies
    • Subnautica v1.21.82617 +100++ Cheats [ Developer Menu ]
      Modded/Hacked App: Subnautica By Unknown Worlds Entertainment, Inc.
      Bundle ID: com.UnknownWorlds.Subnautica
      App Store Link: https://apps.apple.com/us/app/subnautica/id6478639011?uo=4

       


      🤩 Hack Features

      - Developer Menu -> Pause the game and you will see a Developer Menu button.

      For all developer commands, go here..
      • 4 replies
    • Dawn of Ages: Medieval Games v2.0.8 +5 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Dawn of Ages: total war battle By BoomBit, Inc.
      Bundle ID: com.stratospheregames.dawnofages
      App Store Link: https://apps.apple.com/us/app/dawn-of-ages-total-war-battle/id6477473268?uo=4

       


      🤩 Hack Features

      - Damage Multiplier
      - Defence Multiplier
      - God Mode
      - Dumb Enemy
      - Premium Enabled
      • 12 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