DEV Community

Victor
Victor

Posted on Edited on

The Game: Sometimes You Don't Need to Play the Game to Win

1. Introduction

In this write-up, I will document my experience completing The Game room on TryHackMe, focusing on basic binary analysis and extracting hidden information from a Windows executable.

When I first saw the challenge, I expected something related to game hacking, perhaps modifying the game, manipulating its memory, or reverse engineering its internal logic.

However, the challenge turned out to be much simpler than I initially expected.

We are provided with a Tetris-like game executable, and our objective is to find a hidden flag inside it.

My first thought was: Do I actually need to play the game to complete this challenge?

Instead of spending time playing Tetris, I decided to approach it from a security perspective. I wanted to understand what information was stored inside the executable and whether I could extract anything useful without even running the application.

Sometimes, the easiest way to hack a game is simply to read it.

2. Understanding the Challenge

The challenge provides a downloadable archive containing a game executable named:

Tetrix.exe
Enter fullscreen mode Exit fullscreen mode

At first glance, this looks like a normal Windows application.

However, from a cybersecurity perspective, an executable is more than just something we can run. It also contains various types of information, including:

  • Program instructions.
  • Embedded resources and assets.
  • Application metadata.
  • Error messages and debug information.
  • Hardcoded strings.
  • Potentially sensitive information.

The last point is particularly interesting.

Developers sometimes accidentally leave sensitive information inside compiled applications. Even though the source code is not directly visible, some information can remain readable in the compiled binary.

This is where basic static analysis becomes useful.

3. Initial Reconnaissance – Inspecting the Downloaded File

After downloading the challenge files from TryHackMe, I extracted the archive and navigated to the directory containing the executable.

unzip <downloaded_file>.zip

cd <extracted_directory>

ls -lah
Enter fullscreen mode Exit fullscreen mode

The extracted directory contained the following file:

Tetrix.exe
Enter fullscreen mode Exit fullscreen mode

Before attempting to execute anything, I decided to inspect the file.

3.1. Identifying the File Type

I used the file command:

file Tetrix.exe
Enter fullscreen mode Exit fullscreen mode

This command helps identify the actual file format by examining its contents rather than relying only on its filename extension.

Since the target was a Windows executable, this confirmed that I was dealing with a binary application rather than a normal text file.

An important observation here is that we do not necessarily need to execute an unknown binary to analyze it.

Static analysis allows us to inspect a file without running its code.

4. Extracting Readable Strings from the Executable

Now comes the interesting part.

Since the objective was to find hidden information inside the executable, I decided to use one of the simplest tools available on Linux: strings.

4.1. Understanding the strings Command

The strings utility extracts sequences of printable characters from binary files.

For example, an executable might contain strings such as:

Welcome to the game
Loading resources...
Invalid configuration
Connection failed
Enter fullscreen mode Exit fullscreen mode

These strings may be embedded in the binary even though the executable itself is not a text file.

I started by running:

strings Tetrix.exe
Enter fullscreen mode Exit fullscreen mode

The command returned a large amount of output.

There were many unrelated strings, so manually reviewing everything would not be an efficient approach.

I needed a way to filter the results.

4.2. Filtering the Output with Grep

TryHackMe flags commonly follow this format:

THM{...}
Enter fullscreen mode Exit fullscreen mode

Knowing this, I decided to combine strings with grep to search specifically for the flag pattern.

strings Tetrix.exe | grep -i "THM{"
Enter fullscreen mode Exit fullscreen mode

Let's break down this command:

