Zipping

Recon

nmap_scan.log

HTTP (80)

Writeup.png

The only link leading to other pages is /shop

Pages are navigated via page param in request.

Writeup-1.png

LFI was not successful, but this might also be SQLi?

No success after some manual fuzzing on SQLi on different urls.

There was also Work With Us button leading to /upload.php

Writeup-2.png

LFI

Uploading valid Zip with PDF gives link:

Arbitrary file read via Symbolic Linksarrow-up-right

Cool, we can read files; but we preferably want to get RCE.

Alternative script with python

Creds: root:MySQL_P@ssw0rd!

Credentials don't work on SSH and there's no admin panel.

SQLi

For some reason products.php uses good queries, but not product.php; It's using raw SQL and blacklist...

Blacklist is bypassable by newline injection, because grep is only checking the first line and we are able to inject newline.

1 didn't work, but \n1 worked 🤔

Writeup-3.png

The regular expression matching has some requirements:

  1. Newline injection is possible, but at the first half

  2. To pass the condition we must have number at the end of the string

That's why \n1 -- - will fail, but \n1 -- - 1 will not.

Writeup-4.png

SQLMap fuckery

I thought this would be a good exercise to flex some SQLMap queries and it was fucking tough to get this shit to work 💀 but it finally worked:

SQLMap wasn't able to write into files, not in /var/www/html, in /tmp or even /dev/shm.

💀 Everything was correct, but it was using negative number in the first part so - character, which is blacklisted and it wasn't working because of that...! Lucky me...

SQLi + LFI = RCE

We can't write into /var/www/html/* even tho we are running as root, writing to /tmp/* works, but we can't include files... /dev/shm/* is writable and includable!!

Reverse Shell

Finally reverse shell

User.txt

Privilege Escalation

Upgrade reverse shell to SSH.

Password: St0ckM4nager

No idea what the binary does, but let's see what functions it uses. ltrace doesn't exist, but strace is available on the box.

"/home/rektsu/.config/libcounter.so" is missing, so some library is being loaded.

Create malicious so library:

Compile and transfer

Run the program, enter password so library get's loaded.

Check SSH

Root.txt

Last updated