Home CTFs | CTF-inter-INSA2024 | Realist | Uptodate
Post
Cancel

CTFs | CTF-inter-INSA2024 | Realist | Uptodate

Let’s run nmap on the target:

nmap

There is one open port:

  • 80 -> website

The website is running drupal which is an open source CMS.

index_php

We can find out the version of the CMS:

version

I found an exploit on github to get a web shell.

rce

I used it to launch a reverse shell with a reverse shell. I used ngrok and netcat as listeners. Then I stabilized the shell.

In the /home/debian directory, we get the user flag.

rce

After searching for 1 hour, I found out that the password of debian is “debian” 😅.

The user www-data can execute /home/debian/ping.py with sudo.

sudo_l_debian

The ping.py script import the requests library. Since we control the debian home folder, we can create a requests.py folder to library hijacking.

We create a requests.py scripts in /home/debian

1
2
3
import os

os.system("/bin/bash")

We get back to the www-data session and run sudo /home/debian/ping.py

We get a root shell and the flag

root_flag

This post is licensed under CC BY 4.0 by the author.