记一次另类的沙箱对抗

admin 2026-01-14 23:26:51 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 本文探讨了Windows平台下的沙箱对抗技术,旨在区分真实环境与沙箱以规避分析。作者提供了多种检测思路与C++实现代码,包括扫描桌面快捷方式以识别IDA等逆向工具、检测VMware目录判断虚拟机环境、监测鼠标移动及调用蜂鸣器模拟用户交互。文章最后整合了完整代码模板,强调了组合多种技巧对抗沙箱的重要性。 综合评分: 85 文章分类: 免杀,恶意软件,逆向分析,二进制安全


cover_image

记一次另类的沙箱对抗

原创

zyxa

众亦信安

2026年1月14日 10:55 湖南

声明:文中涉及到的技术和工具,仅供学习使用,禁止从事任何非法活动,如因此造成的直接或间接损失,均由使用者自行承担责任。

众亦信安,中意你啊!

温馨提示:当前公众号推送机制调整,仅常读及星标账号可展示大图推送。建议各位将众亦信安团队设为“星标“,以便及时接收我们的最新内容与技术分享。

从上次的云沙箱对抗方法中我门针对微步在线沙箱的运行截图这个特征来进行沙箱绕过

那么我们也可以从这个点入手从特定特征来进行对抗

从逆向人员角度

逆向人员一般有ida dbbug等相关逆向工具,所以我们只需要检测桌面上是否有相关名称等

bool&nbsp;HasDebuggerDesktopShortcut(){&nbsp; &nbsp;&nbsp;static&nbsp;const&nbsp;std::vector<std::wstring> targets = {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"ida64.exe",&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"ollydbg.exe",&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"x32dbg.exe",&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"x64dbg.exe"&nbsp; &nbsp; };
&nbsp; &nbsp;&nbsp;static&nbsp;const&nbsp;int&nbsp;desktopTypes[] = {&nbsp; &nbsp; &nbsp; &nbsp; CSIDL_DESKTOPDIRECTORY,&nbsp; &nbsp; &nbsp; &nbsp; CSIDL_COMMON_DESKTOPDIRECTORY&nbsp; &nbsp; };
&nbsp; &nbsp;&nbsp;auto&nbsp;CheckDesktop = [&](const&nbsp;std::wstring& desktopPath) ->&nbsp;bool&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::wstring search = desktopPath +&nbsp;L"\\*.lnk";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WIN32_FIND_DATAW fd;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HANDLE hFind =&nbsp;FindFirstFileW(search.c_str(), &fd);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(hFind == INVALID_HANDLE_VALUE)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;do&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::wstring lnkPath = desktopPath +&nbsp;L"\\"&nbsp;+ fd.cFileName;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IShellLinkW* pShellLink =&nbsp;nullptr;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(FAILED(CoCreateInstance(CLSID_ShellLink,&nbsp;nullptr,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**)&pShellLink)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IPersistFile* pPersistFile =&nbsp;nullptr;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->QueryInterface(IID_IPersistFile, (void**)&pPersistFile);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(!pPersistFile)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(FAILED(pPersistFile->Load(lnkPath.c_str(), STGM_READ)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pPersistFile->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;wchar_t&nbsp;targetPath[MAX_PATH] = {&nbsp;0&nbsp;};&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WIN32_FIND_DATAW wfd;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->GetPath(targetPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::wstring exePath = targetPath;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;(const&nbsp;auto& exe : targets)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(!exePath.empty() &&&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exePath.find(exe) != std::wstring::npos)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pPersistFile->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;FindClose(hFind);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pPersistFile->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;while&nbsp;(FindNextFileW(hFind, &fd));
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;FindClose(hFind);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp; &nbsp; &nbsp; &nbsp; };
&nbsp; &nbsp;&nbsp;if&nbsp;(FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)))&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;
&nbsp; &nbsp;&nbsp;for&nbsp;(int&nbsp;csidl : desktopTypes)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;wchar_t&nbsp;path[MAX_PATH];&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(SUCCEEDED(SHGetFolderPathW(nullptr, csidl,&nbsp;nullptr,&nbsp;0, path)))&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(CheckDesktop(path))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;CoUninitialize();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }
&nbsp; &nbsp;&nbsp;CoUninitialize();&nbsp; &nbsp;&nbsp;return&nbsp;false;}

同时一般是在虚拟机中运行所以我们可以检测运行时是否是虚拟机环境,这里可以参考上一篇文章的检测是否有相关目录

