Yummy

Recon

nmap_scan.log|h-50%_styled

HTTP (80)

Writeup.png

Dashboard

We are able to login/register

Creds: test02@yummy.htb:Password123$

Writeup-1.png

Booking

We are able to reserve the tables, this adds record in the dashboard.

Writeup-2.png
Writeup-3.png

Reminders

Fuzzing for reminders shows nothing more then ours.

I thought there was injection in reminder via path, but everything is discarded after first number...

Checking for technologies:

Writeup-4.png

Source code shows template name and version:

Successful booking returns session cookie, in flask format? Server language is definitely Golang, so why Python?

Writeup-5.png

Export

The reminder redirects to /export/{FILENAME}.ics, this seems like LFI:

Writeup-6.png

LFI

LFI is possible if you're authorized, reminder endpoint is triggered and then export is modified

LFI Fuzzing

Start fuzzing for files, lmao

Note: Consider The Path for Testing Path Traversal Vulnerabilities with Pythonarrow-up-right methods, instead of raw sockets.

Cronjobs

/data/scripts/dbmonitor.sh

/data/scripts/table_cleanup.sh

/data/scripts/app_backup.sh

file = '/opt/app/app.py'

Backup exists in /var/www/backupapp.zip, and I didn't want to code saving file from socket output. Just use burp to first create Reminder, then change path and you'll download file automatically.

Forge JWT

Backup > ./config/signature.py

I had errors installing packages so I just used https://live.sympy.orgarrow-up-right

Add the following lines to get keys:

Actually that's garbage, because we need proper p and q values to create n, https://factordb.com/arrow-up-right can help.

jwt_tool kept giving errors about invalid certificates... Generate manually:

Replace your cookie, visit /dashboard, get redirected to /admindashboard.

Writeup-7.png

SQLi

Endpoint is vulnerable to SQLi:

users table only has us, registered users. No admin account at least in this database users table.

RCE via cronjob via OUTFILE

From 2nd injection I learned that user has file permissions, so access to OUTFILE is granted. If we take closer look at cronjobs previously there are exploitable, add scripts and last one will get executed.

Listen for connection and catch the shell.

Reverse Shell (mysql)

/data has dangerous permissions on directory, and app_backup.sh is ran by www-data

Privilege Escalation (www-data)

Create new cronjob task:

Privilege Escalation (qa)

SSH

Creds: qa:jPAd!XQCtn8Oc@2B

Flag.txt

Privilege Escalation (dev)

User has hg config file:

There were some hg archive files in /var/www I wanted to check out, but total waste of time.

I totally forgot that sudo -l command can be ran as other user 💀

Nothing interesting, same stuff as in /var/www

Looking into docs: https://www.mercurial-scm.org/doc/hgrc.5.htmlarrow-up-right

Repositories can have their own hgrc, not only users. Editing the qa user rc file didn't work, but if we add it to repository then it works.

Privilege Escalation (root)

The SUID bit shell didn't go as planned... If we upgrade to reverse shell we are proper dev user. Edit:

https://man7.org/linux/man-pages/man1/rsync.1.htmlarrow-up-right

rsync - a fast, versatile, remote (and local) file-copying tool

We can't directly read files, because path traversal will break. But rsync allows modification of ownership:--chown=USER:GROUP simple username/groupname mapping

Ownership were changed, but permissions stayed the same.

script loses the permissions... so no pty I guess

Last updated