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.exe
as an example - Compile
test.cs
totest.dll
with a signed strong name, this is required to load an assembly outside of a .NET applications base directory. - Host
test.dll
on a remote SMB or HTTP(S) server - Replace the
name
,version
andpublicKeyToken
values accordingly in the<assemblyIdentity>
and<AppDomainManagerAssembly>
elements inapp.config
with the values from your compiledtest.dll
- Update the URL pointing to
test.dll
inapp.config
- Rename
app.config
toaspnet_compiler.exe.config
and 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