wechat-send-architecture-analysis.md
2.25 KB
WeChat Send Message Attack Surface Analysis
Date: 2026-06-30 WeChat: 8.0.74, Android 16 Device: Pixel 10 Pro Fold, Magisk root
Architecture
Java UI: ChattingUI → sk.p0(String msg, int type, String extra)
↓ writes message to EnMicroMsg.db (status=2, history only)
mars JNI: libMMProtocalJni.so
↓ protobuf serialize + ECDH/AES encrypt
mars Core: libmarscomm.so (task scheduling), libmarsquic.so (QUIC)
↓ TCP/QUIC long connection
WeChat MM Server
DB Injection: BLOCKED
The message table is history-only. mars uses in-memory task queue.
Evidence:
- No message rows with status=0 or 1 (pending/sending) exist
- All outgoing text messages are status=2 (sent) or 3 (delivered)
massendinfotable IS a media upload queue but empty for text
Status Codes
| status | isSend | Meaning |
|---|---|---|
| 2 | 1 | Sent |
| 3 | 0/1 | Delivered |
| 4 | 0 | System/other |
| 6 | 0 | Special state |
Native Libraries
| Library | Role |
|---|---|
| libMMProtocalJni.so | JNI bridge |
| libmarscomm.so | Task queue, scheduling |
| libmarsquic.so | QUIC transport |
| libproto.so | Protobuf encode/decode |
| libProtobufLite.so | Protobuf lite |
Attack Vectors
Path A: DB Injection — BLOCKED
mars uses in-memory queue. INSERT into message table = history only, won't trigger send.
Path B: LSPosed Hook sk.p0() — VIABLE
Entry: com.tencent.mm.ui.chatting.component.sk.p0(String msg, int type, String extra)
Skeleton: /data/data/com.termux/files/home/WeChatHook/
Risk: Low (Xposed tolerated by WeChat historically)
Path C: mars Queue Injection — NEEDS FRIDA
Hook libmarscomm.so task queue start function.
Risk: High (WeChat anti-Frida detection is commercial-grade)
Path D: HTTP Fallback — UNLIKELY
WeChat core messaging goes through mars. HTTP is for secondary features. Risk: Very Low
Path E: Frida Native Full RE — HIGHEST RISK
Full protocol reverse engineering. Risk: Extreme (MTP/Sec SDK actively hunts Frida)
Auth Assets
| Asset | Source | Value |
|---|---|---|
| UIN | auth_info_key_prefs.xml | 215004919 |
| Auth Key | auth_info_key_prefs.xml | Protobuf binary |
| Server ID | auth_info_key_prefs.xml | 90031802... |
| DB Key | SQLCipher, derived from IMEI+UIN | Varies |