• caglararli@hotmail.com
  • 05386281520

XSS against jQuery PortSwigger challenge

Çağlar Arlı      -    16 Views

XSS against jQuery PortSwigger challenge

I am trying to do this jQuery XSS challenge here by PortSwigger.

They have a good walkthrough for XSS attacks, however I could not find anything on jQuery, which is also a programming language I have no experience in.

The description of the challenge:

Lab: DOM XSS in jQuery selector sink using a hashchange event

This lab contains a DOM-based cross-site scripting vulnerability on the home page. It uses jQuery's $() selector function to auto-scroll to a given post, whose title is passed via the location.hash property.

To solve the lab, deliver an exploit to the victim that calls the print() function in their browser.

The answer:

Notice the vulnerable code on the home page using Burp or the browser's DevTools.

From the lab banner, open the exploit server.

In the Body section, add the following malicious iframe:

<iframe src="https://YOUR-LAB-ID.web-security-academy.net/#" onload="this.src+='<img src=x onerror=print()>'"></iframe>

Store the exploit, then click View exploit to confirm that the print() function is called.

Go back to the exploit server and click Deliver to victim to solve the lab.

Question:

Could someone please explain how this works? I cannot see the vulnerable code they mention on the homepage, and I cannot understand the process.