Jump to content

How to dump Il2Cpp-based Unity Games to find functions + offsets to hack (iOS)


28 posts in this topic

Recommended Posts

Updated (edited)

yPzDzQO.png

As requested, here is the tutorial how to dump il2cpp of iOS Unity games. With Il2CppDumper, it will be much easier to find useful functions and offsets to hack. No need to waste your time debugging the game.

Requirements:

- ARM/ASM knowledge

- IDA hacking experience

- IDA Pro. Download link

- Notepad++. Download link

- Il2CppDumper (Windows). Download link

- Clutch or Rasticrac for jailbroken devices or visit appvn.com to download latest cracked free games

- Winrar or 7-zip to open .ipa file

 

Instructions:

Download Il2CppDumper released version by Perfare and extract the program

 

To open .ipa file, simply rename file extension to .zip and open it

If you are using 7-zip, right click -> 7-zip -> Open Archive to open .ipa file directly

ySZdlPx.png

 

Navigate to \Payload\<app or game name>.app\ and extract the big binary file that doesn't have file extension

Navigate to \Payload\iosfps.app\Data\Managed\Metadata\ and extract global-metadata.dat

 

32-bit:

Press 1 for 32-bit and press 2 for auto. Please use Auto mode to get the program to find offsets and dump code for you because looking for 2 required pointers (CodeRegistration and MetadataRegistration) in IDA Pro to dump is too complicated and Unity already stripped all names of functions which means it will be harder to find,

As you used auto mode, the program will tell the pointers, but you do not need to know it if you have no idea what it is.

 

Skip 64-bit steps if you are working with 32-bit

 

64-bit:

Auto mode does not work on 64-bit binary yet. Here is dev's response

"I have to say, these same questions will make me feel that adding auto feature is a bad decision

We have to find 2 required offsets (CodeRegistration and MetadataRegistration) in IDA to dump. Open IDA Pro 64-bit (idaq64.exe), and disassemble the binary in 64-bit. Search function name InitFunc_1.

Above InitFunc_1, there is sub function that contains 2 pointers we need.

sub_100C46D8C                           ; DATA XREF: InitFunc_1+8o

                 ADRP            X0, #unk_101D48FE8@PAGE

                 ADD             X0, X0, #unk_101D48FE8@PAGEOFF

                 ADRP            X1, #dword_101D948C8@PAGE

sSkslSi.png

In Il2CppDumper, Press 2 for 64-bit and Press 1 for manual. Input your pointers:

Input CodeRegistration(X0): your first pointer

Input MetadataRegistration(X1): your second pointer

 

The dump.cs file should be created at the location where Il2CppDumper.exe is located

 

Open dump.cs with Notepad++ by right click and select Edit with Notepad++

Inside dump.cs, you'll see C# codes. Method bodies are not dumped but it's a very simple code that tells you function names and offsets to mod.

 

 

launch Il2CppDumper.exe. It will open the dialog twice to select file. For ELF file or Mach-O file, select the binary file. For global-metadata.dat, select global-metadata.dat

 

It will ask you to select platform, 32-bit or 64-bit. Press 1 for 32-bit or press 2 for 64-bit. Now for Mode, Press 1 for manual and press 2 for auto. Please use Auto mode to get the program to find offsets and dump code for you because looking for 2 required offsets (CodeRegistration and MetadataRegistration) in IDA Pro to dump is too complicated and Unity already stripped all names of functions which means it will be harder to find, and I haven't find out where to find 2 offsets in 64-bit binary yet. As you used auto mode, the program will tell the offsets, but you do not need to know it if you have no idea what it is.

 

The dump.cs file should be created at the location where Il2CppDumper.exe is located

 

Open dump.cs with Notepad++ by right click and select Edit with Notepad++

Inside dump.cs, you'll see C# codes. Method bodies are not dumped but it's a very simple code that tells you function names and offsets to mod.

 

To search, click Search -> Find...

To find all keyword, click on Find All in Current Document

 lnwqXUy.png

If you never seen C# code before, I'll explain a bit what the codes mean. I'm bad at explaining what these code means but I hope it goes well

This comment you see on top is just a list .dll files that are been converted into il2cpp

// Image 0: mscorlib.dll - 0

// Image 1: System.Security.dll - xxxx

// Image xx: Assembly-CSharp.dll - xxxx

The Assembly-CSharp.dll (Android users know this) is a game logic thing and it is what we looking for. The full code of "Assembly-CSharp.dll" thingy is always located somewhere at the bottom of the dumped file

 

This class body is like a group to make programmers easier to find codes. For example PlayerAntiHack class contains anti-hack code related.

// Namespace:

public class PlayerScript : MonoBehaviour // TypeDefIndex: 4303

{

}

 

In IDA you'll probarly see function names like

Player::Get_Gold…

Player::Get_Cash…

Player::Isbanned…

….

 

I'll bring this better details for you:

A class is a construct that enables you to create your own custom types by grouping together variables of other types, methods and events. A class is like a blueprint. It defines the data and behavior of a type. ... Unlike structs, classes support inheritance, a fundamental characteristic of object-oriented programming.

 

In the class, you'll see something like this:

// Fields

private int primaryWeaponIndex; // 0x10

private float minSpread; // 0x820

private float spread; // 0x824

private float visualSpread; // 0x828

….

 

Fields is not what we looking for so let's look into Methods.

 

// Methods

private int findNextAvailableWeapon(int currentWeaponIndex); // 1e704c

private bool IsLookingAtPlayer(PlayerScript player); // 1f3894

public bool HasBeenVisible(); // 1f2fa0

….

public int get_Gold_Example(); // 1a2b3c

public float float_example(); // 1a2b3d

….

 

This is what we looking for. These simple codes explains the name of the methods/functions, what type and the REAL IDA OFFSETS are written in the green commenented text.

 

public, private, protected etc, are access modifier. It's not important to know

static is a static modified to declare a static member. It's not important to know

int, float, double, boolean etc are data type.

 

If you look up the offset in IDA, you will see a sub_xxxxxx

vePK7YP.png

 

Write down all useful functions + offsets you found inside the dumped .cs file and start writing your code injection.

 

Note: It is suggested that you disassemble the binary file and look up the offsets to see if there are enough spaces to replace the instructions to hack.

 

That's all. Good luck hacking iOS games!

Credits:

AndnixSH#

Perfare (Il2CppDumper https://github.com/Perfare/Il2CppDumper)

 

If you have any issues with Il2CppDumper, please report the issue at: https://github.com/Perfare/Il2CppDumper/issues/

Updated by AndnixSH
  • Like 11
  • Winner 2
  • Thanks 1
  • Informative 2
Posted (edited)

First of all, thank you very very much for this tutorial.
I was wondering if you have an example Tweak.xm for a game with how to hook the class functions.

I have found the following info for the game I am trying to 'hack'

// Namespace: IAS.Proto
public class ItemDefinition : IExtensible // TypeDefIndex: 3153
{

	// Methods
	public void .ctor(); // 100dbd3f8
	public int get_water(); // 100dbd5c0
	public void set_water(int value); // 100dbd5c8
	public int get_premium(); // 100dbd600
	public void set_premium(int value); // 100dbd608
}

In IDA I have the following code on offset 100dbd5c0:
__text:0000000100DBD5C0 sub_100DBD5C0                           ; CODE XREF: sub_1002E1114+378↑p
__text:0000000100DBD5C0                                         ; sub_100DD1FF8+A88↓p
__text:0000000100DBD5C0                                         ; DATA XREF: ...
__text:0000000100DBD5C0                 LDR             W0, [X0,#0x70]
__text:0000000100DBD5C4                 RET
__text:0000000100DBD5C4 ; End of function sub_100DBD5C0

Which translates to the following pseudocode:
__int64 __fastcall sub_100DBD5C0(__int64 a1)
{
  return *(unsigned int *)(a1 + 112);
}

What I want is to display the current value (so I know I am in the right place) and then hook the set_ functions to set a new value.

I am hoping you can help me.
If you need more info please let me know.

 

[edit]

In my search of more tools I stumbled across something interesting.

https://github.com/nevermoe/unity_metadata_loader

This little tool lets you add the strings from the global*.dat file directly into IDA which makes searching easiere :)

Updated by QuasaR
Posted (edited)
19 hours ago, QuasaR said:

First of all, thank you very very much for this tutorial.
I was wondering if you have an example Tweak.xm for a game with how to hook the class functions.

I have found the following info for the game I am trying to 'hack'

What I want is to display the current value (so I know I am in the right place) and then hook the set_ functions to set a new value.

I am hoping you can help me.
If you need more info please let me know

[edit]

In my search of more tools I stumbled across something interesting.

https://github.com/nevermoe/unity_metadata_loader

This little tool lets you add the strings from the global*.dat file directly into IDA which makes searching easiere :)

If there is no class names in ida, you can't hook the class function. do code injection instead. 

There are lot of tutorials in iosgods. Just search and search

Nevermoe's loader is unstable

Updated by evildog1
Posted (edited)

Ok, but code injection mostly assumes it's a mov /add instruction and about R registers, not W or X and not an STR instructionlike in the following example (set_water):

