
Reverse engineering analysis of PureRAT RAT abusing msbuild.exe, extracting C2 infrastructure, .NET evasion APIs, file system manipulation, and VBScript persistence mechanisms.
Process Hacker memory analysis reveals that PureRAT executes via msbuild.exe (a legitimate Microsoft build tool) and connects to multiple C2 servers.
MSBuild.exe (PID 2056).pure8s.ddnsfree.com52.241.248.38HKEY_CURRENT_USER\Software\95082F4ACEBFA802830...Erişim izinlerinize izin verilmeyen bir... (Access denied error message).msbuild.exe is a legitimate tool abused for execution.
Process Hacker view showing msbuild.exe strings with C2 domain (pure8s.ddnsfree.com) and IP (52.241.248.38).
Process Hacker memory analysis of msbuild.exe reveals that PureRAT uses .NET manipulation and evasion APIs to avoid detection.
DisableNativeImageLoad – Disables native image loading (evasion).FlsSetValue / FlsGetValue – Fiber Local Storage (anti-debug).OpenProcessToken / GetTokenInformation – Token manipulation (privilege escalation).CreateBoundaryDescriptorW – Creates boundary descriptors (sandbox evasion).mscordacwks.dll – .NET debugging DLL (potential debugging evasion).AssemblyPath / BindingConfiguration – .NET assembly loading.WerRegisterRuntimeExceptionModule – Error reporting manipulation.AttachThreadAlwaysOn – Thread attachment (injection).AssemblyPath and BindingConfiguration confirm .NET usage.DisableNativeImageLoad and CreateBoundaryDescriptorW help avoid detection.OpenProcessToken enables token manipulation.FlsSetValue and AttachThreadAlwaysOn complicate analysis.
Process Hacker view showing DisableNativeImageLoad, OpenProcessToken, and other evasion APIs.
Binary Ninja analysis of the saved DisableNativeImageLoad code reveals that PureRAT uses .NET assembly manipulation and XML-based data structures.
MicrodomImplementation – Microsoft XML DOM implementation.CreateMicrodomSource – Creates XML DOM source (configuration).DsiGBufferedStream – Buffered stream for data processing.CRTIXMLDSIGBaseHasher – XML digital signature hashing.CRTIXMLDSIGEnvelopedSignatureTransformer – XML signature transformation.AssemblyPath – .NET assembly path.BindingConfiguration – .NET binding configuration.DsiGBufferedStream handles large data streams.DisableNativeImageLoad prevents native image loading, complicating analysis.
Binary Ninja view showing MicrodomImplementation, DsiGBufferedStream, and XML signature APIs.
This section continues the Binary Ninja analysis of the DisableNativeImageLoad code from the previous section. It reveals file system operations and CDF (Component Definition File) manipulation used by PureRAT.
DeleteFile, QueryAttributesFile, QueryDirectoryFile, WriteFile, ReadFile, CopyFile, CreateHardLinkOrCopyFile, CreateFile – full file system control.(ReferenceIdentityList != 0) || (CurrentPosition == 0) – validates CDF references.(NewCdf->Flags & ~((0x00000001) | (0x00000002))) == 0 – checks CDF flags.CreateFile(da={da}, oa={oa}, fa={fa}, sa={sa}, cd={cd}, co={co}):(st={st}.h={h}) – constructs file paths dynamically.
Binary Ninja view showing file operations, CDF validation, and dynamic path construction.
Process Hacker memory analysis of msbuild.exe reveals that PureRAT uses .NET Remoting and proxy APIs for inter-process communication and code injection.
GetServerDomainIdForProxy – Retrieves server domain ID for proxy.RegisterAssembly – Registers a .NET assembly.CreateProxyForDomain – Creates a proxy for a domain.MarshalToBuffer / UnmarshalFromBuffer – Serializes/deserializes data.GetLocalSignature – Retrieves local signature.ThrowException – Throws exceptions (error handling).UnsafeCast / UnsafeEnumCast – Unsafe type casting (evasion).ExecuteBackoutCodeHelper – Executes backout code.GetServerDomainIdForProxy confirms remoting usage.CreateProxyForDomain enables IPC.MarshalToBuffer and UnmarshalFromBuffer handle data.UnsafeCast and UnsafeEnumCast help bypass type safety.
Process Hacker view showing GetServerDomainIdForProxy, RegisterAssembly, and other Remoting APIs.
This section continues the Binary Ninja analysis of the GetServerDomainIdForProxy code from the previous section. It reveals HTTP communication, COM (Component Object Model) usage, and isolated filesystem operations used by PureRAT.
Content-Type: %s Content-Length: %d Accept: %s – used for C2 communication.CoTaskMemAlloc and IsolationImplementation::Com – allocates memory for COM objects.*ppClsid = (CLSID *)... – assigns a COM class identifier.IsolatedFilesystemObject and RtlIsIsolatedFilesystemObjectHandleValid – validates isolated filesystem handles.
Binary Ninja view showing HTTP headers, COM memory allocation, CLSID assignment, and isolated filesystem APIs.
This analysis uncovered PureRAT, a sophisticated fileless RAT that executes via msbuild.exe and uses advanced .NET evasion techniques.
msbuild.exe.pure8s.ddnsfree.com and 52.241.248.38.DisableNativeImageLoad and OpenProcessToken.DeleteFile, WriteFile, ReadFile, CopyFile, CreateFile).HKEY_CURRENT_USER\Software\95082F4ACEBFA802830...).pure8s.ddnsfree.com and IP 52.241.248.38.msbuild.exe executing unusual commands.DisableNativeImageLoad and OpenProcessToken calls.msbuild.exe.The analyzed PureRAT sample is available on MalwareBazaar for those who wish to conduct their own analysis:
Tools Used: Process Hacker, Binary Ninja,x64dbg