-
Notifications
You must be signed in to change notification settings - Fork 0
JWT
Apprentice lab:
JWT authentication bypass via unverified signature
Apprentice lab:
JWT authentication bypass via unverified signature
This lab uses a JWT-based mechanism for handling sessions. Due to implementation flaws, the server doesn't verify the signature of any JWTs that it receives.
To solve the lab, modify your session token to gain access to the admin panel at /admin
, then delete the user carlos
.
You can log in to your own account using the following credentials: wiener:peter
-
Solution
- Log in as
wiener:peter
. - Notice in the requests the cookie is a JWT token.
- Try accessing
/admin
, export (x4
) the request. - Run
jwt_tool
.Observe the decoded token values.jwt_tool.py -r request.txt
- Run the following.
jwt_tool.py -r request.txt -I -pc sub -pv administrator -v
- Go back to mitmproxy, observer the request that was sent using jwt_tool. Copy the cookie value and paste it to browser.
- Access
/admin
panel and delete Carlilto.
- Log in as
Practitioner lab:
JWT authentication bypass via flawed signature verification
Practitioner lab:
JWT authentication bypass via flawed signature verification
This lab uses a JWT-based mechanism for handling sessions. The server is insecurely configured to accept unsigned JWTs.
To solve the lab, modify your session token to gain access to the admin panel at /admin
, then delete the user carlos.
You can log in to your own account using the following credentials: wiener:peter
-
Solution
- Log in as
wiener:peter
. - Notice in the requests the cookie is a JWT token.
- Try accessing
/admin
, export (x4
) the request. - Run
jwt_tool
.Observe the decoded token values.jwt_tool.py -r request.txt
- Run the following.
alg:none exploit option was chosen.
jwt_tool.py -r request.txt -I -pc sub -pv administrator -v -X a
- Go back to mitmproxy, observer the request that was sent using jwt_tool. Copy the cookie value and paste it to browser.
- Access
/admin
panel and delete Carlilto.
- Log in as
Solutions for the Portswigger's Web Security Academy using mitmproxy and other cli tools instead of Burp Suite
Server-side topics:
- SQL injection
- Authentication
- File path traversal
- OS command injection
- Business logic vulnerabilities
- Information disclosure
- Access control vulnerabilities
- File upload vulnerabilities
- Race conditions
- Server-side request forgery (SSRF)
- XML external entity (XXE) injection
- NoSQL injection
- API testing
Client-side topics:
- Cross-site scripting (XSS)
- Cross-site request forgery (CSRF)
- Cross-origin resource sharing (CORS)
- Clickjacking
- DOM-based vulnerabilities
- WebSockets
Advanced topics: