Skip to content

ShellHub has cross-tenant IDOR in `GET /api/sessions/:uid` that discloses SSH session data

Moderate severity GitHub Reviewed Published Apr 29, 2026 in shellhub-io/shellhub • Updated May 14, 2026

Package

gomod github.com/shellhub-io/shellhub (Go)

Affected versions

<= 0.24.1

Patched versions

0.24.2

Description

Summary

GET /api/sessions/:uid returns the full session object for any authenticated caller, without scoping by the caller's tenant. An authenticated user can read session records (SSH username, device UID, remote IP, terminal type, authenticated flag, timestamps) belonging to any other namespace.

Severity

CVSS 3.1: 7.5 (High)
CWE-639

Affected versions

ShellHub Community v0.24.1 (by code inspection — same vulnerable pattern as GetDevice). Not plant-reproducible without an active SSH session, but the flaw is structurally identical and confirmed via static analysis.

Root cause

api/services/session.go:37-44GetSession resolves the session by UID without any tenant filter:

func (s *service) GetSession(ctx context.Context, uid models.UID) (*models.Session, error) {
    session, err := s.store.SessionResolve(ctx, store.SessionUIDResolver, string(uid))
    // ⚠️ missing: s.store.Options().InNamespace(tenant)
    ...
}

The Authorize middleware only verifies presence of a tenant in the context, not ownership of the requested session.

Proof of concept

Pre-requisite: attacker has any valid user account and has obtained a session UID from the victim tenant (UIDs may leak via logs, shared session recordings, UI URLs, or through the device IDOR in the companion advisory since sessions reference devices by UID).

ATTACKER_TOKEN=$(curl -s -X POST http://target/api/login \
  -H 'Content-Type: application/json' \
  -d '{"username":"attacker","password":"..."}' | jq -r .token)

# Attempt cross-tenant read
curl -i "http://target/api/sessions/<victim-session-uid>" \
  -H "Authorization: Bearer $ATTACKER_TOKEN"
# Expected (fixed):   HTTP 403/404
# Observed (v0.24.1): HTTP 200 + full session JSON

Impact

  • Cross-tenant disclosure of SSH session data: target username, device UID, remote IP, authenticated status, session type, terminal, position (geolocation), started_at / last_seen timestamps.
  • Enables reconnaissance of other tenants' active users and systems; combined with session recording features, can enable deeper recon.

Suggested fix

api/services/session.go — apply InNamespace in GetSession:

func (s *service) GetSession(ctx context.Context, uid models.UID) (*models.Session, error) {
    tenant := gateway.TenantFromContext(ctx)
    opts := []store.QueryOption{}
    if tenant != nil {
        opts = append(opts, s.store.Options().InNamespace(tenant.ID))
    }
    session, err := s.store.SessionResolve(ctx, store.SessionUIDResolver, string(uid), opts...)
    ...
}

References

@gustavosbarreto gustavosbarreto published to shellhub-io/shellhub Apr 29, 2026
Published to the GitHub Advisory Database May 6, 2026
Reviewed May 6, 2026
Published by the National Vulnerability Database May 13, 2026
Last updated May 14, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(10th percentile)

Weaknesses

Authorization Bypass Through User-Controlled Key

The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. Learn more on MITRE.

CVE ID

CVE-2026-44423

GHSA ID

GHSA-9w9c-9w8m-w89q

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.