Intro 5 | Defend the Web
--
Some JavaScript knowledge is required
Problem
A new mission that has a completely different type of password prompt is interesting. Instead of HTML on the page now we have a popup box to enter the password. My hint is to understand how JavaScript can give prompts for information like this.
Solution
As my italics suggest I’d look up what prompt does in JavaScript. So after knowing that let’s click passed the prompt for now, by clicking ok. After inspecting the site, you’ll find a script tag that has a bit of interesting code.
var pass;
pass=prompt("Password","");
if (pass=="4f88ddf8e7") {
window.location.href="?password=4f88ddf8e7";
}
Answer is in the conditional statement where we check the pass variable. All you have to do is refresh the page and enter the password.
Look at the code inside the if statement that redirects to the winner page. Append the password to the end of the URL and it’ll take you the winner page as well.
https://defendtheweb.net/playground/intro5?password=4f88ddf8e7
Thanks for the read.