Skip to content
XSS Write-up Beginner

How Building My Own Linktree Clone Led Me to a CSS Injection Disc

The background customisation feature accepted arbitrary CSS values, including url() functions, without validation. An attacker could load external resources, track users, and manipulate the page layout, though JavaScript execution was blocked by browser protections.

Divyanshu Lohani Follow

Published on medium.com

While building Nexus, my own link-in-bio platform, I implemented a feature that allowed users to customize their page backgrounds.

Divyanshu Lohani, 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

Root cause

Likely the application inserted user-supplied background values directly into a CSS property without validating or restricting the allowed formats.

Impact

An attacker could load external resources, track users, and manipulate the page layout, but JavaScript execution was not possible due to browser protections.

What the attacker needed

A free account; premium subscription bypassed

The fix

The platform was fixed by restricting backgrounds to predefined colours and validated gradients, and rejecting url() values.

How it was found

  1. Create an account on the platform.
  2. Open the profile background customisation setting.
  3. Enter a CSS url() value instead of a colour or gradient.
  4. Observe that the external resource is loaded and rendered as the background.
  5. Use additional CSS values to manipulate or break the page layout.

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.

CSS is the language that controls how web pages look. This site let users type anything into a background setting, and the site put that text straight into the page's style rules. That meant a user could make the page load images from another server or break the layout, even though they could not run JavaScript.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.