Infosec Matrix

Collection of Best Writeups for HackTheBox, Portswigger, Bug Bounty, TryHackme, OverTheWire, PwnCollege, PicoCTF, and More.

Follow publication

14.7 Lab: CSRF where token is not tied to user session

Karthikeyan Nagaraj
Infosec Matrix
Published in
2 min readJun 27, 2024

Description

This lab’s email change functionality is vulnerable to CSRF. It uses tokens to try to prevent CSRF attacks, but they aren’t integrated into the site’s session handling system.

To solve the lab, use your exploit server to host an HTML page that uses a CSRF attack to change the viewer’s email address.

You have two accounts on the application that you can use to help design your attack. The credentials are as follows:

  • wiener:peter
  • carlos:montoya

Solution

  1. Open Burp’s browser and log in to your account. Submit the “Update email” form, and intercept the resulting request.
  2. Make a note of the value of the CSRF token, then drop the request.
  3. Open a private/incognito browser window, log in to your other account, and send the update email request into Burp Repeater.
  4. Observe that if you swap the CSRF token with the value from the other account, then the request is accepted.
  5. Create and host a proof of concept exploit as described in the solution to the CSRF vulnerability with no defenses lab. Note that the CSRF tokens are single-use, so you’ll need to include a fresh one.
  6. Change the email address in your exploit so that it doesn’t match your own.
  7. Store the exploit, then click “Deliver to victim” to solve the lab.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Infosec Matrix
Infosec Matrix

Published in Infosec Matrix

Collection of Best Writeups for HackTheBox, Portswigger, Bug Bounty, TryHackme, OverTheWire, PwnCollege, PicoCTF, and More.

Karthikeyan Nagaraj
Karthikeyan Nagaraj

Written by Karthikeyan Nagaraj

Entrepreneur | Writer | Cyber Security Consultant | AI Researcher TopMate - https://topmate.io/cyberw1ng

No responses yet

Write a response