__text:0000000100DBD5C0                 LDR             W0, [X0,#0x70]
__text:0000000100DBD5C4                 RET
__text:0000000100DBD5C4 ; End of function ItemDefinition$$get_water
__text:0000000100DBD5C4
__text:0000000100DBD5C8
__text:0000000100DBD5C8 ; =============== S U B R O U T I N E =======================================
__text:0000000100DBD5C8
__text:0000000100DBD5C8
__text:0000000100DBD5C8 ItemDefinition$$set_water               ; CODE XREF: ProtoSerializer$$Read_85953+C5C↓p
__text:0000000100DBD5C8                                         ; DATA XREF: __const:00000001022EB878↓o
__text:0000000100DBD5C8                 STR             W1, [X0,#0x70]
__text:0000000100DBD5CC                 RET
__text:0000000100DBD5CC ; End of function ItemDefinition$$set_water
__text:0000000100DBD5CC

 

The set_water is called from the following code:

__text:0000000100DDF618 loc_100DDF618                           ; CODE XREF: ProtoSerializer$$Read_85953+698↑j
__text:0000000100DDF618                 MOV             X0, X21
__text:0000000100DDF61C                 MOV             X2, #0
__text:0000000100DDF620                 BL              ItemDefinition$$set_water
__text:0000000100DDF624                 B               loc_100DDFB00
__text:0000000100DDF628 ; ---------------------------------------------------------------------------

 

Updated by QuasaR
Posted
51 minutes ago, QuasaR said:

Ok, but code injection mostly assumes it's a mov /add instruction and about R registers, not W or X and not an STR instructionlike in the following example (set_water)

The set_water is called from the following code:

 

Sorry but I'm not familiar with code injection. Please create a new thread to ask question. Thank you

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

    • Eternium Cheats v1.37.7 +11
      Modded/Hacked App: Eternium By Making Fun, Inc.
      Bundle ID: com.makingfun.mageandminions
      iTunes Store Link: https://apps.apple.com/us/app/eternium/id579931356?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

      - 5K Gems When Completed Stage
      - Infinite Gold
      - Infinite Cosmetic
      - Infinite Yellow Stone
      - Multiply Attack (Linked with Enemy)
      - No Skills Cooldown
      - No Consumable Cooldown
      - Multiply Attack Speed
      - Instant Regen Health
      - Always Crit
      - Material Drops (When you killed an Enemy it will drop materials for crafts)



      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/194526-eternium-cheats-v13355-6/
        • Informative
        • Agree
        • Winner
        • Like
      • 75 replies
    • Candy Crush Saga v1.304.1 Jailed Cheats +3
      Modded/Hacked App: Candy Crush Saga By King.com Limited
      Bundle ID: com.midasplayer.apps.candycrushsaga
      iTunes Store Link: https://apps.apple.com/us/app/candy-crush-saga/id553834731?uo=4


      Hack Features:
      - Infinite Life
      - Infinite Booster
      - Infinite Move


      Jailbreak required hack(s): https://iosgods.com/topic/190447-candy-crush-saga-cheats-v12941-3/


      iOS Hack Download IPA Link: https://iosgods.com/topic/190448-candy-crush-saga-v12941-jailed-cheats-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 96 replies
    • [ JP / Global/ KR] Puzzle & Dragons Cheats v22.3.0 +3
      Modded/Hacked App: Puzzle & Dragons (English) by GungHo Online Entertainment, INC.
      Bundle ID: jp.gungho.padEN
      iTunes Store Link: https://apps.apple.com/us/app/puzzle-dragons-english/id563474464?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK
      - Frozen Enemies


      iOS Hack Download Link: https://iosgods.com/topic/133984-puzzle-dragons-jp-english-cheats-all-versions-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 454 replies
    • DomiNation Asia By NEXON Company v12.1480.1481 - [ 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
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,100 replies
    • DomiNations v12.1480.1481 +40++ Cheats [ Exclusive ]
      Modded/Hacked App: DomiNations by NEXON M Inc.
      Bundle ID: com.nexonm.dominations
      iTunes Store Link: https://itunes.apple.com/us/app/dominations/id922558758


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iFile / Filza / iFunBox / iTools or any other file managers for iOS.
      - Cydia Substrate (from Cydia).
      - PreferenceLoader (from Cydia).


      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 Citizens Cost
      - Place Multiple of Same Building
      - 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
      This hack is an In-Game Mod Menu (iGMM). In order to activate the Mod Menu, tap on the iOSGods button found inside the app.
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 4,984 replies
    • Monster Legends: Collect all Cheats v17.9.5 +8
      Modded/Hacked App: Monster Legends: Merge RPG By Socialpoint
      Bundle ID: es.socialpoint.MonsterCity
      iTunes Store Link: https://apps.apple.com/us/app/monster-legends-merge-rpg/id653508448?uo=4

       

      📌 Mod Requirements

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

       

      🤩 Hack Features

      - 1 Hit Kill
      - Skip Enemy Turn
      - Multiply Attack
      - Multiply Defense
      - Insane Score (Always 3 Stars)
      - No Skill Cost
      - Auto Win
      - Auto Play Battle Enabled for All Maps


      🍏 For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/topic/140543-monster-legends-collect-all-v1778-5-cheats-for-jailed-idevices/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/176914-monster-legends-collect-all-cheats-v1779-8/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 339 replies
    • Simply Piano: Learn Piano Fast Modded v9.10.14 +1
      Modded/Hacked App: Simply Piano: Learn Piano Fast By Simply Ltd
      Bundle ID: com.joytunes.asla
      iTunes Store Link: https://apps.apple.com/us/app/simply-piano-learn-piano-fast/id1019442026?uo=4


      Hack Features:
      - PREMIUM
       

      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/68652-simply-piano-v975-jailed-mod-1/


      Hack Download Link: https://iosgods.com/topic/83369-simply-piano-learn-piano-fast-modded-all-versions-1/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 1,540 replies
    • [ Chiikawa Pocket JP ] ちいかわぽけっと v1.2.0 Jailed Cheats +3
      Modded/Hacked App: ちいかわぽけっと By Applibot Inc.
      Bundle ID: jp.co.applibot.chiikawapocket
      iTunes Store Link: https://apps.apple.com/jp/app/%E3%81%A1%E3%81%84%E3%81%8B%E3%82%8F%E3%81%BD%E3%81%91%E3%81%A3%E3%81%A8/id6596745408?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
      - Multiply Attack
      - Custom Speed (Customize before Login or Clear stage to get apply)

       

      ⬇️ iOS Hack Download IPA Link: https://iosgods.com/topic/194281-chiikawa-pocket-jp-%E3%81%A1%E3%81%84%E3%81%8B%E3%82%8F%E3%81%BD%E3%81%91%E3%81%A3%E3%81%A8-v1111-jailed-cheats-3/
        • Haha
        • Like
      • 23 replies
    • Chiikawa Pocket Cheats v1.2.0 +3
      Modded/Hacked App: Chiikawa Pocket By Applibot Inc.
      Bundle ID: jp.co.applibot.chiikawapocketgl
      iTunes Store Link: https://apps.apple.com/us/app/chiikawa-pocket/id6740838442?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

      - God Mode
      - Multiply Attack

       

      Non-Jailbroken Hack: https://iosgods.com/topic/193718-chiikawa-pocket-v111-jailed-cheats-2/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/193717-chiikawa-pocket-cheats-v111-2/
        • Informative
        • Haha
        • Thanks
        • Winner
        • Like
      • 40 replies
    • Loot Heroes v1.6.2 +8 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Loot Heroes: Fantasy RPG Games By BoomBit, Inc.
      Bundle ID: com.bbp.lootheroes
      iTunes Store Link: https://apps.apple.com/us/app/loot-heroes-fantasy-rpg-games/id6642699678?uo=4


      Hack Features:
      - Freeze Currencies
      - Unlimited Currencies [ VIP ]
      - God Mode -> Traps still cause damage.
      - One-Hit Kill
      - All Heroes Unlocked
      - Auto Win [ VIP ]
      - Battle Pass Unlocked [ VIP ]


      Jailbreak required hack(s): [Mod Menu Hack] Loot Heroes v1.1.5 +8 Cheats [ Unlimited Currencies + More ] - 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
      • 104 replies
    • Loot Heroes v1.6.3 +8 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Loot Heroes By BoomBit, Inc.
      Bundle ID: com.bbp.lootheroes
      iTunes Store Link: https://apps.apple.com/us/app/loot-heroes/id6642699678?uo=4


      Hack Features:
      - Freeze Currencies
      - Unlimited Currencies [ VIP ]
      - God Mode -> Traps still cause damage.
      - One-Hit Kill
      - All Heroes Unlocked
      - Auto Win [ VIP ]
      - Battle Pass Unlocked [ VIP ]


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      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
      • 244 replies
    • The Seven Deadly Sins Cheats v2.79.0 +5
      Modded/Hacked App: The Seven Deadly Sins by Netmarble Corporation
      Bundle ID: com.netmarble.nanagb
      iTunes Store Link: https://apps.apple.com/us/app/the-seven-deadly-sins/id1475440231?uo=4&at=1010lce4


      Hack Features:
      - God Mode
      - OHK
      - Infinite MP


      iOS Hack Download Link: https://iosgods.com/topic/131686-arm64-the-seven-deadly-sins-cheats-v117-3/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 2,045 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