Skip to content
XSS Write-up Intermediate

The Bug You’ll Never See — Until You Flip the Flag

A hidden comment editor, gated only by a client-side feature flag, rendered user input as raw HTML without sanitisation. An attacker could flip the flag and inject stored XSS that executes for anyone who views the comment.

su6osec Follow

Published on su6osec.medium.com

Recon didn’t show it. My scanner didn’t see it.

Đeepanshu, on su6osec.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 hidden editor relied only on a client-side feature flag for access control and rendered comment content as raw HTML without sanitisation.

Impact

An attacker could store a script that runs in the browser of anyone who views the comment, though the text does not show it being exploited against other users.

What the attacker needed

Ability to edit client-side storage; access to the application

The fix

The hidden editor should enforce server-side authorisation and sanitise or encode comment content before rendering.

How it was found

  1. Inspect the JavaScript bundle and notice an unused AdminCommentEditor component and a feature flag check.
  2. Look in localStorage, sessionStorage and cookies and find the flag set to false.
  3. Change the flag to true and refresh the app to reveal the hidden editor.
  4. Enter HTML into the editor and observe it rendered without sanitisation.

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.

A feature flag is a switch in the code that turns a feature on or off. Here the switch lived in the browser, so anyone could flip it and reach a hidden editor that did not clean up what users typed. That let an attacker plant a script that runs in other people's browsers.

What is XSS?

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

More by su6osec

View all

1 more disclosed report, best first.

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.