# GHSA-c279-989m-238f: Sliver: Nil Pointer Dereference in tunnelCloseHandler causes panic when a reverse tunnel (rportfwd) close is attempted

> An authenticated implant can trigger a server panic via reverse tunnel closure, causing denial of service.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 29 Mar 2026
- **Also known as:** GO-2026-4899

## What is GHSA-c279-989m-238f?

GHSA-c279-989m-238f is a vulnerability in github.com/bishopfox/sliver, published on 29 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Summary
A nil pointer dereference in `tunnelCloseHandler` causes the handler goroutine to panic whenever a reverse tunnel (rportfwd) close is attempted. Both the legitimate close path AND the unauthorized close path dereference `tunnel.SessionID` where `tunnel` is guaranteed nil. This means rportfwd tunnels can never be cleanly closed, and any authenticated implant can trigger repeated goroutine panics.

### Details
File: `server/handlers/sessions.go` lines 172 and 175

The function enters an `else` block precisely because `core.Tunnels.Get(tunnelData.TunnelID)` returned `nil`. Both conditions inside that else block then dereference `tunnel.SessionID` instead of `rtunnel.SessionID`:
```go
} else {
    rtunnel := rtunnels.GetRTunnel(tunnelData.TunnelID)

    if rtunnel != nil && session.ID == tunnel.SessionID {      // LINE 172 — nil deref
        rtunnel.Close()
        rtunnels.RemoveRTunnel(rtunnel.ID)
    } else if rtunnel != nil && session.ID != tunnel.SessionID { // LINE 175 — nil deref
        sessionHandlerLog.Warnf("...")
    }
}
```

Note: The identical bug was already fixed in `tunnelDataHandler` at lines 124/126 (correctly uses `rtunnel.SessionID`), but the fix was 
not applied to `tunnelCloseHandler`.

### PoC
```go
tunnel := GetTunnel(999)   // returns nil — no normal tunnel with this ID
// tunnel is nil here

rtunnel := GetRTunnel(999) // returns valid rtunnel owned by session-AAAA

// Both lines below panic with:
// runtime error: invalid memory address or nil pointer dereference
if rtunnel != nil && sessionID == tunnel.SessionID { ... }      // line 172
} else if rtunnel != nil && sessionID != tunnel.SessionID { ... } // line 175
```

Confirmed on master commit `7ac4db3fa` with standalone reproducer.
Output:
```
PANIC on line 172 (legitimate close): runtime error: invalid memory address or nil pointer dereference
PANIC on line 175 (unauthorized close): runtime error: invalid memory address or nil pointer dereference
```

![1](https://github.com/user-attachments/assets/93b24286-3282-454f-80a4-b01abe4f1d63)
![2](https://github.com/user-attachments/assets/d4219aea-eb18-474c-b69a-a5e20e97161f)
![3](https://github.com/user-attachments/assets/5a76b0d7-ae5b-4d91-bfe9-730d3e5c322c)

### Impact
- rportfwd tunnels **cannot be closed** — functional regression
- Any authenticated implant can trigger repeated handler goroutine panics
- rtunnel map entries leak (never cleaned up on close failure)
- `recoverAndLogPanic()` prevents full server crash but silently drops the close operation

### Fix
Replace `tunnel.SessionID` with `rtunnel.SessionID` on both lines:
```diff
-  if rtunnel != nil && session.ID == tunnel.SessionID {
+  if rtunnel != nil && session.ID == rtunnel.SessionID {
       rtunnel.Close()
       rtunnels.RemoveRTunnel(rtunnel.ID)
-  } else if rtunnel != nil && session.ID != tunnel.SessionID {
+  } else if rtunnel != nil && session.ID != rtunnel.SessionID {
```

## Which versions are affected by GHSA-c279-989m-238f?

3 open source packages ship an affected version, including github.com/bishopfox/sliver.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/bishopfox/sliver` | Go | All versions | None |
| `github.com/bishopfox/sliver` | Go | All versions to 1.7.3 | None |
| `github.com/bishopfox/sliver` | Go | All versions to 1.7.3 | None |

## How do I fix GHSA-c279-989m-238f?

No fix has been published for GHSA-c279-989m-238f yet. Limit exposure of the affected software until one is available.

## Is GHSA-c279-989m-238f being exploited?

There is no known exploitation of GHSA-c279-989m-238f in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-c279-989m-238f and fix it if it is affected.

What it is: GHSA-c279-989m-238f is a vulnerability in github.com/bishopfox/sliver, published on 29 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-c279-989m-238f in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/bishopfox/sliver (Go): affected all versions; no fix listed
- github.com/bishopfox/sliver (Go): affected all versions up to 1.7.3; no fix listed
- github.com/bishopfox/sliver (Go): affected all versions up to 1.7.3; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-c279-989m-238f/ (Markdown: https://insights.sbomify.com/GHSA-c279-989m-238f/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-c279-989m-238f

---
From sbomify Insights: https://insights.sbomify.com/GHSA-c279-989m-238f/
Summaries are generated and may contain mistakes; the official description above is the record.
