Page cover

linuxWeek 9. Dog

SUMMARY

This is an Ubuntu 20.04 machine serving a web site built by a vulnerable version of Backdrop CMS 1.27.1. Credentials to log into the CMS dashboard are found in a .git folder that can be downloaded with a Git dumper. Once inside the Backdrop management site, we upload a module that enables a web shell and enumerate system users. One of them allows SSH login using the previously disclosed credentials.

Regarding escalation, we abuse sudo configuration on bee binary, a command line utility that developers use interact with Backdrop sites.

KEYWORDS

Backdrop CMS 1.27.1, Git dumper, sudo escalation.

ENUMERATION

Port scan.

> for ports in $(nmap $target -p- --min-rate=5000 -Pn --open --reason | grep open | awk -F "/" '{print $1}' | tr '\n' ',' | sed s/,$//); do nmap $target -p$ports -sV -sC -Pn -vv -n && echo "\nList of open ports: $ports";done

Starting Nmap 7.93 ( https://nmap.org ) at 2025-03-11 18:58 GMT
Nmap scan report for 10.10.11.58
Host is up, received user-set (0.14s latency).
Scanned at 2025-03-11 18:58:46 GMT for 17s
PORT   STATE SERVICE REASON  VERSION
22/tcp open  ssh     syn-ack OpenSSH 8.2p1 Ubuntu 4ubuntu0.12 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 972ad22c898ad3ed4dac00d21e8749a7 (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDEJsqBRTZaxqvLcuvWuqOclXU1uxwUJv98W1TfLTgTYqIBzWAqQR7Y6fXBOUS6FQ9xctARWGM3w3AeDw+MW0j+iH83gc9J4mTFTBP8bXMgRqS2MtoeNgKWozPoy6wQjuRSUammW772o8rsU2lFPq3fJCoPgiC7dR4qmrWvgp5TV8GuExl7WugH6/cTGrjoqezALwRlKsDgmAl6TkAaWbCC1rQ244m58ymadXaAx5I5NuvCxbVtw32/eEuyqu+bnW8V2SdTTtLCNOe1Tq0XJz3mG9rw8oFH+Mqr142h81jKzyPO/YrbqZi2GvOGF+PNxMg+4kWLQ559we+7mLIT7ms0esal5O6GqIVPax0K21+GblcyRBCCNkawzQCObo5rdvtELh0CPRkBkbOPo4CfXwd/DxMnijXzhR/lCLlb2bqYUMDxkfeMnmk8HRF+hbVQefbRC/+vWf61o2l0IFEr1IJo3BDtJy5m2IcWCeFX3ufk5Fme8LTzAsk6G9hROXnBZg8=
|   256 277c3ceb0f26e962590f0fb138c9ae2b (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM/NEdzq1MMEw7EsZsxWuDa+kSb+OmiGvYnPofRWZOOMhFgsGIWfg8KS4KiEUB2IjTtRovlVVot709BrZnCvU8Y=
|   256 9388474c69af7216094cba771e3b3beb (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPMpkoATGAIWQVbEl67rFecNZySrzt944Y/hWAyq4dPc
80/tcp open  http    syn-ack Apache httpd 2.4.41 ((Ubuntu))
| http-git: 
|   10.10.11.58:80/.git/
|     Git repository found!
|     Repository description: Unnamed repository; edit this file 'description' to name the...
|_    Last commit message: todo: customize url aliases.  reference:https://docs.backdro...
|_http-favicon: Unknown favicon MD5: 3836E83A3E835A26D789DDA9E78C5510
|_http-server-header: Apache/2.4.41 (Ubuntu)
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
| http-robots.txt: 22 disallowed entries 
| /core/ /profiles/ /README.md /web.config /admin 
| /comment/reply /filter/tips /node/add /search /user/register 
| /user/password /user/login /user/logout /?q=admin /?q=comment/reply 
| /?q=filter/tips /?q=node/add /?q=search /?q=user/password 
|_/?q=user/register /?q=user/login /?q=user/logout
|_http-title: Home | Dog
|_http-generator: Backdrop CMS 1 (https://backdropcms.org)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Nmap done: 1 IP address (1 host up) scanned in 17.41 seconds

List of open ports: 22,80

Browse the site with Firefox, a web site about obesity in dogs comes into view.

In Nmap output we see there is a .git folder, you can download the repository it with a remote git dumperarrow-up-right.

In the source code we find a user name in the file settings.php, and a password in the file update.settings.json

These can be used to login in the web site as tiffany:BackDropJ2024DS2024

After some enumeration, we find out this is Backdrop CMS 1.27.1.

This is vulnerable to authenticated RCEarrow-up-right.

USER

The aforementioned exploit generates a malicious ZIP file that can be uploaded as a Backdrop CMS module. Just need to indicate the target URL when running the exploit.

It has to be manually uploaded in http://dog.htb/?q=admin/installer/manualarrow-up-right

But the application only allows modules with .tar.gz extension, so first we have to unzip the shell file and then compress again as .tar.gz

After uploading the malicious module in .tar.gz format, a web shell is available in https://dog.htb/modules/shell/shell.php?cmdarrow-up-right

We already have a password, let's see if it has been reused in any of the system users.

First we enumerate the system users.

And try if SSH works for any of them. It works for johncusack

Under this shell, user flag can be retrieved.

ROOT

Start from the low-priv shell and take the opportunity to enumerate the user and the system.

Enumerate sudo settings.

Let's see what this stuff is about.

The most interesting is the -ev flag, which seems to be used to evaluate PHP statements. If has to be done after bootstrapping a Backdrop, this is done by indicating the Backdrop installation directory.

Use your favorite payload for the PHP expression to evaluate.

The only thing that's left is to spawn a root shell.

You are root.

REFERENCES

https://github.com/arthaud/git-dumperarrow-up-right

https://www.exploit-db.com/exploits/52021arrow-up-right

Last updated