Skip to content
XSS Write-up Beginner

Xss Exploitation That Goes Beyond Script Alert Test Script

A reflected XSS vulnerability in DVWA allowed an attacker to execute arbitrary JavaScript in a victim's browser, steal cookies, saved credentials, and keystrokes, and perform actions on the victim's behalf. The article demonstrates these attacks in a lab environment.

Nol White Hat Follow

Published on infosecwriteups.com

In this article I will explain what Cross-Site Scripting (XSS) is and show you how attackers can exploit XSS. For example, how an attacker can grab the victim’s stored browser passwords.

Nol White Hat, on infosecwriteups.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 reflects user input into the page without proper output encoding, allowing injected HTML and JavaScript to execute.

Impact

An attacker could steal session cookies, saved browser credentials, log keystrokes, and perform actions as the victim, but the saved-credential theft did not work in Chrome or Edge.

What the attacker needed

Victim clicks a crafted link; attacker hosts malicious JavaScript; HttpOnly flag is false; no CSP in effect

The fix

The application should filter input on arrival and encode data on output to prevent script execution.

How it was found

  1. Set up a vulnerable DVWA server with Docker and stunnel for HTTPS.
  2. Set up an attacker HTTPS server to host malicious JavaScript.
  3. Identify the reflected XSS entry point by testing input reflection.
  4. Test which HTML tags and characters are allowed.
  5. Craft a payload that loads external JavaScript from the attacker server.
  6. Use the payload to steal cookies, saved credentials, log keystrokes, or post data.

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.

Cross-site scripting (XSS) is a bug where a website shows user input without cleaning it, so an attacker can sneak in JavaScript code that runs in other users' browsers. This lets the attacker read cookies, steal saved passwords, or act as the victim. The article shows how to exploit this in a deliberately vulnerable app called DVWA.

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 Nol White Hat

View all

8 more disclosed reports, 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.