← Back to STEG BREAK CTF

BUG BOUNTRY

Automate clicks on a moving bug element 20 times to trigger the flag.

Tools Used

Browser ConsoleJavaScript Automation

Overview

A webpage contains a fast-moving bug element. We must catch (click) the bug at least 20 times to obtain the flag.

Reconnaissance

Inspecting the frontend source code, we see the bug triggers an asynchronous onclick handler that updates game state.

Exploitation Strategy

Instead of manually clicking, we can execute a script in the browser console that simulates the clicks programmatically 20 times.

Solution Code

(async () => {
  for (let i = 0; i < 20; i++) {
    await bug.onclick();
  }
  console.log('Flag:', flag.textContent);
})();

Flag

STG{you_caught_the_bug_in_three_parts}