Termix Stored XSS via Malicious SVG Upload -> LFI / Session Hijack (CVE-2026-22804 / GHSA-m3cv-5hgp-hv35)
by ThemeHackers · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-22804 (GHSA-m3cv-5hgp-hv35)
- Category
- web
- Affected product
- Termix (Electron-based SSH/terminal manager), File Manager component (FileViewer.tsx)
- Affected versions
- Release 1.7.0 - 1.9.0
- Disclosed
- 2026-07-05
- Patch status
- patched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-01 |
| Author / Researcher | ThemeHackers |
| CVE / Advisory | CVE-2026-22804 (GHSA-m3cv-5hgp-hv35) |
| Category | web |
| Severity | High |
| CVSS Score | Not specified in source |
| Status | Weaponized |
| Tags | termix, electron, stored-xss, svg-injection, session-hijacking, lfi, file-manager, ssh |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Termix (Electron-based SSH/terminal manager), File Manager component (FileViewer.tsx) |
| Versions Affected | Release 1.7.0 - 1.9.0 |
| Language / Platform | Node.js/Electron target; Python 3 exploit client |
| Authentication Required | Yes (attacker needs a Termix account and an SSH-reachable host to stage the file) |
| Network Access Required | Yes |
Summary
Termix’s built-in File Manager renders SVG files opened from a connected host using dangerouslySetInnerHTML, without stripping active content such as <foreignObject>/<img onerror=...>. An attacker who can place a crafted SVG on a filesystem reachable via Termix’s SSH file manager (e.g. a shared or attacker-controlled SSH host) can get arbitrary JavaScript executed in the Termix Electron renderer the moment a victim opens the file. Because Termix runs as an Electron desktop app, this stored XSS can be leveraged to read local files (bypassing normal browser same-origin restrictions) and to steal the victim’s session data (JWT in localStorage and cookies). The included Python script automates login/registration against the Termix backend, provisions an SSH host entry pointing at localhost, connects over SSH via Termix’s internal API, and uploads a malicious cookie_stealer.svg into the target directory.
Vulnerability Details
Root Cause
FileViewer.tsx renders attacker-controlled SVG file contents via dangerouslySetInnerHTML with no sanitization, allowing an embedded <foreignObject> block containing arbitrary HTML/JS (triggered via an <img src="x" onerror="..."> vector) to execute in the app’s rendering context.
Attack Vector
- Attacker authenticates to the victim’s Termix backend (or registers an account) and adds an SSH host entry (e.g. pointing at a host they control or
localhost). - Attacker connects to that SSH host through Termix’s file-manager SSH API.
- Attacker uploads
cookie_stealer.svg— an SVG containing a<foreignObject>/<img onerror>payload that readslocalStorageanddocument.cookie— into a directory visible to the victim (e.g./home/kali). - Victim opens the File Manager in the Termix app and clicks the SVG file to preview it.
- The payload executes in the Electron renderer, displaying the stolen JWT/cookies in an on-screen overlay (and, in the Electron context, opening the door to further local file reads).
Impact
Execution of arbitrary JavaScript inside a victim’s Termix desktop session, leading to theft of authentication tokens/cookies and, given Electron’s relaxed sandboxing versus a browser, potential local file disclosure.
Environment / Lab Setup
Target: Termix release 1.7.0-1.9.0 (backend on :30001, file-manager API on :30004, Electron frontend)
Attacker: Python 3, requests (pip install requests), local SSH server for staging the payload
Proof of Concept
PoC Script
See
exploit.pyin this folder.
| |
The script logs in (or self-registers), creates/reuses an SSH host entry pointing at localhost with a generated key pair, opens an SSH session through Termix’s file-manager API, and uploads cookie_stealer.svg to /home/kali. Opening that file in the Termix File Manager triggers the embedded payload, which exfiltrates localStorage (JWT) and cookies into an on-screen “SESSION HIJACKED!” overlay.
Detection & Indicators of Compromise
Signs of compromise:
- Unfamiliar SVG files (e.g. named like
cookie_stealer.svg) appearing in directories browsed via Termix’s File Manager - Unexpected alert/overlay dialogs when previewing files in the Termix app
- Termix session tokens or SSH host credentials observed in use from unfamiliar IPs shortly after a file was previewed
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to a patched Termix release addressing GHSA-m3cv-5hgp-hv35 (sanitize/disable active SVG content in the File Manager preview) |
| Interim mitigation | Disable or restrict SVG preview in the File Manager; avoid opening files from untrusted/shared SSH hosts; treat Termix’s stored JWT/cookies as sensitive and rotate after suspicious activity |
References
Notes
Mirrored from https://github.com/ThemeHackers/CVE-2026-22804 on 2026-07-05.
| |