bool&nbsp;isVMwareInstalled()&nbsp;{&nbsp; &nbsp; WIN32_FIND_DATAW findFileData;&nbsp; &nbsp; HANDLE hFind;
&nbsp; &nbsp;&nbsp;// 构建搜索路径&nbsp; &nbsp; wchar_t path[MAX_PATH];&nbsp; &nbsp; swprintf(path, MAX_PATH, L"C:\\Program Files\\VMware");
&nbsp; &nbsp;&nbsp;// 搜索目录&nbsp; &nbsp; hFind = FindFirstFileW(path, &findFileData);&nbsp; &nbsp;&nbsp;if&nbsp;(hFind != INVALID_HANDLE_VALUE) {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;// 如果找到目录,则关闭搜索句柄并返回 true&nbsp; &nbsp; &nbsp; &nbsp; FindClose(hFind);&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; }&nbsp;else&nbsp;{&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;// 如果未找到目录,则返回 false&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp; &nbsp; }}

#

从云沙箱角度

从云沙箱角度来对抗更加简单,参考上一篇文章,这里提供别的思路,云沙箱没有没有cpu温度,鼠标移动活动,键盘活动等之类的情形,所以我们可以从这些方面入手

检测鼠标情况

bool&nbsp;HasRealMouseMove(&nbsp; &nbsp;&nbsp;int&nbsp;maxMove =&nbsp;5,&nbsp; &nbsp; DWORD intervalMs =&nbsp;1000,&nbsp; &nbsp; DWORD timeoutMs =&nbsp;3000&nbsp;// 3 秒){&nbsp; &nbsp; POINT oldPoint{}, currentPoint{};&nbsp; &nbsp;&nbsp;int&nbsp;moveCount =&nbsp;0;
&nbsp; &nbsp;&nbsp;GetCursorPos(&oldPoint);
&nbsp; &nbsp; DWORD start =&nbsp;GetTickCount();
&nbsp; &nbsp;&nbsp;while&nbsp;(GetTickCount() - start < timeoutMs)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Sleep(intervalMs);
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;GetCursorPos(&currentPoint);
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(currentPoint.x != oldPoint.x ||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentPoint.y != oldPoint.y)&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oldPoint = currentPoint;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++moveCount;&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(moveCount >= maxMove)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; }
&nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp;// 超时仍未检测到真实鼠标}

检测是否存在蜂鸣器

#include&nbsp;<Windows.h>#include&nbsp;<stdio.h>// 调用Beep 实现延迟执行int&nbsp;time_Beep(){// 设置延迟 30000毫秒&nbsp;int&nbsp;wh_compter =&nbsp;0;int&nbsp;wh_total =&nbsp;30000;
while(wh_compter < wh_total){Beep(2,&nbsp;1);&nbsp;// 2hertz, 1ms 设置低频和短暂的间隔时间实现听不见蜂鸣声wh_compter++;}
if(wh_compter > wh_total -&nbsp;1)return&nbsp;1;
return&nbsp;0;}
int&nbsp;main(){if(time_Beep())printf("调用Beep 延迟执行成功 \n");elseprintf("调用Beep 延迟执行失败 \n!");return&nbsp;0;}

沙箱对抗需要多种技巧组合才能发挥更好的作用,反沙箱的意义是为了区分真实环境和沙箱环境以确保我们的马子在沙箱环境中不被执行

这里提供一个完整模板

#include&nbsp;<windows.h>#include&nbsp;<shlobj.h>#include&nbsp;<shobjidl.h>#include&nbsp;<string>#include&nbsp;<vector>#include&nbsp;<iostream>

//判断是否是逆向人员bool&nbsp;HasDebuggerDesktopShortcut(){&nbsp; &nbsp;&nbsp;static&nbsp;const&nbsp;std::vector<std::wstring> targets = {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"ida64.exe",&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"ollydbg.exe",&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"x32dbg.exe",&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;L"x64dbg.exe"&nbsp; &nbsp; };
&nbsp; &nbsp;&nbsp;static&nbsp;const&nbsp;int&nbsp;desktopTypes[] = {&nbsp; &nbsp; &nbsp; &nbsp; CSIDL_DESKTOPDIRECTORY,&nbsp; &nbsp; &nbsp; &nbsp; CSIDL_COMMON_DESKTOPDIRECTORY&nbsp; &nbsp; };
&nbsp; &nbsp;&nbsp;auto&nbsp;CheckDesktop = [&](const&nbsp;std::wstring& desktopPath) ->&nbsp;bool&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::wstring search = desktopPath +&nbsp;L"\\*.lnk";
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WIN32_FIND_DATAW fd;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HANDLE hFind =&nbsp;FindFirstFileW(search.c_str(), &fd);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(hFind == INVALID_HANDLE_VALUE)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;do&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::wstring lnkPath = desktopPath +&nbsp;L"\\"&nbsp;+ fd.cFileName;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IShellLinkW* pShellLink =&nbsp;nullptr;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(FAILED(CoCreateInstance(CLSID_ShellLink,&nbsp;nullptr,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**)&pShellLink)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IPersistFile* pPersistFile =&nbsp;nullptr;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->QueryInterface(IID_IPersistFile, (void**)&pPersistFile);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(!pPersistFile)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(FAILED(pPersistFile->Load(lnkPath.c_str(), STGM_READ)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pPersistFile->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;continue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;wchar_t&nbsp;targetPath[MAX_PATH] = {&nbsp;0&nbsp;};&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WIN32_FIND_DATAW wfd;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->GetPath(targetPath, MAX_PATH, &wfd, SLGP_UNCPRIORITY);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::wstring exePath = targetPath;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;for&nbsp;(const&nbsp;auto& exe : targets)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(!exePath.empty() &&&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exePath.find(exe) != std::wstring::npos)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pPersistFile->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;FindClose(hFind);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pPersistFile->Release();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pShellLink->Release();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;while&nbsp;(FindNextFileW(hFind, &fd));
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;FindClose(hFind);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp; &nbsp; &nbsp; &nbsp; };
&nbsp; &nbsp;&nbsp;if&nbsp;(FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)))&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;
&nbsp; &nbsp;&nbsp;for&nbsp;(int&nbsp;csidl : desktopTypes)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;wchar_t&nbsp;path[MAX_PATH];&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(SUCCEEDED(SHGetFolderPathW(nullptr, csidl,&nbsp;nullptr,&nbsp;0, path)))&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(CheckDesktop(path))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;CoUninitialize();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }
&nbsp; &nbsp;&nbsp;CoUninitialize();&nbsp; &nbsp;&nbsp;return&nbsp;false;}//判断是否北京时间bool&nbsp;IsBeijingTimeZone()&nbsp;{&nbsp; &nbsp; TIME_ZONE_INFORMATION tzinfo;&nbsp; &nbsp;&nbsp;GetTimeZoneInformation(&tzinfo);&nbsp; &nbsp;&nbsp;// 计算时区偏移量(以分钟为单位)&nbsp; &nbsp;&nbsp;int&nbsp;tz_offset = tzinfo.Bias;&nbsp; &nbsp;&nbsp;// 将分钟转换为小时&nbsp; &nbsp;&nbsp;int&nbsp;tz_offset_hours = tz_offset /&nbsp;60;&nbsp; &nbsp;&nbsp;if&nbsp;(tz_offset_hours ==&nbsp;-8) {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp; &nbsp; }}
//判断是否有鼠标活动bool&nbsp;HasRealMouseMove(&nbsp; &nbsp;&nbsp;int&nbsp;maxMove =&nbsp;5,&nbsp; &nbsp; DWORD intervalMs =&nbsp;1000,&nbsp; &nbsp; DWORD timeoutMs =&nbsp;3000&nbsp;// 3 秒){&nbsp; &nbsp; POINT oldPoint{}, currentPoint{};&nbsp; &nbsp;&nbsp;int&nbsp;moveCount =&nbsp;0;
&nbsp; &nbsp;&nbsp;GetCursorPos(&oldPoint);
&nbsp; &nbsp; DWORD start =&nbsp;GetTickCount();
&nbsp; &nbsp;&nbsp;while&nbsp;(GetTickCount() - start < timeoutMs)&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Sleep(intervalMs);
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;GetCursorPos(&currentPoint);
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(currentPoint.x != oldPoint.x ||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentPoint.y != oldPoint.y)&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oldPoint = currentPoint;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ++moveCount;&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if&nbsp;(moveCount >= maxMove)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; }
&nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp;// 超时仍未检测到真实鼠标}

//判断是否为虚拟机bool&nbsp;isVMwareInstalled()&nbsp;{&nbsp; &nbsp; WIN32_FIND_DATAW findFileData;&nbsp; &nbsp; HANDLE hFind;
&nbsp; &nbsp;&nbsp;// 构建搜索路径&nbsp; &nbsp;&nbsp;wchar_t&nbsp;path[MAX_PATH];&nbsp; &nbsp;&nbsp;swprintf(path, MAX_PATH,&nbsp;L"C:\\Program Files\\VMware");
&nbsp; &nbsp;&nbsp;// 搜索目录&nbsp; &nbsp; hFind =&nbsp;FindFirstFileW(path, &findFileData);&nbsp; &nbsp;&nbsp;if&nbsp;(hFind != INVALID_HANDLE_VALUE) {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;// 如果找到目录,则关闭搜索句柄并返回 true&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;FindClose(hFind);&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;true;&nbsp; &nbsp; }&nbsp; &nbsp;&nbsp;else&nbsp;{&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;// 如果未找到目录,则返回 false&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;return&nbsp;false;&nbsp; &nbsp; }}

int&nbsp;main(){
}

加入圈子获取更多反沙箱思路

圈子介绍

后续更新suo5二开、自研webshell管理工具、cs远控等,目前定价129/年,前30名的师傅享受85折优惠。

往这里看

点点关注不迷路,不定时持续分享各种干货。可关注公众号回复”进群”,也可添加管理微信拉你入群。

项目交流,src/众测挖掘,重大节日保障,攻防均可联系海哥微信。

入了小圈的朋友联系海哥进内部交流群。


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:众亦信安 zyxa《记一次另类的沙箱对抗》

记一次另类的沙箱对抗 网络安全文章

记一次另类的沙箱对抗

文章总结: 本文探讨了Windows平台下的沙箱对抗技术,旨在区分真实环境与沙箱以规避分析。作者提供了多种检测思路与C++实现代码,包括扫描桌面快捷方式以识别I
评论:0   参与:  0