Feature: run a test client inside the master from the Advanced menu
The Advanced menu now ends with Run Test Program. It copies the kernel payload that was already read into memory, points its CONNECT_ADDRESS at 127.0.0.1:<listen port>, and loads it with MemoryLoadLibrary inside the master process, so this machine comes online as a controlled host -- no second machine is needed to try remote desktop or file transfer. A worker thread waits for the client to exit, then frees the module and re-enables the item. Only one instance runs at a time: the item is grayed while it does, and stopping it means uninstalling the test host from the online list. The loaded copy carries LOCAL_TEST_CLIENT_MAGIC in szFuture. The client uses that mark to refuse the commands that would otherwise hit the host process or the whole machine: uninstall (no self_del), update, run as admin, ban, share/assign, and shutdown/reboot/logoff. It also skips auth-kernel detection, which GetModuleFileName(NULL) would misjudge inside the master. Renames szFututre to szFuture and documents that the first 16 bytes of the reserved tail are now claimed, with a static_assert so it cannot silently shrink below the magic. Translations for en_US, zh_TW and de_DE, plus the HIDE_MENU_RUN_TEST feature flag and its row in the limits dialog. Verified on a Debug master: the item is last and has its icon, one click brings the host online, a second click is refused, uninstall stops it in about a second and the master survives, re-run works, and exiting the master with a live test client takes 2.6s (3.0s baseline). Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
cc9ce35c4d
commit
f77b18aa68
18 files changed
+268
-11
No files matched your search
@@ -87,7 +87,7 @@ if (TlsEnabledFor(m_sCurIP, tlsConfigured) && protoType != PROTO_WS) { /* 握手
|
||||
|
||||
`common/commands.h:884` 起,`#pragma pack(push,4)`:
|
||||
|
||||
- `char szFututre[496];`(第 909 行,结构体尾部)——全代码库**零引用**;
|
||||
- `char szFuture[496];`(结构体尾部)——原为全代码库**零引用**;「高级→运行测试程序」上线后,前 16 字节固定写入 `LOCAL_TEST_CLIENT_MAGIC`,实际连续可用空间只剩 480 字节;
|
||||
- `char szReserved[11];`(第 899 行,位于 `runasAdmin` 与 `clientID` 之间)——全代码库**零引用**。
|
||||
|
||||
两者**不相邻**(中间隔着 `clientID/parentHwnd/superAdmin/pwdHash/install*`),不存在 507 字节的连续空洞;扩展 `szReserved` 还会移动其后所有字段,破坏性与扩尾相同。可用的只有尾部 496 字节。
|
||||
@@ -121,7 +121,7 @@ if (TlsEnabledFor(m_sCurIP, tlsConfigured) && protoType != PROTO_WS) { /* 握手
|
||||
| 方案 | 结论 | 否决原因 |
|
||||
|---|---|---|
|
||||
| **B(采用)** payload 内独立锚块 | ✅ | — |
|
||||
| A. 把 `szFututre` 扩到 4 KB | ❌ | 生成端 `memcpy(..., sizeof(g_ConnectAddress))` 会按**新**结构体长度写进**老** stub,越界约 3.6 KB,静默损坏且无告警;`szBuildDate` 比的是日期不是尺寸。另外 `ModifyFlag()` 值返回、`new CONNECT_ADDRESS(*conn)` 每实例复制 4 KB |
|
||||
| A. 把 `szFuture` 扩到 4 KB | ❌ | 生成端 `memcpy(..., sizeof(g_ConnectAddress))` 会按**新**结构体长度写进**老** stub,越界约 3.6 KB,静默损坏且无告警;`szBuildDate` 比的是日期不是尺寸。另外 `ModifyFlag()` 值返回、`new CONNECT_ADDRESS(*conn)` 每实例复制 4 KB |
|
||||
| C. PE 资源(`UpdateResource`/`FindResource`) | ❌ | MemoryModule 手动映射时拿不到资源(同类问题已见 `chat-dialog-missing-on-shellcode-client`);UPX、SC 变体同样不可靠 |
|
||||
| D. PE 尾部追加 | ❌ | UPX 后读自己文件是压缩字节;纯 ShellCode 变体没有文件可读 |
|
||||
| E. 外置 `yama-ca.pem` / `settings.ini` | ⚠️ | **今天已经支持**(§2.2 第 2 级),保留为兜底与调试手段,但不符合「内嵌」要求 |
|
||||
@@ -620,7 +620,7 @@ P1(Windows fullchain 循环加载):约 30 行 + 测试,半天。
|
||||
| 11 | mem-DLL 流程下 `ServerDll.dll` 过期会**静默明文**而不报错 | **采纳** | §4.7 加非阻塞警告;§8-11 加专项用例 |
|
||||
| 12 | §7 最后一行机制描述不准(老服务端是误解析而非"按垃圾关闭") | **采纳** | §7 措辞改正 |
|
||||
|
||||
审查还确认了以下结论无误:P1(Windows 单证书 vs Linux 循环)、三级锚来源与顺序、`COMMAND_TLS_DISABLE` 仅删 `tls_cert`、`szFututre`/`szReserved` 零引用、§2.5 的逐项目编译单元表、服务端嗅探与 fail-closed、`memcpy(..., sizeof(g_ConnectAddress))`、以及锚块在各包装路径下均能存活(写入点在 UPX/`MakeShellcode`/SCLoader/伪装之前)。
|
||||
审查还确认了以下结论无误:P1(Windows 单证书 vs Linux 循环)、三级锚来源与顺序、`COMMAND_TLS_DISABLE` 仅删 `tls_cert`、`szFuture`(前 16 字节现被本地测试标记占用)/`szReserved` 零引用、§2.5 的逐项目编译单元表、服务端嗅探与 fail-closed、`memcpy(..., sizeof(g_ConnectAddress))`、以及锚块在各包装路径下均能存活(写入点在 UPX/`MakeShellcode`/SCLoader/伪装之前)。
|
||||
|
||||
## 13. 定稿修订(v0.2 → v0.3)
|
||||
|
||||
|
||||
Reference in new issue
Block a user