Vulnerability in KDE Konsole allows code execution when a page is opened in a browser

In the developing KDE terminal emulator project Konsole, a vulnerability (CVE-2025-49091) has been identified that allows for code execution on the system when a specially crafted page is opened in the browser.

For Konsole, the KTelnetService (ktelnetservice6.desktop) is registered by default in KDE, connecting handlers for the URL schemes telnet://, rlogin://, and ssh:// opened in the browser. When processing these schemes in the terminal emulator, the telnet, rlogin, and ssh utilities are launched with the specified path given in the link.

The vulnerability arises from the fact that if the telnet, rlogin, or ssh utilities are not installed on the system, Konsole, when calling the corresponding URL handler, executed the bash command interpreter. For example, if telnet is missing and a link like "telnet://proc/self/cwd/Downloads/evil" is opened in the browser, Konsole would execute "/bin/bash /proc/self/cwd/Downloads/evil". Similarly, an attack can be executed on the rlogin:// and ssh:// handlers if the associated rlogin and ssh utilities are not present in the system.

L'uso di vulnerabilità è accompagnato dal fatto che nelle configurazioni predefinite delle versioni moderne di Firefox e Chrome, i file avviati per il download vengono automaticamente salvati senza mostrare una richiesta all'utente, mostrano solo una notifica riguardo al completamento del download. In Firefox, questo comportamento può essere disabilitato impostando l'opzione "Always ask you where to save files" nella pagina delle impostazioni "General > Files and Applications". In genere, i file vengono salvati nella cartella ~/Downloads, alla quale si può fare riferimento attraverso il percorso "/proc/self/cwd/Downloads/" senza conoscere il nome dell'utente attuale.

Di seguito è riportato un esempio di codice JavaScript che, quando eseguito nel browser in ambienti KDE con Konsole, eseguirà i comandi «echo «Hello world»; touch /tmp/foobar» (nella stringa è codificato come «data:;base64,ZWNobyAiAiSGVsbG8gd29ybGQiCnRvdWNoIC90bXAvZm9vYmFyCg==»). Il codice proposto crea un collegamento con dati incorporati, simula un clic su questo collegamento e reindirizza l'utente all'URL «telnet://…». Per funzionare in Chrome, è necessario modificare il nome del file nel link in evil.txt, poiché Chrome aggiunge automaticamente l'estensione txt. <html> <head> <script type=»text/javascript»> function downloadAndRedirect() { const anchor = document.createElement(‘a’); anchor.href = «data:;base64,ZWNobyAiSGVsbG8gd29ybGQiCnRvdWNoIC90bXAvZm9vYmFyCg==»; anchor.download = ‘evil’; document.body.appendChild(anchor); anchor.click(); document.body.removeChild(anchor); setTimeout(() => { window.location.href = «telnet:///proc/self/cwd/Downloads/evil»; }, 1000); } </script> </head> <body onload="»downloadAndRedirect()»"> </body> </html>

In Firefox e Chrome, quando si tenta di seguire il collegamento "telnet://", per impostazione predefinita verrà visualizzata una richiesta per confermare l'operazione all'utente. In caso di consenso, KTelnetService avvierà il comando: /usr/bin/konsole —noclose -e telnet /proc/self/cwd/Downloads/evil

Se nel sistema non è presente l'utilità telnet, Konsole si avvierà su bash invece di telnet, passando l'argomento originariamente specificato nella riga di comando.

Il problema è stato risolto nella versione Konsole 25.04.2, inclusa nell'aggiornamento KDE Gear 25.04.2. È possibile seguire la risoluzione della vulnerabilità nelle distribuzioni sulle seguenti pagine: Debian, Ubuntu, Fedora, SUSE/openSUSE, RHEL, Arch, FreeBSD. Come soluzioni alternative per bloccare la vulnerabilità, è possibile installare gli strumenti telnet, rlogin e ssh oppure rimuovere il file /usr/share/applications/ktelnetservice6.desktop.

Fonte: opennet.ru

Acquista hosting affidabile per siti web con protezione DDoS, VPS VDS server 🔥 Acquista hosting affidabile per siti web con protezione DDoS, VPS VDS server | ProHoster