Try Hack me — Advent Of Cyber 2023 Day 22 Write Up — Jingle Your SSRF Bells: A Merry Command &…
2024-1-14 21:0:18 Author: infosecwriteups.com(查看原文) 阅读量:9 收藏

Leendert Coenen

InfoSec Write-ups

Room: Advent of Cyber 2023 Day 22

Try Hack me — Advent Of Cyber 2023 Day 22 Write Up — Jingle Your SSRF Bells: A Merry Command & Control Hackventure

Server-Side Request Forgery is a type of security vulnerability where an attacker can manipulate a web application to make requests on behalf of the server. The attacker can typically force the server to perform requests to other resources or services, often internal to the network, that it wouldn’t normally have access to.

The tasks are a bit all over the place, so let’s first go step by step on how to do the actual SSRF exploitation.

First we’ll add the ip to the hosts file of our attackbox. This will allow us to use the domain name, instead of the IP address, in our browser.

sudo nano /etc/hosts
Changing the hosts file
Nano hosts file

Be sure to fill in the IP address of your machine (Not your attackbox, the IP THM gave you)

If that all went well, you can go to the website. We see it is protected with a username and password.

To get in, we will use a SSRF exploit.

Mc greedy’s Dashboard Login portal

When pressing the green “Accessing through API” button, we are greeted with some API documentation.

This documentation provides us with some interesting information. To get messages you can simply make a call to a Word document.

http://10.10.10.20/getClientData.php?url=http://10.10.10.10/messages.docx

It also says that there is a file called config.php on the server. That contains the credentials to the dashboard. So now we know where to look.

API documentation

So how do we exploit this?

The given URL has a URL as a parameter. Which is that last part, what if we try to fetch data from the host, instead of a client IP?

Since we know the website is running on PHP, we can take a look at the default directory that a PHP website’s index file is located.

As expected, it returned the index.php file in clear text. On line 3 we can see it includes the config.php file. To check the credentials that are entered.

Something else we can try is the /etc/passwd directory. Which includes usernames and passwords on the machine.

cat /etc/passwd

We can see a lot of users, but the passwords are displayed as an “X”


文章来源: https://infosecwriteups.com/try-hack-me-advent-of-cyber-2023-day-22-write-up-jingle-your-ssrf-bells-a-merry-command-7aba6da24fe1?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh