This is a variation of the technique originally discovered by subtee and described here
TL;DR It essentially allows you to turn any .NET application into a lolbin by providing a configuration file and specifying the <appDomainManagerAssembly> element pointing to a specially crafted .NET assembly which executes when the application is loaded.
This variation allows you to load the AppDomainManager assembly from a UNC path or HTTP(s) server. Also disables ETW thanks to the <etwEnable> element :)
- Copy some binary you love to say,
C:\Test. Lets useaspnet_compiler.exeas an example - Compile
test.cstotest.dllwith a signed strong name, this is required to load an assembly outside of a .NET applications base directory. - Host
test.dllon a remote SMB or HTTP(S) server - Replace the
name,versionandpublicKeyTokenvalues accordingly in the<assemblyIdentity>and<AppDomainManagerAssembly>elements inapp.configwith the values from your compiledtest.dll - Update the URL pointing to
test.dllinapp.config - Rename
app.configtoaspnet_compiler.exe.configand put it in the same folder as the copiedaspnet_compiler.exe - Execute
aspnet_compiler.exe - Profit :)
This isn't completely "fileless" as the downloaded AppDomainManager assembly gets written to disk at ~\AppData\Local\assembly\dl3 along with a .ini file which has the URL it came from, but it does provide more flexibility.
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/etwenable-element https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/codebase-element