Mercury

About Release

Download

Description

Difficulty: Easy

Mercury is an easier box, with no bruteforcing required. There are two flags on the box: a user and root flag which include an md5 hash. This has been tested on VirtualBox so may not work correctly on VMware. Any questions/issues or feedback please email me at: SirFlash at protonmail.com

Recon

└─$ ip -4 -brief address show eth0
eth0             UP             10.0.2.15/24

└─$ sudo netdiscover -i eth0 -r 10.0.2.0/24 | tee netdiscover.log
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname
 -----------------------------------------------------------------------------
 10.0.2.1        52:54:00:12:35:00      1      60  Unknown vendor
 10.0.2.2        52:54:00:12:35:00      1      60  Unknown vendor
 10.0.2.3        08:00:27:64:6e:66      1      60  PCS Systemtechnik GmbH
 10.0.2.18       08:00:27:79:c6:c3      1      60  PCS Systemtechnik GmbH
chevron-rightnmap_scan.loghashtag

HTTP (8000)

Writeup.png

Enumerate for files/directories:

common.txt didn't find anything, before raft-medium wordlist is running let's try to check pages. If we go to invalid page we get:

Writeup-1.png

We got a directory listing because of Debug mode.

/mercuryfacts

Writeup-2.png

Looks like developer is using direct mysql calls which is exploitable.

SQLi

http://10.0.2.18:8080/mercuryfacts/1'/arrow-up-right Injecting ' after 1 gives us SQL error:

Writeup-3.png

The SQL query:

swisskyrepo/PayloadsAllTheThings/SQL Injection/MySQL Injectionarrow-up-right

Get databases:

Get tables:

Get columns:

Get fields:

SQLMap

or just dump tables with sqlmap:

Hydra

Since there's no login for web app, try users on ssh:

SSH (22)

webmaster

circle-check

User.txt

Privilege Escalation (linuxmaster)

No sudo or suid binaries:

The webapp wasn't running from /var/www/html, check processes:

There are notes for local users with passwords.

Privilege Escalation (root)

User is part of an extra group:

(root : root) SETENV: /usr/bin/check_syslog.sh: Suggests that when "linuxmaster" uses sudo, an environment variable is set before running the actual command.

The program also doesn't use absolute path for tail command and since we can manipulate env variables we can exploit PATH variable.

Expected output:

Root.txt

Last updated