本文へスキップ
Skillpedia
モバイルアプリ6.5k · #14108

il2cpp

できること

このガイドは、ゲームのロジックをネイティブコードに隠すIL2CPPでコンパイルされたUnityゲームの分析を扱います。自社のライセンスや購入の確認をテストしたいゲーム開発者向けです。

使う場面

  • ✓ゲーム開発者が、アプリ内購入の確認を回避できないか確認したいとき。
  • ✓Unityゲームのロジックが保護されており、チームがクライアント側の確認をテストしたいとき。
  • ✓デバイス上でのみ動くライセンス確認があり、レビューが必要なとき。

スキルのリンク

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/mobile/android/il2cpp/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/mobile/android/il2cpp/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私たちのUnityゲームはIL2CPPを使っています。デバイス上で購入の確認を回避できないか確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントはゲームのメタデータから読める記号を復元し、購入とライセンスのロジックをレビューします。サーバー側へ移すべきクライアント側の確認を報告します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Unity IL2CPP Game Reversing Playbook

Unity IL2CPP compiles C# to C++ then to native libil2cpp.so. The managed bytecode is stripped — jadx and apktool expose only the thin Java bootstrap and reveal nothing of game logic. This playbook recovers readable symbols and hooks runtime methods for license/IAP bypass and vulnerability assessment.

Prerequisites

Step 1: Identify Unity IL2CPP App

unzip -o base.apk -d /tmp/apk-out/

# Confirm IL2CPP backend
ls /tmp/apk-out/lib/arm64-v8a/
# Must contain: libil2cpp.so

ls /tmp/apk-out/assets/bin/Data/Managed/Metadata/
# Must contain: global-metadata.dat

# If only libmono.so present → Mono backend (smali/jadx works; this skill N/A)
# If libil2cpp.so present but no global-metadata.dat → encrypted/obfuscated (go to Step 5)

file /tmp/apk-out/lib/arm64-v8a/libil2cpp.so
# output: ELF 64-bit LSB shared object, ARM aarch64

Step 2: Recover Symbols with Il2CppDumper

# Extract libs from APK
cp /tmp/apk-out/lib/arm64-v8a/libil2cpp.so /tmp/
cp /tmp/apk-out/assets/bin/Data/Managed/Metadata/global-metadata.dat /tmp/

# Run Il2CppDumper (mono CLI on Linux/macOS)
mono Il2CppDumper.exe /tmp/libil2cpp.so /tmp/global-metadata.dat /tmp/dump-output/

# Windows .NET:
# Il2CppDumper.exe <libil2cpp.so> <global-metadata.dat> <output-dir>

Output files:

File Content
dump.cs All C# class/method/field definitions with offsets
script.json Machine-readable symbol map (used by IDA/Ghidra scripts)
il2cpp.h C-style struct definitions for IL2CPP internals
stringliteral.json All managed string literals with addresses
# Quick scan of dump.cs for interesting classes
grep -i "licen\|premium\|iap\|purchase\|unlock\|cheat\|anti\|integrity" /tmp/dump-output/dump.cs | head -30

# Find method offsets for hooks
grep -A2 "IsPremium\|CheckLicense\|VerifyReceipt\|IsSubscribed" /tmp/dump-output/dump.cs
# Output: // RVA: 0x<offset>  — this is the function RVA in libil2cpp.so

Step 3: Apply Symbols in Ghidra / IDA

Ghidra (via MCP ghidra server — batch mode)

# 1. Import libil2cpp.so into Ghidra project
# 2. Run auto-analysis (aarch64)
# 3. Execute the Il2CppDumper Ghidra script:
#    Script: ghidra_with_struct.py  (from Il2CppDumper/tools/)
#    Input: script.json + il2cpp.h
# 4. All methods now have their managed C# names
# Command-line Ghidra headless analysis + script
"$GHIDRA_HOME/support/analyzeHeadless" /tmp/ghidra-project IL2CPP \
  -import /tmp/libil2cpp.so \
  -postScript ghidra_with_struct.py /tmp/dump-output/script.json \
  -processor AARCH64:LE:64:v8A \
  -noanalysis

IDA (host-side)

# In IDA scripting console (Python):
# Run ida_with_struct_py3.py from Il2CppDumper/tools/
# File → Script File → ida_with_struct_py3.py
# Provide path to script.json when prompted
# IDA applies all function names + struct types

After symbol restore, navigate to IsPremiumUser, CheckLicense, VerifyIAP, IsCheatDetected, etc. by name.

Step 4: Frida Runtime Hooking

Hook via RVA from dump.cs

// Read RVA from dump.cs comment line: // RVA: 0x<hex>
// Base address of libil2cpp.so changes per run; use Module.findBaseAddress

var il2cpp_base = Module.findBaseAddress("libil2cpp.so");

// Example: hook IsPremiumUser at RVA 0x1A4F80
var RVA = 0x1A4F80;
var isPremium = il2cpp_base.add(RVA);

Interceptor.attach(isPremium, {
    onEnter: function(args) {
        console.log("[+] IsPremiumUser called");
    },
    onLeave: function(retval) {
        console.log("[+] Original return:", retval.toInt32());
        retval.replace(ptr(1));  // return true
        console.log("[+] Replaced with: 1");
    }
});
# Load hook script
frida -U -f com.unity.targetgame -l hook-il2cpp.js --no-pause

Static libil2cpp.so patch (persistent, no Frida needed)

# Patch return value of IsPremiumUser at computed file offset
python3 - <<'EOF'
i
よくある質問

IL2CPPとは何ですか?

Unityが、C#のコードをネイティブコードにコンパイルする仕組みです。そのためゲームのロジックは読みにくくなります。

なぜクライアント側の確認が問題になるのですか?

デバイス上だけで動く確認は書き換えられうるため、サーバーで確認すべきだとガイドは示唆しています。

誰が対象ですか?

自社のタイトルをテストするゲーム開発者です。

詳細

作者による元の説明

Unity IL2CPP game reversing — Il2CppDumper metadata recovery, global-metadata.dat decryption, IDA/Ghidra symbol restore via generated scripts, Frida method hooking, IAP/license bypass, and zygisk-il2cpp-dumper for obfuscated metadata.

repo: BitterSecurity/Decepticon

人気

GitHubのスター
6.5k
ランキング
#14108
ライセンス
Apache-2.0
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル