Analisis Perancangan Anti-Cheat pada Game Unity untuk Mencegah Eksekusi Mod Loader MelonLoader dan BepInEx
Abstrak
Cheat dan modifikasi ilegal pada game berbasis Unity merupakan salah satu tantangan utama dalam pengembangan game multiplayer modern. Framework modding seperti MelonLoader dan BepInEx memungkinkan injeksi kode C# ke dalam runtime game, sehingga mempermudah modifikasi memori, hooking method, patching assembly, dan manipulasi gameplay. Penelitian ini menganalisis teknik perancangan anti-cheat untuk mendeteksi serta mencegah eksekusi mod loader pada game Unity berbasis Mono maupun IL2CPP. Pendekatan yang dibahas meliputi deteksi file loader, memory integrity verification, process scanning, code signing validation, runtime attestation, server-authoritative validation, dan heuristic detection. Hasil analisis menunjukkan bahwa pendekatan hybrid client-server memberikan efektivitas terbaik dibanding hanya mengandalkan proteksi client-side.
Kata kunci: Unity, Anti-Cheat, MelonLoader, BepInEx, IL2CPP, Memory Integrity
1. Pendahuluan
Game modern berbasis Unity sering menjadi target modifikasi karena struktur executable-nya relatif mudah dianalisis, terutama pada build:
Mono backend
IL2CPP backend
Windows desktop build
Tool seperti MelonLoader dan BepInEx dapat melakukan:
DLL injection
Method patching
Runtime hook
Memory patch
Overlay cheat UI
Contoh ancaman:
Infinite health
ESP / wallhack
Speedhack
Currency modification
Cooldown bypass
BepInEx merupakan framework plugin Unity untuk Mono dan IL2CPP.
MelonLoader adalah universal mod loader yang mendukung Unity Mono dan IL2CPP.
2. Arsitektur Cheat pada Unity
Arsitektur cheat pada game Unity umumnya:
Player
↓
Game Process (Unity)
↓
Mod Loader
↓
Injected DLL / Cheat Script
↓
Hooked Game Functions
Contoh alur:
Game dijalankan
Loader ter-load melalui DLL hijacking
Loader melakukan bootstrap
Mod DLL dijalankan
Method game di-hook
3. Unity Runtime Target
3.1 Mono
Pada Unity Mono:
Contoh assembly:
Assembly-CSharp.dll
UnityEngine.dll
Mono sangat rentan terhadap:
dnSpy patching
Harmony patching
Reflection abuse
3.2 IL2CPP
Pada IL2CPP:
File penting:
GameAssembly.dll
global-metadata.dat
Walaupun lebih aman, IL2CPP tetap dapat dimodifikasi oleh MelonLoader dan tool sejenis.
4. Analisis MelonLoader
Struktur umum file:
GameFolder/
├── version.dll
├── dobby.dll
├── MelonLoader/
├── Mods/
├── Plugins/
Ciri khas:
Folder MelonLoader
version.dll
dobby.dll
Console log loader
Loader akan meng-hook runtime saat startup.
5. Analisis BepInEx
Struktur umum:
GameFolder/
├── winhttp.dll
├── BepInEx/
├── doorstop_config.ini
Ciri:
winhttp.dll hijacking
BepInEx folder
Plugin DLL
BepInEx memuat plugin pada startup dan melakukan patch runtime.
6. Desain Sistem Anti-Cheat
Arsitektur yang direkomendasikan:
Unity Client
↓
Anti-Cheat Module
↓
Integrity Scanner
↓
Server Validation
Modul utama:
File Scanner
Process Scanner
Memory Validator
Runtime Checker
Server Authority
7. Metode Deteksi
7.1 File Signature Detection
Deteksi file loader.
Pseudo-code:
string[] suspiciousFiles = {
"version.dll",
"winhttp.dll",
"doorstop_config.ini"
};
foreach (string file in suspiciousFiles)
{
if (File.Exists(file))
FlagCheat();
}
Folder detection:
if (Directory.Exists("MelonLoader"))
FlagCheat();
if (Directory.Exists("BepInEx"))
FlagCheat();
Kelemahan:
7.2 Process Scanning
Scan process yang berjalan.
Contoh:
Process[] processes = Process.GetProcesses();
Cari:
debugger
injector
trainer
memory editor
Heuristic:
KnownCheatTool
MemoryEditor
DLLInjector
7.3 Memory Integrity Check
Validasi section memory executable.
Contoh:
checksum code section
compare hash
SHA256(GameAssembly.dll)
Saat startup:
Expected Hash = ABC123
Current Hash = XYZ999
Mismatch → possible patch.
7.4 Runtime Method Verification
Cek apakah method pointer berubah.
Contoh:
Player.TakeDamage()
Hash IL / native pointer:
Original Pointer = 0x401000
Current Pointer = 0x551000
Jika berubah:
method di-hook
patch terdeteksi
7.5 Module Enumeration
Enumerasi module yang di-load.
Cari:
winhttp.dll
version.dll
custom injector
Pseudo:
foreach (ProcessModule module in Process.GetCurrentProcess().Modules)
{
Log(module.ModuleName);
}
Jika ditemukan:
winhttp.dll
dobby.dll
Tandai suspicious.
7.6 Window Detection
Cheat UI sering memakai overlay.
Deteksi:
external overlay
injected GUI
ImGui
Pattern:
hidden window
transparent overlay
topmost window
8. Server Authoritative Validation
Proteksi terpenting ada di server.
Client tidak boleh dipercaya.
Buruk:
SendDamage(999999);
Server menerima:
player.hp -= damage
Aman:
damage = CalculateServerDamage(player)
Server memverifikasi:
movement
damage
inventory
currency
Unity community juga menekankan bahwa critical logic harus dipindahkan ke server.
9. Heuristic Cheat Detection
Deteksi perilaku abnormal.
Contoh:
speed terlalu tinggi
aim terlalu presisi
impossible reaction time
Rule:
if movement_speed > max_allowed:
suspicious += 1
Threshold:
if suspicious > 5:
ban()
10. Code Obfuscation
Lindungi assembly dari reverse engineering.
Tools:
symbol stripping
metadata encryption
control flow obfuscation
Tujuan:
mempersulit patching
mempersulit hooking
11. Anti-Tamper
Validasi executable saat startup.
Contoh:
Hash(Game.exe)
Hash(GameAssembly.dll)
Hash(global-metadata.dat)
Jika berubah:
Terminate Game
12. Kernel-Level vs User-Level Anti-Cheat
Dua pendekatan:
User-Level
Kelebihan:
Kekurangan:
Kernel-Level
Kelebihan:
deteksi lebih kuat
monitor memory access
Kekurangan:
Beberapa riset menyoroti risiko privasi anti-cheat kernel-level.
13. Pendekatan Hybrid
Pendekatan terbaik:
Client:
file scan
module scan
integrity check
Server:
authority logic
anomaly detection
telemetry analysis
Pipeline:
Client Scanner
↓
Suspicion Score
↓
Server Decision Engine
↓
Warn / Kick / Ban
14. Evaluasi
Perbandingan efektivitas:
| Metode | Akurasi | Overhead | Sulit Dibypass |
|---|
| File Detection | Sedang | Rendah | Rendah |
| Process Scan | Sedang | Rendah | Sedang |
| Integrity Check | Tinggi | Sedang | Tinggi |
| Server Authority | Sangat Tinggi | Tinggi | Sangat Tinggi |
| Kernel Driver | Sangat Tinggi | Tinggi | Sangat Tinggi |
15. Kesimpulan
MelonLoader dan BepInEx merupakan ancaman signifikan bagi game Unity karena memungkinkan modifikasi runtime melalui injection dan hooking. Anti-cheat yang hanya bergantung pada client-side tidak cukup untuk menghadapi cheat modern. Sistem anti-cheat yang efektif harus mengombinasikan:
Pendekatan hybrid client-server memberikan proteksi paling efektif terhadap mod loader modern sekaligus menjaga performa game.
Discussion (0)