Fix: Show the instant-message popup on packed clients
Clients packaged as SC_AES/sRDI shellcode run the payload image as raw shellcode inside the loader stub, so the instant-message manager was handed the stub's module handle. The stub's resource section carries no IDD_DIALOG, and Windows rejects resource APIs on manually mapped images, so DialogBoxParamA failed (error 1812 on Windows 11) and the bottom-right popup never appeared after the operator sent a message. The popup now falls back to an embedded compiled dialog template generated from the IDD_DIALOG block in Script.rc and verified byte-for-byte against the resource in the built ghost.exe. When the resource lookup fails, the dialog is created with DialogBoxIndirectParamA instead. Deployments where the resource lookup already works keep the original path unchanged. The incoming text is now terminated at the copied length. The server sends the message body without a trailing NUL, so a message that filled the 1024-byte buffer left SetDlgItemText reading past the end. The title is now set with SetWindowTextW before the window is shown. DialogBoxParamA converts the template's UTF-16 caption through the system ANSI code page, so the Chinese title turned into "???" on 1252 systems (verified locally with a caption containing a character outside CP936). The title follows the UI language: Chinese systems keep the Chinese title, everything else shows "Message". The message body still uses the ANSI path, preserving the existing per-ACP semantics. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
c99a1c375e
commit
434812f87d
6 files changed
+63
-3
No files matched your search
@@ -0,0 +1,33 @@
|
||||
// TalkDialogTemplate.h: IDD_DIALOG 的编译后 DLGTEMPLATEEX(内嵌内存模板)
|
||||
//
|
||||
// 用途:加壳部署(EXE + SC_AES/sRDI)的客户端里,TalkManager 的 hInstance 是外壳进程
|
||||
// 映像,其资源里没有 IDD_DIALOG;而载荷以裸 shellcode 运行、未注册进加载器,
|
||||
// FindResource/LoadResource/DialogBoxParamA 一律取不到对话框资源。此时用下面的内存模板
|
||||
// 直接 DialogBoxIndirectParamA 建窗,与部署形态无关。
|
||||
//
|
||||
// 数据来源:client/Script.rc 的 IDD_DIALOG(DIALOGEX)。DLGTEMPLATEEX 的字符串字段
|
||||
// 一律是 UTF-16,同一份字节既可用于 A 接口也可用于 W 接口。
|
||||
//
|
||||
// 重新生成(改动 Script.rc 的 IDD_DIALOG 后必须同步):
|
||||
// 1. rc /fo dlg.res dlg.rc (dlg.rc 只保留与 Script.rc 相同的 IDD_DIALOG 块)
|
||||
// 2. link /dll /noentry /machine:x64 /out:dlg.dll dlg.res
|
||||
// 3. 从 dlg.dll 的 RT_DIALOG(5) → 101 → 任意语言 取数据块,按 16 字节一行导出。
|
||||
// 当前块 104 字节:CAPTION "消息提示"、FONT 10 "System" charset 0、
|
||||
// 控件 ID 1000,与 Script.rc 完全一致;已与构建出的 ghost.exe 的
|
||||
// RT_DIALOG(5) → 101 逐字节比对一致。
|
||||
|
||||
#ifndef YAMA_TALK_DIALOG_TEMPLATE_H
|
||||
#define YAMA_TALK_DIALOG_TEMPLATE_H
|
||||
|
||||
// DLGTEMPLATEEX 的 DWORD 字段要求模板指针 4 字节对齐。
|
||||
__declspec(align(4)) static const unsigned char kTalkDialogTemplate[] = {
|
||||
0x01, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x00, 0xC8, 0x80,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x6D,
|
||||
0x6F, 0x60, 0xD0, 0x63, 0x3A, 0x79, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00,
|
||||
0x79, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x50, 0x05, 0x00, 0x05, 0x00, 0xAA, 0x00, 0x5F, 0x00,
|
||||
0xE8, 0x03, 0x00, 0x00, 0xFF, 0xFF, 0x82, 0x00, 0x53, 0x00, 0x74, 0x00, 0x61, 0x00, 0x74, 0x00,
|
||||
0x69, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#endif // YAMA_TALK_DIALOG_TEMPLATE_H
|
||||
Reference in new issue
Block a user