CTF: VulnNet

CTF: VulnNet

In this CTF we’ll be taking advantage of Linux, PHP misconfigurations, and LFI. To start off, I'm going to run an NMAP scan followed by a directory scan. We know from the start that there will be a web server so we'll dive right in and see what we can dig up.?

The NMAP scan discovered port 22 and 80 open. The directory scan displayed nothing out of the ordinary, an /img, /js/ and /css directories.?

No alt text provided for this image
No alt text provided for this image

I opened the site in a browser and looked at the page source. At the end of the source there are two JS scripts. I looked at them individually in the /js directory and one of the scripts displays a subdomain. In the other JS script, we find a referrer link, we will investigate both.?

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Ok, so it looks like we can take advantage of local file inclusion to try and enumerate users so later I can try to bruteforce the html login. Running "curl curl https://vulnnet.thm/index.php?referer=/etc/passwd" lets us know indeed LFI works, but it did not reveal any usernames. We know there is an Apache server, so we can search for the config file to further enumerate. I'm not exactly sure which directory I should be looking in, so I searched google for the information and tried several different paths. This was a bit of a time sink, but I found a tutorial on the DigitalOcean website about setting up Apache virtual hosts and that the config file is stored in "/etc/apache2/sites-enabled/000-default.conf". Even though this took forever, but this is how you learn so I added this information to my notes and soldiered on.?

It looks like we have an AuthUserFile to investigate.?

No alt text provided for this image

We receive a login and password hash which we'll crack.?

No alt text provided for this image

Cracking the hash with John reveals a password.?

No alt text provided for this image

Going to broadcast.vulnnet.thm and logging in with the credentials brings us to a ClipBucket page. I will create an account and go on from there.?

No alt text provided for this image

I created an account, but couldn’t find any exploitable surfaces from that angle, so I went to exploit DB to see if there were any vulnerabilities for ClipBucket v4.0. There are some serous vulnerabilities, "ClipBucket < 4.0.0 - Release 4902 - Command Injection / File Upload / SQL Injection" and we will take advantage of the file upload and upload a reverse shell. *credit to www.sec-consult.com.?

After uploading the .php file we will navigate to the directory and file specified and trigger the shell via netcat.?

No alt text provided for this image
No alt text provided for this image

I tried to access the server-management directory but did not have permission. So, I searched for files and folders that may be accessible/writeable and discovered this ssh backup file. I started a server and downloaded that file to my attack machine to authenticate via ssh.

No alt text provided for this image

I tried to login with the id_rsa via ssh, but it revealed that a password for the key is required. I then used ssh2john and john to find the keys password.?

No alt text provided for this image

I then logged in via SSH and searched the users home directory revealing the contents of the user flag.

No alt text provided for this image

I uploaded linpeas to the /tmp folder to do a quick scan of possible vulnerabilities and the only thing that looked interesting was a cronjob for a backup file. ?

No alt text provided for this image
No alt text provided for this image

We do not have permission to write to the file, so we have to find another way. I spent some time googling it and utilized a previous walkthrough and GTFObins to help me break this barrier. *credit to Aldeid and GTFObins.?

No alt text provided for this image

We will set up a netcat listener and a reverse shell that will be executed with privilege when the cronjob is triggered.?

No alt text provided for this image

After the shell is triggered, we receive root privileges and can capture the root flag.?

No alt text provided for this image
Chris Kirby-Smith

Technical Writer and Business Analyst at SecuriGence | Security+ Certified

2 年

Awesome write up! This is a little beyond my current skillset but I’m motivated to continue learning and can’t wait to tackle similar CTFs soon.

要查看或添加评论,请登录

Daniel McNally的更多文章

  • Project 1 - DVWA

    Project 1 - DVWA

    During the latest FXBG Hackers meeting, a newcomer attended for the second time. He expressed an interest in…

  • Security Analyst Notes: Things to Remember

    Security Analyst Notes: Things to Remember

    Over the last two years during my training, I've been taking notes along the way on all different topics that have been…

    7 条评论
  • PyScript Domains > 72 Char.

    PyScript Domains > 72 Char.

    Last night I was reading one of the go-to blue team compendiums, Blue Team Handbook, by Don Murdoch and it was going…

    1 条评论
  • Malware Analysis Notes: Putty.exe

    Malware Analysis Notes: Putty.exe

    I finally was able to get back around to working on the PMAT course by, HuskyHacks and TCM Security. These are my notes…

    1 条评论
  • Snort 3 vs MiTM Attacks

    Snort 3 vs MiTM Attacks

    Executive Summary: There are pros and cons when using Snort's Intrusion Prevention and Intrusion Detection System…

  • Manual Log Parsing with Cut, AWK and Python

    Manual Log Parsing with Cut, AWK and Python

    This will be a quick tutorial aimed at people who are infosec newbies or are new to Linux in general that are…

    1 条评论
  • Blue Team CTF: Warzone 1

    Blue Team CTF: Warzone 1

    To continue to work on my ability to parse logs and sniff out possible IOC's, I will be tackling another blue team CTF…

  • Splunk BOTSv3 AWS & WINEvent

    Splunk BOTSv3 AWS & WINEvent

    AWS S3 Bucket Challenge Today I will be finishing up my Splunk course with 2 more blue team CTFs. The first challenge…

    1 条评论
  • Splunk BOTSv3 Web & OneDrive

    Splunk BOTSv3 Web & OneDrive

    The past week I’ve been spending most of my time trying to complete a Splunk learning path to gain an understanding of…

  • CTF: SNORT Basics Pt. 1

    CTF: SNORT Basics Pt. 1

    Today I will be running through a blue team CTF focused on using the IDS/IPS Snort. Snort can be used both passively…

    5 条评论

社区洞察

其他会员也浏览了