Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIRD_PARTY_NOTICES

Last updated: 2026-08-25
Last updated: 2026-10-08

This repository references and adapts ideas/workflows from external projects.

Expand Down Expand Up @@ -161,6 +161,21 @@ This repository references and adapts ideas/workflows from external projects.
- The Skill and core's original portions use personal-learning and non-commercial terms; upstream MIT / Apache-2.0 licenses remain in effect for their respective portions. This collection's license grants no rights to the separate core, proprietary editor, native materials or paid services; the core is governed by its own terms.
- This collection distributes only this Skill's instructions, entrypoint and speech-plan helpers. The core is distributed separately under its own terms, and existing collection directories' licenses are unchanged.

## 14) utelle/SQLite3MultipleCiphers

- Upstream: https://github.com/utelle/SQLite3MultipleCiphers
- Pinned commit: `7a7f16a5270e0157db43c8c3cfcf6088e11f72b1`
- Source: `src/cipher_wxaes128.c`, `GenerateKeyAES128Cipher`
- File copyright: (c) 2006-2024 Ulrich Telle
- License: MIT; complete notice in `licenses/utelle-SQLite3MultipleCiphers-LICENSE.txt`
- Usage in `yichen-wecom-local-vault/scripts/scan_dbkey_manager_frida_macos.py`:
- Python port of the wxSQLite3 AES128 PDF-style password-to-master derivation.
- The build-specific process scanner uses the derived master only after local
database first-page validation. No captured password, key, account data or
vendor application binary is distributed.
- The third-party-derived KDF retains the upstream MIT notice; surrounding
project licensing is unchanged.

## Notes

- This repository maintains its own license (`LICENSE`) for original contributions. It is personal-learning and non-commercial only.
Expand Down
26 changes: 26 additions & 0 deletions licenses/utelle-SQLite3MultipleCiphers-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Source: https://github.com/utelle/SQLite3MultipleCiphers
Pinned commit: 7a7f16a5270e0157db43c8c3cfcf6088e11f72b1
Adapted function: GenerateKeyAES128Cipher in src/cipher_wxaes128.c
File copyright: (c) 2006-2024 Ulrich Telle

MIT License

Copyright (c) 2019-2026 Ulrich Telle

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions yichen-wecom-local-vault/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ python3 "$SKILL_DIR/scripts/scan_dbkey_manager_macos.py" scan --confirm-sudo

该扫描器根据当前进程 load address 定位 `DbKeyManager` vtable,并只读取 `this+0x68` 的 Apple libc++ `std::string` 候选 key;候选通过数据库第一页验证后才写入私密 Vault,终端不显示 raw key。

### 5.0.11 / 70742 arm64 的限定兼容入口

已验证构建可显式使用独立的 Frida DbKeyManager 扫描器。它会附加进程并注入读取脚本,不安装函数 hook,不主动写目标内存;仍须获得用户明确的密钥捕获授权。它不会自动代替上述路线,也不会请求 sudo、重签或重启客户端。

```bash
python3 "$SKILL_DIR/scripts/scan_dbkey_manager_frida_macos.py" \
--confirm-attach --pid <企业微信主进程PID> \
--data-dir "/private/path/to/authorized/database-directory"
```

入口同时限定版本 `5.0.11`、构建 `70742`、运行时 `arm64` 与 Mach-O UUID;任何不匹配都拒绝扫描。该构建的 DbKeyManager 16 字节内容先按 wxSQLite3 AES128 的密码派生算法处理,再尝试 raw master;只有 `message.db`、`session.db`、`user.db` 三库首页均验证成功才私密保存。首页验证不等于完整数据验收,后续仍应验证私密快照的 SQLite 完整性。5.0.9、Intel 和其他构建未经验证。

实现依据、复现范围和离线验证见 [5.0.11 兼容说明](references/wecom-5.0.11-dbkey-manager.md)。

## 创建明文快照

