Advisory

GHSA-hx52-cv84-jr5v

Details, part 2 of 3. The advisory

Details

3.2 Exploit Execution Flow
The provided exploit mtls_poc.go or mtls_poc.go demonstrates how a single captured implant can be weaponized into a "Kill Switch" for the entire C2 infrastructure. The attack follows these steps:

  1. Authentication: Establishes a valid mTLS connection using the extracted certificates.
  2. Multiplexing: Negotiates a Yamux stream, bypassing standard network-level protections.
  3. Payload Construction: Builds a BeaconRegister Protobuf message where the ID is defined, but the critical Register sub-message is explicitly omitted (set to nil).
  4. Envelope Signing: Deterministically signs the malicious envelope using the recovered Age private key to ensure it is accepted by the server.
  5. Trigger: Sends the malformed payload. Upon receipt, the server's handler attempts to dereference the missing Register pointer, leading to an immediate Full Server DoS.

4. Transport-Specific Response & Recovery Analysis
The impact of this panic varies significantly depending on the C2 transport used by the implant. While the nil-pointer dereference happens in the shared handler logic, the transport layer determines whether this results in a localized request failure or a total server termination.

4.1 HTTP/S Transport
HTTP-based beacons do not crash the entire Sliver server. This is because Sliver utilizes the standard Go net/http library.

Code Reference ([server/c2/http.go](https://github.com/BishopFox/sliver/blob/master/server/c2/http.go)):

server.HTTPServer = &http.Server{
    Addr:         fmt.Sprintf("%s:%d", req.Host, req.Port),
    Handler:      server.router(),
    // ...
}
// ...
go server.HTTPServer.ListenAndServe()

By design, net/http's ServeHTTP implementation wraps every connection in a defer recover() block. When the beaconRegisterHandler panics, the standard library catches it, logs the trace, and simply closes that specific TCP connection. The rest of the server remains unaffected.

4.2 mTLS & WireGuard Transports (Full DoS)
Both mTLS and WireGuard utilize the yamux multiplexer to handle multiple streams over a single connection. Unlike the HTTP server, Sliver manually manages these goroutines without a global recovery mechanism.

mTLS [server/c2/mtls.go](https://github.com/BishopFox/sliver/blob/master/server/c2/mtls.go):

if handler, ok := handlers[envelope.Type]; ok {
    mtlsLog.Debugf("Received new mtls message type %d, data: %s", envelope.Type, envelope.Data)
    go func(envelope *sliverpb.Envelope) {
        respEnvelope := handler(implantConn, envelope.Data) // <--- PANIC HERE
        if respEnvelope != nil {
            implantConn.Send <- respEnvelope
        }
    }(envelope)
}

WireGuard [server/c2/wireguard.go](https://github.com/BishopFox/sliver/blob/master/server/c2/wireguard.go):

if handler, ok := handlers[envelope.Type]; ok {
    go func(envelope *sliverpb.Envelope) {
        respEnvelope := handler(implantConn, envelope.Data) // <--- PANIC HERE
        // ...
    }(envelope)
}

Because these handlers are invoked in a raw goroutine without a recover() block, the panic propagates to the top of the stack, causing the entire Go runtime to exit (SIGSEGV). This kills the sliver-server process immediately.

4.3 DNS Transport (Full DoS)
Similar to mTLS, the DNS transport reassembles messages and then forwards them to handlers in unsynchronized goroutines.

DNS [server/c2/dns.go](https://github.com/BishopFox/sliver/blob/master/server/c2/dns.go):

// Line 833: Forwarding the completed envelope
go dnsSession.ForwardCompletedEnvelope(msg.ID, pending)
// ...
// Inside ForwardCompletedEnvelope:
if handler, ok := handlers[envelope.Type]; ok {
    respEnvelope := handler(s.ImplantConn, envelope.Data) // <--- PANIC HERE
    // ...
}

This asynchronous call also lacks a recover() block, making DNS sessions equally capable of crashing the entire server.

4.4 Vulnerability Matrix by Protocol

| Protocol | Uses recover()? | Impact of Panic | Server Crash? |
| :--- | :---: | :--- | :---: |
| HTTP / HTTPS | Yes (Built-in) | Request Terminated | No |
| mTLS | No | Process Termination | Yes |
| WireGuard | No | Process Termination | Yes |
| DNS | No | Process Termination | Yes |

5. Impact Analysis
The impact of this vulnerability is Total Operational Paralysis. Because the panic causes the entire Go runtime to terminate:

  • Global Disconnection: Every active session and beacon across all transports (including the resilient HTTP transport) is instantly terminated.
  • Persistence Risk: Implants waiting for their next check-in will find the server offline. Repeated failures may trigger internal implant "kill-date" or cleanup logic, or alert defensive monitoring to a failure in the C2 channel.
  • Operator Eviction: All active operators are evicted from the gRPC interface, losing all unsaved state, active shell buffers, and real-time monitoring streams.
  • Operational Downtime: Restoration requires manual intervention to restart the service and potentially re-establish complex pivot chains, creating a significant "Recovery Time Objective" (RTO) penalty.

6. Countermeasures & Remediation
Addressing these vulnerabilities requires a systemic shift towards "fail-safe" architecture. The root cause is a combination of unprotected Protobuf pointer dereferences and a lack of isolation in asynchronous transport layers.

6.1 Tier 1: Tactical Defensive Programming
The immediate priority is to implement strict validation for all nested Protobuf fields. In Go, omitted sub-messages are nil after unmarshaling; handlers must assume any pointer-typed field from an implant is potentially nil.

Implementation Pattern: Validation-First Handlers
Handlers should validate the entire message structure before proceeding to business logic.

beaconReg := &sliverpb.BeaconRegister{}
if err := proto.Unmarshal(data, beaconReg); err != nil {
	return nil // Drop malformed wire data
}

// MANDATORY VALIDATION BLOCK
if beaconReg.Register == nil {
	beaconHandlerLog.Errorf("Nil Register message from %s", core.GetRemoteAddr(implantConn))
	return nil
}

// Deep access is now safe
id := beaconReg.Register.Uuid
// ...

6.2 Tier 2: Infrastructure Hardening (RPC Global Accessors)
To protect the gRPC/Operator interface, the server should deprecate direct access to the Request metadata field in favor of safe accessors that handle missing metadata gracefully.
Recommended Helper Update

// server/rpc/rpc.go
// getRequestSafe returns the Request metadata or an error, preventing panics
func getRequestSafe(req GenericRequest) (*commonpb.Request, error) {
    r := req.GetRequest()
    if r == nil {
        return nil, status.Error(codes.InvalidArgument, "missing mandatory 'Request' metadata")
    }
    return r, nil
}

6.3 Tier 3: Strategic Architectural Resilience (Panic Recovery Middleware)
To achieve parity with the resilience of the HTTP transport, all multiplexed transports (mTLS, WireGuard, DNS) must implement a supervisor pattern using Go's recover() mechanism.

Sources & licences