Sprocket Line

A bike-parts shop paid good money for a filter that strips 'script'. Only that.

Room Description

Sprocket Line — figure 1

https://dashboard.webverselabs-pro.com/challenges/sprocket-line

Scenario

After a phishing near-miss, Sprocket Line's owner hired someone to "add security." He got one line of PHP that strips <script> from input — and a two-page invoice. The owner feels much better now.

Objective

A bike-parts shop paid good money for a filter that strips 'script'. Only that.

Initial Analysis

We have a web application that acts a bike customization service.

Sprocket Line — figure 2

We have the following endpoints exposed and available to us:

<a class="sl-tab sl-tab-active" href="/">00 · Shop</a><a class="sl-tab" href="/fit">01 · Fit Calc</a><a class="sl-tab" href="/parts">02 · Parts</a><a class="sl-tab" href="/warranty">03 · Warranty</a>

There's a similar setup to other XSS challenges on the platform, but there's not much looking around to find our entrypoint.

Finding the bug

We have 3 endpoints we can look at, and most (from the three hahahaha) are static.

/parts

Sprocket Line — figure 3

This is just a list of parts that the company "holds".

/warranty

Sprocket Line — figure 4

This is just an exposed support e-mail that maybe you can send phishing attacks to if this was a real client.

/fit

Sprocket Line — figure 5

Now this looks interesting! We can input our bike model, let's start by entering values and see what it looks like.

Sprocket Line — figure 6

This means we have several fields we can control.

Sprocket Line — figure 7

Exploitation

Now, the challenge description states:

He got one line of PHP that strips from input

but is this the case? We have to check.

Let's use our typical payload.

<script>alert(0)</script>
Sprocket Line — figure 8

As we can see, there is some sort of a filter that strips the value away completely, since we are missing <script> from our tag.

Sprocket Line — figure 9

There are numerous ways around this, as well as different payloads.

https://portswigger.net/web-security/cross-site-scripting/cheat-sheet

Since we know <script> specifically is being targeted, we can try to use:

<img src=x onerror=alert(0)>
Sprocket Line — figure 10

And we get the flag!

Sprocket Line — figure 11

From the frontend code, we can see that nothing is getting stripped from the field we need:

Sprocket Line — figure 12