Solving Portswigger Academy: Reflected XSS with some SVG markup allowed

Vishal
2 min readSep 30, 2024

--

This lab has a simple reflected XSS vulnerability. The site is blocking common tags but misses some SVG tags and events.

To solve the lab, perform a cross-site scripting attack that calls the alert() function.

Lab clearly mentioned that the site blocks common tags but misses some SVG tags and events.

Let’s first check if this is correct.As we visit the lab, we see a search box.

I checked for img tag and it says ‘Tag not allowed’.

Let’s brute force this using Intruder.Allowed tags

allowed tags

After that I again use intruder with svg tag and brute force the events. The result shows only event allowed is onbegin.

When I used payload with above tag and event it did not execute.

Then I used below payload which works for me.

<svg><animatetransform onbegin=alert() attributeName=x></svg>

The animateTransform element animates a transformation attribute on its target element, thereby allowing animations to control translation, scaling, rotation, and/or skewing.

This is how I am able 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

--

--

No responses yet

Write a response