Pwned Date - 14th June 2022

Enumeration

┌──(kali㉿VirtualBox)-[~]
└─$ rustscan -a 192.168.181.48

PORT     STATE SERVICE     REASON
22/tcp   open  ssh         syn-ack
80/tcp   open  http        syn-ack
1898/tcp open  cymtec-port syn-ack
┌──(kali㉿VirtualBox)-[~]
└─$ nmap -sC -sV 192.168.181.48 -p 22,80,1898

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 46:b1:99:60:7d:81:69:3c:ae:1f:c7:ff:c3:66:e3:10 (DSA)
|   2048 f3:e8:88:f2:2d:d0:b2:54:0b:9c:ad:61:33:59:55:93 (RSA)
|   256 ce:63:2a:f7:53:6e:46:e2:ae:81:e3:ff:b7:16:f4:52 (ECDSA)
|_  256 c6:55:ca:07:37:65:e3:06:c1:d6:5b:77:dc:23:df:cc (ED25519)
80/tcp   open  http?
| fingerprint-strings: 
|   NULL: 
|     _____ _ _ 
|     |_|/ ___ ___ __ _ ___ _ _ 
|     \\x20| __/ (_| __ \\x20|_| |_ 
|     ___/ __| |___/ ___|__,_|___/__, ( ) 
|     |___/ 
|     ______ _ _ _ 
|     ___(_) | | | |
|     \\x20/ _` | / _ / _` | | | |/ _` | |
|_    __,_|__,_|_| |_|
1898/tcp open  http    Apache httpd 2.4.7 ((Ubuntu))
|_http-server-header: Apache/2.4.7 (Ubuntu)
| 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-generator: Drupal 7 (<http://drupal.org>)
|_http-title: Lampi\\xC3\\xA3o
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Untitled

There is something strange here, by default nmap can show out the http-robots.txt

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
┌──(kali㉿VirtualBox)-[~]
└─$ gobuster dir -u <http://192.168.181.48:1898> -w /usr/share/wordlists/dirb/common.txt -q -t 100
/.htaccess            (Status: 403) [Size: 292]
/.hta                 (Status: 403) [Size: 287]
/.htpasswd            (Status: 403) [Size: 292]
/includes             (Status: 301) [Size: 325] [--> <http://192.168.181.48:1898/includes/>]
/index.php            (Status: 200) [Size: 11446]                                         
/misc                 (Status: 301) [Size: 321] [--> <http://192.168.181.48:1898/misc/>]    
/modules              (Status: 301) [Size: 324] [--> <http://192.168.181.48:1898/modules/>] 
/profiles             (Status: 301) [Size: 325] [--> <http://192.168.181.48:1898/profiles/>]
/robots.txt           (Status: 200) [Size: 2189]                                          
/scripts              (Status: 301) [Size: 324] [--> <http://192.168.181.48:1898/scripts/>] 
/server-status        (Status: 403) [Size: 296]                                           
/sites                (Status: 301) [Size: 322] [--> <http://192.168.181.48:1898/sites/>]   
/themes               (Status: 301) [Size: 323] [--> <http://192.168.181.48:1898/themes/>]  
/web.config           (Status: 200) [Size: 2200]                                          
/xmlrpc.php           (Status: 200) [Size: 42]
#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
#
# This file will be ignored unless it is at the root of your host:
# Used:    <http://example.com/robots.txt>
# Ignored: <http://example.com/site/robots.txt>
#
# For more information about the robots.txt standard, see:
# <http://www.robotstxt.org/robotstxt.html>

User-agent: *
Crawl-delay: 10
# CSS, JS, Images
Allow: /misc/*.css$
Allow: /misc/*.css?
Allow: /misc/*.js$
Allow: /misc/*.js?
Allow: /misc/*.gif
Allow: /misc/*.jpg
Allow: /misc/*.jpeg
Allow: /misc/*.png
Allow: /modules/*.css$
Allow: /modules/*.css?
Allow: /modules/*.js$
Allow: /modules/*.js?
Allow: /modules/*.gif
Allow: /modules/*.jpg
Allow: /modules/*.jpeg
Allow: /modules/*.png
Allow: /profiles/*.css$
Allow: /profiles/*.css?
Allow: /profiles/*.js$
Allow: /profiles/*.js?
Allow: /profiles/*.gif
Allow: /profiles/*.jpg
Allow: /profiles/*.jpeg
Allow: /profiles/*.png
Allow: /themes/*.css$
Allow: /themes/*.css?
Allow: /themes/*.js$
Allow: /themes/*.js?
Allow: /themes/*.gif
Allow: /themes/*.jpg
Allow: /themes/*.jpeg
Allow: /themes/*.png
# 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/

Going to /CHANGELOG.txt to see what is the current version of the software used!

Drupal 7.54, 2017-02-01
-----------------------
- Modules are now able to define theme engines (API addition:
  <https://www.drupal.org/node/2826480>).
- Logging of searches can now be disabled (new option in the administrative
  interface).
- Added menu tree render structure to (pre-)process hooks for theme_menu_tree()
  (API addition: <https://www.drupal.org/node/2827134>).
- Added new function for determining whether an HTTPS request is being served
  (API addition: <https://www.drupal.org/node/2824590>).
- Fixed incorrect default value for short and medium date formats on the date
  type configuration page.
- File validation error message is now removed after subsequent upload of valid
  file.
- Numerous bug fixes.
- Numerous API documentation improvements.
- Additional performance improvements.
- Additional automated test coverage.

Exploitation

It is using Drupal 7.54! A quick Google Search:

Untitled

Following the blog post https://vk9-sec.com/drupal-7-x-module-services-remote-code-execution/ But sadly, nothing works here

┌──(kali㉿VirtualBox)-[~/vpn]
└─$ searchsploit drupal 7.x
------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                                                                                               |  Path
------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Drupal 7.x Module Services - Remote Code Execution                                                                                                           | php/webapps/41564.php
Drupal < 7.34 - Denial of Service                                                                                                                            | php/dos/35415.txt
Drupal < 7.58 - 'Drupalgeddon3' (Authenticated) Remote Code (Metasploit)                                                                                     | php/webapps/44557.rb
Drupal < 7.58 - 'Drupalgeddon3' (Authenticated) Remote Code Execution (PoC)                                                                                  | php/webapps/44542.txt
Drupal < 7.58 / < 8.3.9 / < 8.4.6 / < 8.5.1 - 'Drupalgeddon2' Remote Code Execution                                                                          | php/webapps/44449.rb
Drupal < 8.3.9 / < 8.4.6 / < 8.5.1 - 'Drupalgeddon2' Remote Code Execution (Metasploit)                                                                      | php/remote/44482.rb
Drupal < 8.3.9 / < 8.4.6 / < 8.5.1 - 'Drupalgeddon2' Remote Code Execution (PoC)                                                                             | php/webapps/44448.py
Drupal < 8.5.11 / < 8.6.10 - RESTful Web Services unserialize() Remote Command Execution (Metasploit)                                                        | php/remote/46510.rb
Drupal < 8.6.10 / < 8.5.11 - REST Module Remote Code Execution                                                                                               | php/webapps/46452.txt
Drupal < 8.6.9 - REST Module Remote Code Execution                                                                                                           | php/webapps/46459.py
Drupal avatar_uploader v7.x-1.0-beta8 - Arbitrary File Disclosure                                                                                            | php/webapps/44501.txt
Drupal avatar_uploader v7.x-1.0-beta8 - Cross Site Scripting (XSS)                                                                                           | php/webapps/50841.txt
Drupal Module CKEditor < 4.1WYSIWYG (Drupal 6.x/7.x) - Persistent Cross-Site Scripting                                                                       | php/webapps/25493.txt
Drupal Module Coder < 7.x-1.3/7.x-2.6 - Remote Code Execution                                                                                                | php/remote/40144.php
Drupal Module RESTWS 7.x - PHP Remote Code Execution (Metasploit)                                                                                            | php/remote/40130.rb
------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results

If about to use Metasploit, this is the module to be used:

msf6 exploit(unix/webapp/drupal_coder_exec) > search Drupal

Matching Modules
================

   #  Name                                           Disclosure Date  Rank       Check  Description
   -  ----                                           ---------------  ----       -----  -----------
   0  exploit/unix/webapp/drupal_coder_exec          2016-07-13       excellent  Yes    Drupal CODER Module Remote Command Execution
   1  exploit/unix/webapp/drupal_drupalgeddon2       2018-03-28       excellent  Yes    Drupal Drupalgeddon 2 Forms API Property Injection
   2  exploit/multi/http/drupal_drupageddon          2014-10-15       excellent  No     Drupal HTTP Parameter Key/Value SQL Injection
   3  auxiliary/gather/drupal_openid_xxe             2012-10-17       normal     Yes    Drupal OpenID External Entity Injection
   4  exploit/unix/webapp/drupal_restws_exec         2016-07-13       excellent  Yes    Drupal RESTWS Module Remote PHP Code Execution
   5  exploit/unix/webapp/drupal_restws_unserialize  2019-02-20       normal     Yes    Drupal RESTful Web Services unserialize() RCE
   6  auxiliary/scanner/http/drupal_views_user_enum  2010-07-02       normal     Yes    Drupal Views Module Users Enumeration
   7  exploit/unix/webapp/php_xmlrpc_eval            2005-06-29       excellent  Yes    PHP XML-RPC Arbitrary Code Execution

Interact with a module by name or index. For example info 7, use 7 or use exploit/unix/webapp/php_xmlrpc_eval

msf6 exploit(unix/webapp/drupal_coder_exec) > use 1
[*] No payload configured, defaulting to php/meterpreter/reverse_tcp

On the other hand, we can read the blog post by tiago user on http://192.168.87.48:1898/?q=node/1, seems like its all foreign language, why not get every single string and make a wordlist for dictionary attack?

┌──(kali㉿VirtualBox)-[~/Desktop]
└─$ cewl <http://192.168.87.48:1898/\\?q\\=node/1> --write lampiao_wordlist.txt
CeWL 5.5.2 (Grouping) Robin Wood ([email protected]) (<https://digi.ninja/>)