1. Introduction
In this write-up, I will document my experience completing the Fools Mate room on TryHackMe, focusing on identifying and bypassing a client-side restriction in a chess-based web application.
When I first accessed the challenge, I was presented with a simple chessboard. The objective seemed straightforward: find a move that would result in checkmate.
However, there was something strange about the application.
The winning move was obvious, but whenever I attempted to execute it through the interface, the application refused to let me proceed. Instead, it displayed a warning message suggesting that I should not make that move.
At first, I thought there might be something wrong with the chess engine.
But after spending some time examining the application's behavior, I started thinking about a different possibility:
What if the application was preventing the move through JavaScript rather than actually enforcing the restriction on the server?
This became the starting point of my investigation.
The interesting part of this challenge is that I did not need to exploit a complicated vulnerability or attack the chess engine itself. I only needed to understand how the browser communicated with the backend and whether I could bypass the restriction by manipulating the HTTP request.
2. Initial Reconnaissance – Exploring the Application
After deploying the target machine on TryHackMe, I accessed the web application using the assigned IP address.
http://<TARGET_IP>
The application presented a chessboard with the following information:
- White to move.
- A simple endgame position.
- A checkmate opportunity in one move.
Looking at the board, I noticed that the white rook could move from a1 to a8, delivering checkmate to the black king.
From a chess perspective, the solution was straightforward.
However, when I attempted to move the rook directly through the interface, something unexpected happened.
2.1. Encountering the Restriction
Instead of accepting the move, the application displayed a warning:
I'll shut down your PC if you play that.
At first, this looked like a strange error message.
But from a security testing perspective, it immediately raised a question: Was this restriction actually enforced by the backend, or was it simply implemented in the frontend?
I decided not to spend more time trying random chess moves.
Instead, I moved on to inspecting the application's HTTP communication.
3. Investigating the Application with Developer Tools
My next step was to open the browser's Developer Tools.
I navigated to the Network tab and enabled request monitoring.
The objective was to understand what happened when I interacted with the chessboard.
3.1. Testing a Normal Move
First, I tried a normal move that did not result in checkmate.
For example, I moved the rook from:
a1 -> a7
This time, the application accepted the move.
More importantly, I noticed an HTTP request being sent to the backend.
The request was directed to:
POST /api/move
The endpoint was particularly interesting because it appeared to handle chess moves.
I inspected the request and found that the application sent the move coordinates in JSON format.
For example:
{
"from": "a1",
"to": "a7"
}
This gave me an important clue about how the application processed user actions.
Instead of sending the entire chessboard state, the frontend submitted the starting and destination squares to the backend.
3.2. Testing the Winning Move Again
Next, I reset the chessboard and attempted the winning move:
a1 -> a8
The same warning appeared.
However, something was different this time.
I checked the Network tab and noticed that no corresponding request was sent to /api/move.
This was the most important observation during my investigation.
When I made a normal move, the browser sent a request to the backend.
When I attempted the winning move, the browser blocked the operation before any request was generated.
This suggested that the restriction was implemented entirely on the client side.
3.3. Identifying the Security Weakness
At this point, my hypothesis became clearer.
The application likely followed a process similar to this:
User attempts a chess move
|
v
Frontend JavaScript validates move
|
v
Is the move checkmate?
/ \
Yes No
| |
v v
Block move Send API request
| |
v v
Show warning Backend processes move
The problem was that the frontend was deciding whether the winning move should be sent to the backend.
If the backend did not independently enforce the same restriction, an attacker could simply bypass the browser's JavaScript logic.
This is a classic example of client-side security enforcement.
4. Understanding the Vulnerability – CWE-602
Before attempting exploitation, I wanted to understand the underlying security concept.
CWE-602 refers to Client-Side Enforcement of Server-Side Security.
This weakness occurs when an application relies on client-side mechanisms to enforce security restrictions that should be validated by the server.
JavaScript validation is useful for improving the user experience.
For example, a website might use JavaScript to:
- Validate form fields.
- Prevent invalid user actions.
- Check input formats.
- Display warnings.
- Disable certain buttons.
However, users have control over their browsers.
They can modify JavaScript, disable scripts, intercept HTTP requests, or construct requests manually.
Therefore, client-side validation should never be considered a security boundary.
4.1. Why This Application Was Vulnerable
In Fools Mate, the frontend prevented the winning move before submitting it to the backend.
However, the backend exposed an API endpoint:
POST /api/move
The endpoint accepted move coordinates through a JSON request body.
If the backend independently validated the move and accepted the winning position, then bypassing the frontend restriction would be sufficient to complete the challenge.
The next step was to test that assumption.
5. Exploitation – Using Burp Suite Intruder (Cluster Bomb)
After identifying the /api/move endpoint, I decided to use Burp Suite Intruder to investigate how the backend handled different combinations of chess coordinates.
Instead of manually modifying and forwarding requests one by one, I wanted to automate the testing process.
This is where Burp Suite Intruder became useful.
5.1. Capturing the Original Request
First, I configured my browser to work through Burp Suite Proxy.
I returned to the chess application and performed a normal move to generate a legitimate API request.
In Burp Suite, I opened:
Proxy → HTTP history
I located the request sent to:
POST /api/move HTTP/1.1
The request body contained two important parameters:
{
"from": "a1",
"to": "a7"
}
These parameters represented the starting and destination squares of the chess move.
I sent the request to Intruder using:
Right-click → Send to Intruder
5.2. Configuring Intruder Positions
In the Intruder tab, I selected the request body and identified the parameters that I wanted to test.
For example:
{
"from": "§a1§",
"to": "§a7§"
}
The § symbols represent payload positions.
I selected two positions because I wanted to test different combinations of starting and destination coordinates.
5.3. Selecting Cluster Bomb Mode
Next, I navigated to the Intruder attack settings and selected:
Attack type: Cluster Bomb
Cluster Bomb is useful when testing multiple independent payload positions.
Unlike Sniper, which tests one position at a time, Cluster Bomb combines payloads from multiple payload sets.
For example:
| Position | Payload set |
|---|---|
| Position 1 | Starting square |
| Position 2 | Destination square |
If the first payload set contains three values and the second contains four values, Cluster Bomb generates twelve combinations.
The total number of requests is:
[ N = |P_1| \times |P_2| ]
Where:
- (P_1) represents the first payload set.
- (P_2) represents the second payload set.
5.4. Configuring Payload Sets
Under the Payloads tab, I configured the two payload sets.
Payload Set 1 – Starting Position
a1
Payload Set 2 – Destination Position
a7
a8
The values above illustrate the request structure. In the actual challenge, the payload values should match the coordinate combinations you intend to test.
The objective was to determine how the backend responded when receiving different combinations of coordinates.
5.5. Launching the Attack
After reviewing the positions and payload sets, I started the Intruder attack.
Burp Suite automatically generated requests using the configured combinations.
I monitored the results and compared:
- HTTP status codes.
- Response lengths.
- Response bodies.
- Application error messages.
- Differences between successful and unsuccessful requests.
This was particularly useful because an API may return different responses depending on whether a submitted move is accepted, rejected, or results in a special game state.
5.6. Identifying the Successful Request
After reviewing the Intruder results, I identified the request corresponding to the winning chess move.
The important observation was that the backend processed the request independently of the frontend restriction.
This confirmed that the browser-side validation was not sufficient to enforce the application's intended behavior.
I used the successful request to verify the checkmate condition and complete the challenge.
Flag: Not disclosed in this write-up.
6. Technical Analysis – Why Cluster Bomb Was Useful
Cluster Bomb is particularly useful when an application accepts multiple independent input parameters and we want to test combinations of their values.
In this challenge, the two parameters were:
{
"from": "a1",
"to": "a8"
}
The attack helped automate testing instead of requiring manual modification of every request.
However, there is an important distinction:
- Intruder Cluster Bomb: Tests combinations of supplied payloads.
- Client-side validation bypass: Sends requests directly to the backend without relying on frontend restrictions.
Intruder is the testing mechanism, while bypassing the frontend restriction is the underlying security finding.
7. Technical Analysis – What Actually Went Wrong?
This challenge demonstrates a common mistake in web application development: treating client-side validation as a security mechanism.
Let's look at the difference between a vulnerable and a more secure implementation.
7.1. Vulnerable Implementation
A simplified example of the frontend logic might look like this:
async function makeMove(from, to) {
if (isCheckmate(from, to)) {
alert("I will shut down your PC!");
return;
}
await fetch("/api/move", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
from: from,
to: to
})
});
}
The frontend checks whether the move results in checkmate.
If it does, the function returns without submitting the request.
The problem is that this check only exists in the browser.
An attacker can bypass it by submitting the request directly.
7.2. Secure Implementation
A more secure design would enforce the relevant game rules on the backend.
For example:
app.post("/api/move", (req, res) => {
const { from, to } = req.body;
// Validate input
if (!isValidSquare(from) || !isValidSquare(to)) {
return res.status(400).json({
error: "Invalid move coordinates"
});
}
// Validate the move using trusted server-side logic
const result = game.processMove(from, to);
if (!result.valid) {
return res.status(400).json({
error: "Invalid move"
});
}
return res.json({
success: true,
status: result.status
});
});
This example illustrates the important principle: the backend must independently validate incoming requests.
The server should never assume that a request is legitimate simply because it originated from the application's own frontend.
8. Security Impact
Although this challenge uses a chess game, the same vulnerability pattern can appear in real-world applications.
Imagine an online banking application that disables a transfer button when a transaction exceeds a certain limit.
If that restriction exists only in JavaScript, an attacker might modify the request and submit a larger transaction directly to the backend.
Similarly, an e-commerce application might hide administrator-only functionality in the frontend while leaving the corresponding backend API insufficiently protected.
Potential consequences include:
- Bypassing business logic restrictions.
- Performing unauthorized actions.
- Manipulating application state.
- Accessing functionality hidden by the frontend.
- Circumventing transaction or workflow restrictions.
The impact depends on what the backend allows and whether additional authorization and validation mechanisms exist.
9. Mitigation and Prevention
There are several ways developers can prevent this type of vulnerability.
9.1. Enforce Security Rules on the Backend
All important business rules must be independently validated by the server.
The frontend can provide immediate feedback, but the backend must make the final decision.
9.2. Never Trust Client-Controlled Input
All values submitted through HTTP requests should be considered untrusted.
This includes:
- JSON parameters.
- Query parameters.
- HTTP headers.
- Form data.
- Hidden HTML fields.
The backend should validate the input before processing it.
9.3. Implement Proper Authorization
Authentication determines who is making a request.
Authorization determines whether that user is allowed to perform the requested action.
Both must be enforced server-side.
9.4. Test APIs Independently
Security testing should not be limited to interacting with the frontend.
Tools such as Burp Suite and cURL can help security testers determine whether backend APIs correctly enforce business rules when requests are sent independently.
This is particularly important when an application uses JavaScript frameworks or exposes REST APIs.
10. Key Takeaways
Completing Fools Mate reinforced several important web security concepts.
1. Never trust client-side validation.
JavaScript executes in an environment controlled by the user. Any client-side restriction can potentially be modified or bypassed.
2. Understand the application's API communication.
Inspecting the Network tab helped me identify the /api/move endpoint and understand how the application processed chess moves.
3. Compare successful and unsuccessful requests.
The difference between a normal move and the blocked checkmate move revealed that the browser was stopping the request before it reached the backend.
4. Learn to manipulate HTTP requests.
Burp Suite made it possible to capture a legitimate request, modify its JSON parameters, and test the backend independently.
5. Backend validation is essential.
Security-sensitive business logic must be enforced on the server, regardless of what the frontend allows or prevents.
11. Conclusion
Fools Mate was a short but interesting exercise in web application security testing.
At first, I approached the challenge as a simple chess puzzle. However, after discovering that the application refused to execute an obvious winning move, I decided to investigate its underlying HTTP communication.
The most important discovery was that the browser blocked the winning move before submitting any request to the backend.
By comparing normal and blocked interactions, I identified the /api/move endpoint and understood how the application communicated with its backend.
From there, I used Burp Suite to modify a legitimate request and submit the winning move directly.
The backend accepted the request, confirming that the frontend restriction was not a reliable security control.
My biggest takeaway from this room is that the frontend should never be responsible for enforcing security-critical business logic.
As someone interested in application security and penetration testing, this challenge reinforced the importance of looking beyond the visible interface and examining how the frontend and backend communicate.
Sometimes, the vulnerability is not in what the application allows you to click, but in what the backend allows you to request.
Author: Victor Hoang
Platform: TryHackMe
Room: Fools Mate
Category: Web Security / Logic Bypass
Primary Concept: Client-Side Validation Bypass
CWE: CWE-602
Top comments (0)