RubyDome

Nmap Scan

$ nmap -sC -sV -p- --min-rate 10000 -Pn -oN nmap 192.168.194.22
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-14 09:56 +08
Nmap scan report for 192.168.194.22
Host is up (0.0062s latency).
Not shown: 65533 closed tcp ports (conn-refused)
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 b9:bc:8f:01:3f:85:5d:f9:5c:d9:fb:b6:15:a0:1e:74 (ECDSA)
|_  256 53:d9:7f:3d:22:8a:fd:57:98:fe:6b:1a:4c:ac:79:67 (ED25519)
3000/tcp open  http    WEBrick httpd 1.7.0 (Ruby 3.0.2 (2021-07-07))
|_http-title: RubyDome HTML to PDF
|_http-server-header: WEBrick/1.7.0 (Ruby/3.0.2/2021-07-07)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 11.95 seconds

Initial Access

Port 3000

When we first access the website, this is what we will see.

If we put our own IP address, it will give this error.

CVE-2022-25765

After searching online, there is this exploit that we might be able to use.

This is the exploit that we will be using:

We need to first figure out how to use this exploit.

We will use the -s parameter as we need to get back a reverse shell.

We will also require the -w parameter to put our target URL and -p for the parameter.

After capturing the request, we can see that the parameter name is url.

After getting all the relevant information needed, we are able to execute the exploit.

After waiting a while, we are able to get back a reverse shell.

Privilege Escalation

Upgrading Shell

First thing we should do is it upgrade to a fully interactive shell using Upgrading Shells

Sudo -l

There is a command which the user can run as root.

There is a ruby script which will call a reverse shell. However, this script requires to be modified to fit our use case.

The modified version of the ruby script.

We also need to check if we can edit the file which is stated in sudo -l.

When we reach there, we can see that our current user is able to edit the file.

The first thing we should do is to rename app.rb into app.rb.old.

Next, we should to create app.rb locally using visual studio code first before we download into our target.

The next step is to trigger the reverse shelling using sudo.

After a while, we are able to get root.

Last updated