Skip to content

[platform] support Linux WMPF 4067695881 (WeChat 4.1.13.9, flatpak) - #272

Open
lnehc wants to merge 1 commit into
evi0s:mainfrom
lnehc:support-linux-4.1.13.9
Open

[platform] support Linux WMPF 4067695881 (WeChat 4.1.13.9, flatpak)#272
lnehc wants to merge 1 commit into
evi0s:mainfrom
lnehc:support-linux-4.1.13.9

Conversation

@lnehc

@lnehc lnehc commented Sep 7, 2026

Copy link
Copy Markdown

What

Support the Linux WMPF runtime shipped with WeChat 4.1.13.9 (tested with flatpak com.tencent.WeChat).

src/platform/linux.ts

  • Select the root WeChatAppEx process by checking that its parent is not another WeChatAppEx process. Newer builds spawn zygote/renderer/gpu/utility children whose ppid points at intermediate nodes, so the ppid frequency heuristic can pick the wrong process (same root cause as [platform] fix linux findWmpfProcess to select root process #271).
  • Fall back to --client_version from /proc/<pid>/cmdline when the embedded ,x.y.z.<version> literal is missing. The 4.1.13+ runtime no longer contains that literal, which made findWmpfProcess throw [frida] error in find wmpf version. Old runtimes still match the literal first, so addresses.14978.json keeps working (version key via client_version follows the proposal in [Feature Request] Support for Linux WMPF (WeChat Linux Desktop) #167).
  • Resolve sandbox paths reported by frida (/app/extra/wechat/...) to host paths via /proc/<pid>/root (works for flatpak/bwrap), so the binary can be read for version detection.

frida/config/linux/addresses.4067695881.json (new)

{
    "Version": 4067695881,
    "LoadStartHookOffset": "0x900eee0",
    "CDPFilterHookOffset": "0xdc1c670",
    "SceneOffsets": [56, 1528, 8, 1464, 16, 456]
}

How the offsets were derived

Built a small static-analysis toolchain (rip-relative xref scan + .eh_frame_hdr function boundaries, stdlib only) and validated it against the known-good 14978 binary (WeChat 4.1.1.8, sha256 c9765e87... as pinned by the flathub manifest) before applying it to the new binary:

anchor 14978 (known config) reproduced on 14978 4.1.13.9 (this PR)
SendToClientFilter string xref -> function (logging func) 0xBCB4C40 0xdc25cd0
hook target = its first call, then cmpl $0x6,0x8(%rax) 0xBCAAFD0 yes, exact 0xdc1c670
applet_index_container.cc full-path xref -> OnLoadStart 0x8320180 yes, exact 0x900eee0
OnLoadStart tail test %r14b; mov 0x38(%rbx); mov 0x50(%rbx); mov 0x550(%rax); mov 0x38(%rcx); call yes, exact test %r14b; mov 0x38(%rbx); mov 0x40(%rbx); mov 0x5f8(%rax); mov 0x38(%rcx); call
callee deref chain (SceneOffsets) +8, +0x520, +0x10, cmpl $0x44d,0x1e8 -> [56,1360,8,1312,16,488] yes, exact +8, +0x5b8, +0x10, cmpl $0x44d,0x1c8 -> [56,1528,8,1464,16,456]

0x44d = 1101: both runtimes compare the scene value against the debug scene themselves - exactly the value this hook forces.

Verified

  • flatpak com.tencent.WeChat 4.1.13.9 (--client_version=4067695881), Linux x86_64
  • hook loads without crashing; opening a miniapp logs [hook] scene: 1027 (rewritten to 1101) and [patch] CDP filter patched fires repeatedly
  • DevTools connects via devtools://devtools/bundled/inspector.html?ws=127.0.0.1:62000

Note: partially overlaps with #271 (root process selection) - happy to rebase or split if preferred.

- select the root WeChatAppEx process by checking that its parent is
  not another WeChatAppEx process; newer builds spawn zygote/renderer/
  gpu/utility children whose ppid points at intermediate nodes, so the
  ppid frequency heuristic could pick a non-root process
- fall back to --client_version from /proc/<pid>/cmdline when the
  embedded ",x.y.z.<version>" literal is missing; the 4.1.13+ runtime
  no longer contains it, which made findWmpfProcess throw
  "[frida] error in find wmpf version"
- resolve sandbox paths reported by frida (/app/extra/wechat/...) to
  host paths via /proc/<pid>/root so version detection works when the
  target runs inside flatpak/bwrap
- add addresses.4067695881.json for WeChat 4.1.13.9 (client_version
  4067695881)

Offsets were derived with a small static-analysis toolchain (rip-rel
xref scan + .eh_frame_hdr function boundaries) that was validated by
reproducing every value in addresses.14978.json exactly on the
known-good 14978 binary (WeChat 4.1.1.8) before being applied to the
new binary. Verified end-to-end on flatpak com.tencent.WeChat
4.1.13.9: OnLoadStart fires and rewrites scene 1027 -> 1101, the CDP
filter hook patches repeatedly, and DevTools connects.
Comment thread src/platform/linux.ts
const relativePath = sandboxPath.slice("/app/".length);
const flatpakAppRoots = [
path.join(os.homedir(), ".local/share/flatpak/app"),
"/var/lib/flatpak/app",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this raise permission denied if the process is started by a non-root user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants