Skip to content

Index


title: Flag Command lev: Very Easy link: https://ctf.hackthebox.com/event/1434 site: HackTheBox category: Web weight: 3


πŸ“œ Description

Embark on the "Dimensional Escape Quest" where you wake up in a mysterious forest maze that's not quite of this world. Navigate singing squirrels, mischievous nymphs, and grumpy wizards in a whimsical labyrinth that may lead to otherworldly surprises. Will you conquer the enchanted maze or find yourself lost in a different dimension of magical challenges? The journey unfolds in this mystical escape!

πŸ“‹ Walkthrough

The website looks like this: website There is a console

>> help
start Start the game
clear Clear the game screen
audio Toggle audio on/off
restart Restart the game
info Show info about the game

We start the game and see what happens

>> start
YOU WAKE UP IN A FOREST.
You have 4 options!
HEAD NORTH
HEAD SOUTH
HEAD EAST
HEAD WEST
>> HEAD NORTH
Venturing forth with the grace of a three-legged cat, you head North. Turns out, your sense of direction is as bad as your cooking - somehow, it actually works out this time. You stumble into a clearing, finding a small, cozy-looking tavern with "The Sloshed Squirrel" swinging on the signpost. Congratulations, you've avoided immediate death by boredom and possibly by beasties. For now...
You have 4 options!
GO DEEPER INTO THE FOREST
FOLLOW A MYSTERIOUS PATH
CLIMB A TREE
TURN BACK
>> GO DEEPER INTO THE FOREST
You do realise its not a park where you can just play around and move around pick from options how are hard it is for you????
>> FOLLOW A MYSTERIOUS PATH
You decide to follow a mysterious path, which leads you to a magical meadow. Suddenly, a unicorn approaches and offers you a ride. You embark on a magical journey. Congratulations, you've found a mystical realm!
You have 4 options!
EXPLORE A CAVE
CROSS A RICKETY BRIDGE
FOLLOW A GLOWING BUTTERFLY
SET UP CAMP
>> EXPLORE A CAVE
You decide to explore a dark cave, only to find it's the hideout of a group of partying bats. They invite you to join, but the loud music drives you insane. Game over!
You died and couldn't escape the forest. Press restart to try again.

Ok, let’s take a look at the code. There is a JavaScript file called game.js. Let’s check it.

import { displayLineInTerminal } from "./main.js";
import { GAME_LOST, GAME_WON } from "./commands.js";

// GAME MECHANICS
// ---------------------------------------
const timeDelay = 1000;

function displayGameResult(message, style) {
    setTimeout(() => {
        displayLineInTerminal({
            text: message,
            style: `${style} margin-right`,
            useTypingEffect: true,
            addPadding: true,
        });
    }, timeDelay);
}

export function playerLost() {
    displayGameResult(GAME_LOST, "error");
}

export function playerWon() {
    displayGameResult(GAME_WON, "success");
}

There is also an API /api/options

{
  "allPossibleCommands": {
    "1": [
      "HEAD NORTH",
      "HEAD WEST",
      "HEAD EAST",
      "HEAD SOUTH"
    ],
    "2": [
      "GO DEEPER INTO THE FOREST",
      "FOLLOW A MYSTERIOUS PATH",
      "CLIMB A TREE",
      "TURN BACK"
    ],
    "3": [
      "EXPLORE A CAVE",
      "CROSS A RICKETY BRIDGE",
      "FOLLOW A GLOWING BUTTERFLY",
      "SET UP CAMP"
    ],
    "4": [
      "ENTER A MAGICAL PORTAL",
      "SWIM ACROSS A MYSTERIOUS LAKE",
      "FOLLOW A SINGING SQUIRREL",
      "BUILD A RAFT AND SAIL DOWNSTREAM"
    ],
    "secret": [
      "Blip-blop, in a pickle with a hiccup! Shmiggity-shmack"
    ]
  }
}

There is a secret. If we send that string as a command to /api/monitor we get the flag:

{"command":"Blip-blop, in a pickle with a hiccup! Shmiggity-shmack"}
Answer

HTB{D3v3l0p3r_t00l5_4r3_b35t_wh4t_y0u_Th1nk??!_****}