Command Purpose
strings Extract readable strings from the binary
Tetrix.exe Target executable
`\ `
grep Search for matching text
-i Perform a case-insensitive search
THM{ Search for the TryHackMe flag prefix

Instead of displaying thousands of unrelated strings, the terminal filtered the output and returned the matching result.

And there it was.

Flag discovered

THM{...}
Enter fullscreen mode Exit fullscreen mode

That was it. No complicated exploitation, no memory manipulation, and no need to achieve an impossible score in Tetris.

The flag was already embedded inside the executable as readable text.

5. Technical Analysis – Why Did This Work?

Although the practical solution was straightforward, there is an important security concept behind this challenge.

5.1. Compilation Does Not Mean Encryption

One common misconception is that compiling source code into an executable automatically protects the application's internal information.

This is not true.

Compilation transforms source code into a format that a computer can execute. However, it does not automatically encrypt every string or sensitive value contained in the program.

For example, consider the following code:

flag = "THM{...}"

print("Welcome to the game")
Enter fullscreen mode Exit fullscreen mode

After compilation, the application may still contain the flag as a readable string.

Anyone who obtains the executable can potentially inspect its contents using tools such as:

  • strings
  • Hex editors
  • Binary analysis tools
  • Disassemblers
  • Debuggers

In this challenge, the strings utility was sufficient to locate the flag.

5.2. Static Analysis vs. Dynamic Analysis

This challenge also provides a useful introduction to two fundamental approaches to reverse engineering.

Static Analysis

Static analysis examines a program without executing it.

Examples include:

  • Extracting readable strings.
  • Inspecting file headers.
  • Analyzing binary metadata.
  • Examining embedded resources.
  • Disassembling executable instructions.

Dynamic Analysis

Dynamic analysis examines a program while it is running.

Examples include:

  • Monitoring memory.
  • Observing application behavior.
  • Setting breakpoints.
  • Inspecting function calls.
  • Modifying runtime values.

For this particular challenge, static analysis was enough. There was no reason to introduce more complicated techniques when a simple command could reveal the required information.

6. Security Implications – Information Disclosure

The underlying security lesson is information disclosure through client-side binaries.

Imagine a real-world application that stores the following information directly inside its executable:

API_KEY=xxxxxxxx
DATABASE_PASSWORD=xxxxxxxx
INTERNAL_SERVER_URL=xxxxxxxx
Enter fullscreen mode Exit fullscreen mode

If these values are embedded as plaintext strings, someone who obtains the executable may be able to extract them.

The consequences could include:

  • Exposure of API credentials.
  • Disclosure of internal infrastructure.
  • Leakage of application configuration.
  • Exposure of hardcoded passwords.
  • Unauthorized access to backend services.

This is why developers should never assume that information inside a compiled application is secret.

6.1. How Can Developers Prevent This?

There are several ways to reduce this risk:

  1. Never hardcode secrets in client-side applications. Sensitive credentials should be stored and managed on trusted backend infrastructure.

  2. Use server-side validation. For a challenge like this, the server should validate whether the game has been completed instead of embedding the secret directly in the distributed executable.

  3. Apply proper secret management. API keys, passwords, and other sensitive credentials should be managed using appropriate secret-management systems.

  4. Perform binary security reviews. Before releasing an application, developers should inspect compiled artifacts for accidentally exposed credentials and sensitive information.

Obfuscation can make static inspection more difficult, but it should not be considered a reliable way to protect secrets.

The most effective solution is to avoid distributing secrets to untrusted clients in the first place.

7. Key Takeaways

Completing this room reinforced several useful concepts:

1. Start with simple tools.

Not every reverse-engineering challenge requires advanced tools such as Ghidra or IDA Pro. Sometimes strings and grep are enough.

2. Understand the target before exploiting it.

Identifying the file type and understanding what we are analyzing helps determine the most appropriate approach.

3. Static analysis is an important first step.

Before executing an unknown binary, inspect it and understand what information it contains.

4. Compilation does not protect sensitive information.

A compiled executable can still expose plaintext strings, credentials, and other sensitive data.

5. Think like both a developer and an attacker.

Developers should consider what information an attacker can extract after obtaining their application.

8. Conclusion

The Game was a short but interesting introduction to binary analysis and reverse engineering.

Initially, I thought the challenge might require modifying the game or finding a way to manipulate its internal logic. However, after inspecting the executable, I realized that the solution was much simpler.

By combining strings and grep, I was able to extract the hidden flag directly from the binary without even needing to play the game.

My biggest takeaway from this room is that a compiled application should never be treated as a secure place to store sensitive information.

From a security engineering perspective, this is a valuable reminder to inspect not only how an application behaves when it runs, but also what information it exposes through the files distributed to users.

Sometimes, the most interesting vulnerabilities are not hidden behind complicated exploitation techniques. They are simply sitting inside the binary, waiting to be discovered.


Author: Victor Hoang

Platform: TryHackMe

Room: The Game

Category: Reverse Engineering / Game Hacking

Top comments (0)