How dessertlab/laccolith works
1. What this repository is
- Laccolith is a containerized framework that orchestrates kernel-level payload injection into a Windows guest VM from the privileged side of the virtualization boundary.
- Its core purpose is to automate a full adversary-emulation loop: build payloads, patch them for a target VM version, inject them into guest memory, and drive them through a C2-style control plane.
2. Top-level deployment boundary
- The system runs as a Dockerized Linux-host service.
- It assumes the guest VM RAM is file-backed and exposed on the host under /dev/shm, so the framework can read and write guest physical memory in near real time.
- The host VM stack is oriented around QEMU/KVM + libvirt with a Windows 10 guest; the repository includes VM configuration material in vm/.
3. Main runtime services
- The application exposes three externally visible interfaces:
- a web UI on port 8000,
- a text UI over network on port 7331,
- a C2 listener on port 5000 for the injected agent.
- The web and TUI are operator-facing control surfaces; the C2 port is the agent-facing communication endpoint.
4. Operator control plane
- app.py is the likely entrypoint for the web application.
- cmd_line_over_network.py appears to implement the richer network TUI.
- templates/ contains the HTML views for the web interface, so the operator UI is server-rendered and integrated into the Python app rather than being a separate frontend.
5. C2 and agent session management
- The c2/ package is the control-plane core:
- c2_server.py manages the listener side,
- connection.py handles agent/session transport,
- c2_actions.py, c2_operations.py, c2_facts.py, and c2_parsers.py model command execution, campaign flow, and extracted intelligence.
- This layer is responsible for turning raw agent communication into structured operator-visible state.
6. Action/operation/fact model
- Laccolith uses a Caldera-like abstraction:
- Operations represent campaign profiles,
- Actions represent discrete tasks/abilities,
- Parsers convert raw command output into Facts,
- Facts feed later actions and the UI.
- This is the main planning/execution boundary: operator intent is translated into a sequence of agent commands, with parser-produced facts closing the loop.
7. Injection orchestration layer
- injector.py and vm_drivers.py are the host-side components that coordinate the actual memory manipulation and VM interaction.
- config/conf_manager.py and config/config.json hold runtime parameters such as target profile, offsets, paths, and connection settings.
- These modules sit between operator intent and the guest-memory write path.
8. Guest-memory access path
- The repository includes a devmem2/ subtree, adapted for shared-memory/physical-memory access.
- The framework uses this to operate on the guest’s backing RAM image as if it were a writable physical memory surface.
- Volatility is used as a companion introspection tool to resolve guest structures and version-dependent addresses, which is important for patching shellcode and locating target code regions.
9. Payload and shellcode subsystem
- kernel_shellcode_library/ is the payload factory and payload cache.
- It contains:
- a Rust-based shellcode library (SassyKitdi-master/),
- reusable low-level crates under src/common/,
- payload crates under src/payloads/,
- build helpers and patching utilities.
- The repo stores both source and generated binaries, indicating a build-time pipeline followed by runtime selection/patching.
10. Two-stage injection architecture
- The payload system is split into first-stage and second-stage shellcode.
- The first stage is the small bootstrap written into an overwritten kernel code path; it allocates and signals space for the second stage and coordinates one-time execution.
- The second stage is the actual agent payload that establishes C2 communication and executes commands inside the guest kernel context.
11. Version-specific patching
- kernel_shellcode_library/offsets.json and shellcode_patching.py encode runtime patch points for different Windows builds and payload variants.
- This makes portability an explicit architecture concern: payload binaries are not treated as fixed artifacts, but as templates that are patched according to the target VM version.
12. Build and packaging flow
- The payloads are compiled with Rust toolchains under kernel_shellcode_library/SassyKitdi-master/src/payloads/....
- The resulting binaries are extracted, trimmed, patched, and then consumed by the Python orchestration layer.
- Dockerfile and docker-compose.yml package the whole runtime so the framework can be brought up as a single service stack.
13. Test/debug environment
- The repo also encodes an operational lab setup: Windows guest with KDNET kernel debugging, compatible NIC configuration, and a fresh snapshot-based experiment loop.
- docs/ contains architectural diagrams and thesis/presentation material that document the intended flow, but the actual runtime architecture is concentrated in the Python orchestration, C2 stack, and payload library.
14. End-to-end data flow
- Operator enters a command or selects a campaign in the web/TUI interface.
- The control plane resolves the operation into actions, patches the appropriate payload, and writes it through the guest-memory access layer.
- The first-stage bootstrap in guest kernel memory launches the second-stage agent.
- The agent connects back to the C2 server on port 5000, executes requested tasks, returns outputs, and those outputs are parsed into facts for the next operator step.
Main entry points: injector.py Injector · app.py App · c2_operations.py Operations · payloads Payload bins
Components 19
Operator plane
Human-facing control surfaces and server-rendered UI.
C2 core
Agent listener, session transport, and campaign state model.
- C2 server · Network listener that accepts agent connections.
c2/c2_server.py - Transport · Agent/session connection handling and message exchange.
c2/connection.py - Actions · Discrete command and ability definitions for campaigns.
c2/c2_actions.py - Operations · Campaign profiles and execution flow definitions.
c2/c2_operations.py - Facts · Structured facts extracted from agent output.
c2/c2_facts.py - Parsers · Transforms raw command output into facts.
c2/concrete_parsers.py
Injection pipeline
Host-side orchestration, guest-memory access, and runtime configuration.
- Injector · Coordinates payload selection, patching, and memory writes.
injector.py - VM drivers · Interfaces to the virtualization layer and guest VM state.
vm_drivers.py - Config · Configuration manager and runtime settings source.
config/conf_manager.py - Shared mem · Shared-memory backed physical memory access tooling.
devmem2
Payload library
Rust shellcode source, patching, and generated stage artifacts.
- Patcher · Version-specific shellcode patching and offset application.
kernel_shellcode_library/shellcode_patching.py - Offsets · Version-dependent patch points and target offsets.
kernel_shellcode_library/offsets.json - Rust src · Rust-based shellcode library and payload source tree.
kernel_shellcode_library/SassyKitdi-master/src - Payload bins · Compiled first- and second-stage shellcode binaries.
kernel_shellcode_library/payloads
Lab stack
Virtualization and guest environment material used to run the framework.
- VM config · Libvirt/QEMU guest configuration for the Windows lab VM.
vm/win10-3.xml - Docker stack · Container packaging and compose setup for the runtime.
docker-compose.yml
Connections 24
- App → Views: renders · Server-side web views are populated from templates.
- App → Operations: plans · Operator intent is translated into campaign operations.
- Net TUI → Operations: drives · Network TUI issues operator commands into the campaign model.
- Operations → Actions: expands · Operations decompose into discrete actions.
- Actions → Parsers: collects · Action results are parsed back into structured intel.
- Parsers → Facts: emits · Parsed output becomes facts for later steps.
- Facts → Operations: feeds · Facts update subsequent operation choices.
- C2 server → Transport: accepts · The listener hands sessions to connection handling.
- Transport → Actions: executes · Connected agents receive tasking derived from actions.
- C2 server → App: status · Agent/session state surfaces in the operator UI.
- Injector → Config: reads · Injection orchestration uses runtime configuration.
- Injector → VM drivers: coordinates · Injector delegates VM interactions to drivers.
- VM drivers → Shared mem: accesses · Drivers operate through shared-memory backed guest RAM access.
- Injector → Patcher: patches · Payload templates are patched for the target VM version.
- Patcher → Offsets: uses · Patch logic is driven by target-specific offsets.
- Patcher → Payload bins: produces · Patched binaries are emitted for injection.
- Rust src → Payload bins: builds · Rust shellcode source compiles into stage binaries.
- Payload bins → Injector: consumes · The injection pipeline selects built stage artifacts.
- VM config → VM drivers: describes · Guest VM configuration constrains VM control behavior.
- Docker stack → App: packages · Docker composition packages the operator/runtime services.
- Docker stack → C2 server: exposes · Containerized deployment exposes the listener service.
- Docker stack → Injector: runs · Containerized deployment runs the injection orchestration.
- Shared mem → Payload bins: writes · Guest-memory access is used to place payload code in RAM.
- Transport → App: surfaces · Connection state can be surfaced to the web control plane.