Skip to content
Path traversal Write-up Intermediate

CSPT: Your way to XSS & CSRF in Modern Apps

Client-side path traversal occurs when a front-end application uses user-controlled input to build a backend request path, allowing an attacker to redirect the request to a different endpoint. This can lead to CSRF by making the front end send a valid state-changing request, or to XSS by fetching malicious JSON from an attacker-controlled endpoint and rendering it unsafely.

medium.com

Published on medium.com

In this blog, I will discuss how to utilize Client Side Path Traversal, to achieve classic client side attacks such as XSS & CSRF in Client Side Rending Based Web Applications such (React, Vue, Angular, … )

Abdulrahman, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could change a victim's email address via CSRF or execute XSS by rendering malicious JSON, though the text notes assumptions such as the endpoint accepting extra body/query parameters and the front end placing the response in a dangerous sink without sanitisation.

What the attacker needed

Victim clicks a crafted link; front end uses user input in request path; endpoint accepts extra parameters

The fix

The front end should validate and sanitise user input before using it in request paths, and avoid placing untrusted data into dangerous sinks like innerHTML.

How it was found

  1. Identify a front-end feature that builds a backend request path from user input, such as a message status update.
  2. Craft a URL containing traversal sequences (e.g., '../') in the user-controlled part to point to a different endpoint.
  3. Send the crafted URL to a victim; the front end will make a valid request to the traversed endpoint.
  4. For XSS, find an endpoint that returns attacker-controlled JSON and traverse to it so the front end renders the response unsafely.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a website is built with a modern framework like React or Vue, the browser runs JavaScript that makes requests to the server. If the website takes part of the web address (like the path or a query parameter) and uses it to decide which server endpoint to call, an attacker can insert '../' to change that endpoint. This lets the attacker make the victim's browser send requests the attacker could not send directly, potentially changing account details or loading harmful content.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.