My user at this CTF: https://play.fe-ctf.dk/users/21

Task Link to heading

[baby's 1st], [curling], [remote]

So you fancy yourself a hacker? Me? I don't even see the code!

Solution Link to heading

We are given a link to a login page containing a username and password field.
By checking out the webpage source code or network tab in our browsers dev-tools, we can see that the page loads a script.js file that looks like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
let error_timeout = null;

const clear_error = () => {
  document.getElementById("error").innerText = "";
};

const error = (msg) => {
  if (error_timeout) {
    window.clearTimeout(error_timeout);
  }
  document.getElementById("error").innerText = msg;
  error_timeout = window.setTimeout(clear_error, 5000);
};

window.onload = (_event) => {
  document.getElementById("form").onsubmit = (event) => {
    const username = document.getElementById("username").value;
    const password = document.getElementById("password").value;
    clear_error();
    if (username == "") {
      error("empty username");
      event.preventDefault();
    }
    else if (password != "SecureHunter2!") {
      error("invalid password");
      event.preventDefault();
    }
  };
};

Reading the script we can tell that, as long as we don’t submit an empty username and provide the password SecureHunter2! 1 we can login. And presto - there’s our flag 🍻.


  1. Hunter2 is a bit of hilarious internet history. There’s a reddit post about it ↩︎