b01lers CTF 2025 Web - trouble at spa Writeup

This challenge is really interesting
look at the challenge’s URL
Which is a github pages URL
It mean this is a static challenge

Examine the project
This website is build with react and react-router
In develope enviroment
We can

1
npm run dev

to run a local server with react-router

However, once you build it,
it only output some image, index.html, assets/assets-xxxxx.js
Question: how to get /flag

the official solution is

1
window.history.pushState({}, '', '/flag')

It mean push a state to browser’s history
then you can explore the route /flag

but I solve it in my way. (unintented solution)
I think if all the logic should process via index.html
So if let /flag renders as index.html
It should be output the flag

First, I clone the repo from github
Then, I code a flask server

1
2
3
4
5
6
7
8
9
from flask import Flask, send_file

app = Flask(__name__, static_folder='assets')

@app.route('/flag')
def flag():
return send_file('index.html')

app.run(port=5001)

So we got flag

reference: https://medium.com/前端實力三明治/瀏覽器的時光機-pushstate-replacestate-api-fa1d909c82b0