HITB2018DXB Pre-Conf CTF | Write up



In this topic, I will share with your the write-up about the HITB2018DXB Pre-Conf CTF from Cyber Talents I will solve the web security challenges.


First challenge [who am i for 50 points]:


at the first when we open the challenge we will found a login form so the first thing I tried to do it's open the source and look on it and I found that


so I used this account to enter the panel but I found that I should be an admin to see the flag


I think for a few minutes and I try to see the cookies and I found this



the value is encoded with base64 so when I decode it I found this value login=Guest now I changed the Guest to admin and encode it again and I tried to open the page again and I found the flag


the flag is: FLag{B@D_4uTh1Nt1C4Ti0n}


-----------


The second challenge [Dark project for 100 points]:

when you open the challenge you will find that there is a page when you open one from it there is a new parameter and the page name will be the value of this parameter home=about now the first thing I thought about the local file inclusion (LFI) when I tried to read passwd file I can't so I think there is a Filter to protect the website so I search for LFI bypass I found an interesting thing that PHP filter I can use it to read the bypass the LFI protection the final payload is

php://filter/convert.base64-encode/resource=index

this code will output the index file but encoded with base64, when I use it I found this in the source code


when I decode it I found a PHP code and there is a variable called flag and the value is {pHp_Wr4P3rs_4r3_Us3fuL} this is the flag.

-----------


The third challenge [Catch me if you can for 100 points]:

this challenge when you open it you will not find an interesting thing but if you opened the robots.txt file you will find two interesting files [source.phps3cr3t.php] the first file is the PHP source code the second one is the challenge the code is


I opened the challenge page and my Burp Suite and I catch the request from challenge page with this password R_4r3@ but the output is ILLEGAL CHARACTERS so this form not accepted I started to think about another form I tried to add Null-Byte but it's not worked in the PHP source the characters is not allowed so I tried to add a valid input so I tried to spoof the process so I tried to add a new line so I write on my Burp %0aR_4r3@ but the same problem and I notice that I didn't enter any valid value so I should add valid value before the new line so it will be like that 2%0aR_4r3@ and the output is

the interesting thing is 

-[------->+<]>---.++++++.------------.--[--->+<]>---.[----->+<]>.[--->++<]>.>-[----->+<]>.>-[--->+<]>--.[--->+<]>+++.--.--[->+++++<]>+.---[-->+++<]>--.+[----->+<]>.++[++>---<]>.+[->++<]>.-----.+[--->++<]>+.--[----->+<]>-.>-[----->+<]>.+.>--[-->+++<]>.


I asked my friend about it and he told me that this encoding called brainFuck sorry :P, I search on Google and I found an online tool to decode it, the flag is: FL@g{R3Str1Ct1d_Ar34}

-----------


The fourth challenge [admin gate second for 200 points]:

This is the hard challenge when you open the challenge link you will find login form and log in with test account when you look on the source code you will find this javascript code


this code creates a cookie and gets the user information from this path index.php?info=yes but I should add an Authorization header and valid token to get the information of the user I opened my Burp and catch the request to the information page and add the required headers and the output is {"username":"test","role":"user"} this the test account information but we need the admin information so I decoded the JWT and got it from the cookies I changed the information to be like that 

{
"data":"{\"username\":\"admin\",\"role\":\"admin\"}"
}
 and added it to the request but it does not work and I tried to brute force the secret to generating the Signature but I didn't find the secret, one of my friends told me before, I can bypass the JWT if I make the algorithm none value so I tried to do this when you make the algorithm none you should delete the signature from the JWT encode but you shouldn't delete the last dot the test account JWT encode is

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1widXNlcm5hbWVcIjpcInRlc3RcIixcInJvbGVcIjpcInVzZXJcIn0ifQ.BlX_zXDojjqaUBPl7AfcUdRGFxV4i_97k25_HoDHtYM

now I will open this website to edit this encode to be like this

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoie1widXNlcm5hbWVcIjpcImFkbWluXCIsXCJyb2xlXCI6XCJhZG1pblwifSJ9.bKup1TgwRDG22Gya4fBO0DcClusa_1LFwPfHpdAarJA

I will take the first base64 this one eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9 this include the algorithm I just decode it and this is the output {"typ":"JWT","alg":"HS256"} I will change the alg from HS256 to none and encode it again to base64 and add it to the new JWT encode now I will delete the signature from it to be like that

eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0=.eyJkYXRhIjoie1widXNlcm5hbWVcIjpcImFkbWluXCIsXCJyb2xlXCI6XCJhZG1pblwifSJ9.

the important thing don't forget the last dot, now I will send a request to this path index.php?info=yes and add this header to the request


Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0=.eyJkYXRhIjoie1widXNlcm5hbWVcIjpcImFkbWluXCIsXCJyb2xlXCI6XCJhZG1pblwifSJ9.

finally, the request will be like this

and the response is

BOOOOOM!! the flag is J!W!T@2018#Algo


I hope that this topic helped someone, thank you for reading.

Comments

Popular posts from this blog

Exploit & Debug Looney Tunables CVE-2023-4911 Local Privilege Escalation in the glibc's ld.so

Let's Analysis STM32F103 Chip Firmware from Attify

Using CSRF I Got Weird Account Takeover