```bash
Expand Down Expand Up @@ -133,6 +147,7 @@ python3 "$SKILL_DIR/scripts/vault_cli.py" export "群名" \
```bash
cd "$SKILL_DIR/scripts"
python3 test_wecom_local_vault.py
python3 -m unittest test_dbkey_manager_frida -v
python3 -m py_compile *.py
python3 "$HOME/.codex/skills/.system/skill-creator/scripts/quick_validate.py" "$SKILL_DIR"
```
Expand Down
108 changes: 108 additions & 0 deletions yichen-wecom-local-vault/references/wecom-5.0.11-dbkey-manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# WeCom 5.0.11 / 70742 DbKeyManager compatibility

Related discussion: [Issue #16](https://github.com/mcncarl/yichen-skills/issues/16).

## Scope and evidence

This is an explicitly selected, build-specific alternative to the existing
function-hook and Mach VM capture routes. It does not change their defaults.

The contributing implementation was exercised locally on 2026-10-01 with:

| Property | Verified value |
| --- | --- |
| WeCom version / build | 5.0.11 / 70742 |
| Architecture | arm64 |
| macOS | 27.0.1 |
| Mach-O UUID | BBC8DDE9-AC04-3DF1-BF5A-D6887B956966 |
| DbKeyManager vtable RVA | `0x0cd5fb50` |
| Manager version / string offsets | `+0x60` / `+0x68` |

The local acceptance record reported successful candidate validation against
16 encrypted database first pages, followed by complete private snapshots of
the three core databases (`message.db`, `session.db`, `user.db`) with committed
WAL content and successful SQLite integrity checks. The contributed wrapper
is covered by offline regression tests; it has not been rerun against a live
process as part of this contribution. These are contributor-reported local
results, not a maintainer certification or a guarantee for other machines.

No private acceptance receipt, database, database hash, account identifier,
password, captured key, or chat content is included. There is no verification
claim for 5.0.9, Intel, other 5.0.11 builds, or all 5.x versions.

## Two independent compatibility changes

1. **Object location.** The older scanner's unslid vtable address does not
identify the DbKeyManager vtable in this exact build. This entry point uses
the RVA above only after checking the loaded image's architecture and UUID.
The vtable must lie in a readable mapped range; `module.size` alone is not a
reliable bound for this observed image layout.
2. **Password versus database master.** The observed 16-byte cached string is
used as a password. The wxSQLite3 AES128 PDF-style KDF derives the 16-byte
database master. Treating the cached bytes directly as the master failed in
the successful local case. For compatibility, raw bytes are tried only if
the derived master does not validate all three core database first pages.

The existing per-page derivation, `MD5(master || LE32(page) || "sAlT")`, remained
usable in this local case. This observation does not establish which internal
encryption function a different build calls, nor does it disprove other
participants' capture failures.

The KDF is a Python port of `GenerateKeyAES128Cipher` in
[SQLite3MultipleCiphers, pinned commit 7a7f16a](https://github.com/utelle/SQLite3MultipleCiphers/blob/7a7f16a5270e0157db43c8c3cfcf6088e11f72b1/src/cipher_wxaes128.c#L133-L187).
Its source attribution and MIT license are preserved in
[`../../licenses/utelle-SQLite3MultipleCiphers-LICENSE.txt`](../../licenses/utelle-SQLite3MultipleCiphers-LICENSE.txt).
The repository's existing license continues to govern the surrounding project.

## Running with owner authorization

Use only on the local owner's explicitly authorized data, after confirming the
process PID and database directory belong to the intended account. Do not
paste a key or password on the command line.

```bash
python3 scripts/scan_dbkey_manager_frida_macos.py \
--confirm-attach --pid <WeCom-main-process-PID> \
--data-dir "/private/path/to/authorized/database-directory"
```

Python needs the existing `frida` and `pycryptodome` dependencies. The command
does not install them, escalate privileges, disable SIP, re-sign an application,
launch a copy, or operate the client's UI. Frida attachment injects a scanner
script into the process; it is not the no-injection Mach VM route. The script
reads mappings and manager objects without installing function hooks or
deliberately writing target memory. OS permission failures are reported rather
than bypassed.

The installed version/build check precedes attachment. Runtime architecture,
Mach-O UUID and readable-vtable checks precede candidate scanning. Stage
timeouts are bounded, and unload/detach are attempted in cleanup. Unsuccessful
candidates are not written to disk or printed. A successful master is saved
through the existing private-vault helper with restrictive permissions only
after all three core database first pages validate and cleanup succeeds.

The string layout and 16-byte filter are observations of this build, not a
generic libc++ or DbKeyManager contract. The manager version field is observed
but is not an independent compatibility gate. Wrong-account selection should
fail validation; it must never trigger automatic dataset switching.

AES-CBC pages are not authenticated. A first-page match verifies a candidate
and the expected format, not the integrity or completeness of every page or
WAL frame. Validate complete private snapshots separately before using them.

## Offline verification

```bash
cd scripts
python3 test_wecom_local_vault.py
python3 -m unittest test_dbkey_manager_frida -v
python3 -m py_compile scan_dbkey_manager_frida_macos.py test_dbkey_manager_frida.py
```

The regression suite uses synthetic passwords/pages and mocked process APIs.
Node.js runs the injected JavaScript against a synthetic memory model; those
tests are explicitly skipped when Node.js is unavailable.
It must not attach to a live process, inspect real database directories, or
write into the user's real vault. It covers password derivation, raw fallback,
the three-core-database save gate, explicit authorization, and cleanup/failure
behavior. A passing offline test is not additional live compatibility evidence.
Loading