BOLT

129b0cdac2edf480d49c68d2fefa7995.png

Summary

Bolt is a medium-difficulty Linux machine featuring a custom web application and a Docker image that contains multiple layers with deleted files. Enumerating the deleted database files reveals credentials for an application and hints to the demo site. Further enumeration of the Docker image reveals an invitation token which allows registration on the site. The site is vulnerable to SSTI. Enumerating Passbolt configuration reveals database credentials that can be used to achieve lateral movement. The root password can be obtained by exploiting the Passbolt server.

port Enumeration

Firs thing I did was enumerating ports using nmap.

nmap -p- --open -n -T5 -vvv -Pn 10.10.11.114

This reveals three open ports:

22/tcp  open  ssh   syn-act  ttl 63
80/tcp  open  http  syn-act  ttl 63
443/tcp open  https syn-act  ttl 63

I enumerate the service versions to look for possible vulnerabilities.

627247c3f7fd6e0c7069724031369bdb.png

I can't see evident vulnerabilities here.

On ports 80 and 443 we see different pages; port 80 appears to host some kind of administration site.

958af279e09b4adcbdc0fdcdbdfc250a.png

And, in the port 443, we can see a passbolt instance, passbolt, a web-ui password manager, thats interesting.

cfbdbcb7dbebc56f9e4b4d2dc278c412.png

But I need a valid invitation to access it, so, lets continue the enumeration.

d05d845a02e25841cd607726a8c4f66b.png

Wfuzz enumeration

Now, I will use wfuzz to enumerate all the posible paths and subdomains in this page.

wfuzz -c -w /usr/share/wordlists/directory-list-1.0.txt -u http://bolt.htb/FUZZ

I find a lot of paths in the main page.

5df1a8e7a4b45f21fbc84118e14cf3d9.png

And 2 subdomains mail and demo.

wfuzz -c -w /usr/share/wordlists/subdomains-top100000.txt -u http://bolt.htb --hw 1801 -H "Host: FUZZ.bolt.htb"

39b69569a31cfe3cf4fa1a1212b6d45c.png

In the subdomain demo, we find what it looks like a clone of the login page in the main page, if we use basic logic and see the name of the subdomain, we can sey that this is a demo version of the main page.

dc7e03341fe063b7d2d8f70d16e522fe.png

In the subdomain mail, we can see a roundcube instance.

3ac0584f44eef4745883d96a22c22bfb.png

Then, I will explore the main page, and in download, I find something interesting, a docker image download.

1a73e92f935639d16a9b8c625fc9eba0.png

I download the image, what seems like a flash webapp, so, lets search for posible filtred data in these files.

Docker image enumeration

e4968b3c07f32061e6aced924ccbdcd1.png

First thing I found was database files, so, lest see what is inside this.

48efa48734b368ba3b7cb3bdceb0e3c9.png

Here we find a beautifull entrance, user admin, and a hash.

26ce7fb8a574df477b4f4ee789ba2df2.png

We use john and reveal the password.

428438ae7c4ccad4d17fb53f99250c56.png

I also find what seems like a invitation code.

Web enumeration with new credentials

Then I use the admin credentials to access his profile in the main page.

8c4c1abf5269df65c4a524b275049c6e.png

I cant do a lot here.

In passbolt, admin isnt a valid user.

c97f7334b54a2c0785bfc321843d1059.png

The same with the mail page.

9e9dcdf181677dd6437d4a0064aa7e6a.png

In demo, you cant log with admin user, BUT, with the code who I found in the docker files, I can create a demo account, so, I did exactly this.

20fb7764669e617edd0fe2f2c863e628.png

The account who I just created works in the mail page.

59603a40c0d033544c4b45c84672e413.png

So, after searching, I found a settings page, and, when I try change something, the page sends me an email.

d622f69987d43224eb0ce60836d83ca5.png

c6003904a4a2d9e16c45dfeb67511e6f.png

STTI Exploitation

And, after a bit of testing, i found a SSTI vulnerability in this exact form.

403b8bfa082cd9cd6be8402ab4cb6cb8.png

With this, first, I read /etc/password, where I can see that eddie and clark are the users names in this system.

And, of course, I made a reverse shell using that entrance.

c54fadd0d52f7094a687b745f7597e63.png

Local system enumeration

In the webfiles, i found the file passbolt.php, who looks like a config file for the passbolt user, and in this file, I find a database credentials.

27097fcc7ad9e082849fce40cf855ee3.png

And even better, this exact password, is the password of the user eddie

e87bb077239508c1b2321762bd0b5631.png

Looking in the eddie's mails, I find that Clark sends a mail to Eddie telling him that if Eddie loses his passbolt priv key, that's all, he will not be able to recover it.

30472ec984954e78e91f943566b99217.png

Database enumeration

Using the credentials who I found in passbolt.php I can log in the passbolt database, and read it.

604ef6802af6972ad919f8c16111af80.png

There we can find a lot of interesting tables, users and secrets.

In secrets we found what appears to be an encrypted message. Since this is a password manager, this is likely an encrypted password.

4d4099f5fa4bba84c89cdc39a0e64c54.png

So, at this point we need the private key to decrypt this message. I searched the local system with find.

find / -type f -exec grep -aF -l “BEGIN PGP PRIVATE KEY BLOCK”{} + 2>>/dev/null

Secret message decrypt

I found it, in the crome logs.

02fc89ba597cdbfb1d6a254d0d738b83.png

So, after cleaning the key, I use gpg2john to extract the keys password hashes.

gpg2john eddieprivkeylimpio.txt > secret.hash

fde0992186f287569414b7f7f54be847.png

Then I used John the Ripper to crack the key's password.

john --wordlist=/usr/share/wordlists/rockyou.txt secret.hash

a2777f5cf8d3af6a61a75a8df35a958a.png

With this password, I imported the key into GPG.

gpg --import eddieprivkeylimpio.txt

879e72ad6c6a2b07bfe6b8874b648eeb.png

With that, I decrypted the secret message I found in the database.

48534d1bae414e1fe96437ec0c5238eb.png

161a6d4e06ed449d971c7ddcf946cd88.png

That password is the root password — I just need to log in to the local machine.

9e84873470d45a7484feef41e5db9fbb.png

Other ways

One thing who i didnt read in my firs run was that, in the passbolt db, you can find a session token.

d56f5cbdd7f12545d2f3610a2348e8cd.png

The only active tocken is an active token, after searching in the documentation, I found how to use it.

da9c1eb6bf92d1b4f4e78a4a45072c99.png

The app will need a browser extension.

68218926278d3f0307cd40316c8381dd.png

After this, it will need the priv key.

58369981a7a6c3852d2495d985930f3c.png

After this, you will need to use the password, so, you will need to use the gpg2john like in the last run.

e6a4c785de2ee51f07ded9b8af9469a5.png

And, after this, we can see the root password

001cda1cf6a02dc2bb29df392851e5c8.png

You can also scalate with dirty pipe, but this vulnerability was discovered after the creation of this CTF, so it's clear that this is not the path you're supposed to take.