Skip to content
XSS Write-up Beginner

Stored XSS ve BEEF

A story platform stored user comments without sanitisation, so an attacker could inject JavaScript that runs in every visitor's browser. The author used this to load a BeEF hook and control visitors' browsers.

medium.com

Published on medium.com

Selam! Geçenlerde bir web uygulamamın bir sayfasında stored xss açığı keşfettim.

Mustafa Şen, 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

User comments were saved to the database and later inserted into the page's HTML without any filtering or encoding.

Impact

Any visitor to the page could have their browser controlled by the attacker, who could then run commands such as stealing social media sessions or tricking the visitor into downloading a trojan.

What the attacker needed

A story platform account; ability to post a comment; a BeEF server reachable by victims

The fix

The author says the vulnerability was closed before publishing, and recommends filtering or encoding user input so no HTML tags execute.

How it was found

  1. Set up a BeEF server on a cloud host and note the hook script URL and the control panel address.
  2. Go to the comments section of a story page.
  3. Submit a comment containing a script tag that loads the hook script from the BeEF server.
  4. Visit the page and observe that the browser loads the hook script and appears in the BeEF control panel.

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.

When a website saves what you type and shows it to other people without cleaning it first, someone can type code instead of normal text. That code then runs in the browser of everyone who views the page. Here the author put a small script in a comment, and it made visitors' browsers connect to a tool the author controlled.

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.