๐ Token of Trust
A detailed write-up of the Web challenge 'Token of Trust' from ACECTF1.0 - 2025
๐ Challenge Overview
Category Details Additional Info ๐ Event ACECTF - 2025 Event Link ๐ฐ Category Web ๐ ๐ Points 200 Out of 500 total โญ Difficulty ๐ข Easy Personal Rating: 1/10 ๐ค Author Unknown Profile ๐ฎ Solves (At the time of writeup writing) 113 solve rate ๐ Date 27-02-2025 ACECTF - 2025 ๐ฆพ Solved By mH4ck3r0n3 Team: QnQSec
๐ Challenge Information
At first, this web app seems straightforward, but thereโs something more lurking beneath the surface. It relies on a token for user authentication, but not everything is as secure as it seems. Look closely, and you might discover that the systemโs trust can be manipulated. The secret is hidden within the way this token is used. Can you find the key to unlock whatโs been concealed? The challenge is waiting for you to crack it. Submit your answer in the following format: ACECTF{3x4mpl3_fl4g}. http://34.131.133.224:9999/
๐ฏ Challenge Files & Infrastructure
Provided Files
1
Files: None
๐ Initial Analysis
First Steps
Initially, the website appears as follows:
We are told to log in to the
/login
route with a POST request, but even so, it’s always better to try with a GET request.In fact, as we can see from the GET request, I was able to extract the
user
andpass
fields. Additionally, we are told that regardless of the credentials we send, just following the request format is enough to access. By openingBurpSuite
, intercepting the request, and forming a POST with the fields in the JSON format I just found, I was able to receive atoken
as a response:Most likely, it is a
jwt
, so I immediately tried to analyze it with https://jwt.io:As we can see from the analysis, the
HS256
algorithm is used for the signature, and the payload is"user":"guest"
. In the case of theHS256
algorithm, the vulnerability to exploit is most likely anAlgorithm Confusion
, perhaps by setting the algorithm toNone
or performing asecret cracking
to craft the token with the cracked secret key. (By runningjwt-cracker
with therockyou.txt
wordlist, I did not find any occurrences, so I decided to proceed withAlgorithm Confusion
). Let’s move on to the exploitation.
๐ฌ Vulnerability Analysis
Potential Vulnerabilities
- JWT None Algorithm Supported
๐ฏ Solution Path
Exploitation Steps
Initial setup
First of all, when specifying the
None
algorithm, thesignature
of thejwt
(the part after the last dot) must be removed. So we initially have:
1
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiZ3Vlc3QifQ.JT3l4_NkVbkQuZpl62b9h8NCZ3cTcypEGZ1lULWR47M
After removing the signature:
1
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiZ3Vlc3QifQ.
(Attention not to remove the last
.
since removing it would make thejwt
format invalid, knowing that it consists ofheader.payload.signature
). Once this is done, there are many ways to modify the fields of thejwt
, for example by doingbase64decode
, changing the field, and then re-encoding it to assemble the token. Alternatively, you can use the fasterjwt-tool
. Let’s proceed with the exploitation phase.
Exploitation
Once the signature is removed, we can pass the token to
jwt-tool
and specify the-T
(Tamper) flag to modify the fields of thejwt
provided:
1
python /home/mh4ck3r0n3/Tools/Web/jwt_tool/jwt_tool.py -T eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiZ3Vlc3QifQ.
As we can see, I changed
alg:None
anduser:admin
, generating a validadmin
token. Now, with the valid token:
1
eyJhbGciOiJOb25lIiwidHlwIjoiSldUIn0.eyJ1c2VyIjoiYWRtaW4ifQ.
The last thing we need to figure out is which route to send it to in order to get the flag, since sending it to
/login
or/
will return an error in the first case (due to the expecteduser
andpass
fields) and aNot Modified
status code in the second case, indicating we’re not on the right track. So, I decided to inspect therobots.txt
file to see if it contains any route:In fact, as we can see, the
/flag
route is specified. I tried making anOPTIONS
request with curl:
1
curl -X OPTIONS http://34.131.133.224:9999/flag
I get that the only available method is
POST
. So, I assume the new token needs to be forwarded in ajson
payload, exactly as we received it during thelogin
phase. Indeed, by making aPOST
request to/flag
set up in the way just mentioned, I was able to obtain the flag.
Flag capture
๐ ๏ธ Exploitation Process
Approach
The automated exploit makes a
POST
request to/login
to extract theJWT
token, then removes the signature and setsalg
toNone
anduser
toadmin
. After that, it makes aPOST
request to/flag
with the forged token and extracts the flag from the response.
๐ฉ Flag Capture
Flag
Proof of Execution
๐ง Tools Used
Tool Purpose Python Exploit Jwt-Tool JWT Testing Burpsuite Web Testing
๐ก Key Learnings
Skills Improved
- Binary Exploitation
- Reverse Engineering
- Web Exploitation
- Cryptography
- Forensics
- OSINT
- Miscellaneous
๐ References & Resources
Learning Resources
๐ Final Statistics
Metric | Value | Notes |
---|---|---|
Time to Solve | 00:04 | From start to flag |
Global Ranking (At the time of writeup writing) | 4/468 | Challenge ranking |
Points Earned | 200 | Team contribution |
Created: 27-02-2025 โข Last Modified: 27-02-2025 Author: mH4ck3r0n3 โข Team: QnQSec