Some XSS Situation
The text describes deliberately vulnerable PHP pages that echo user input from GET, POST, or header fields without sanitisation, allowing reflected, stored, or DOM-based cross-site scripting. An attacker could inject script that runs in a victim's browser, though the text only demonstrates alert boxes on the author's own test server.
Published on medium.com
After completing the VPS installation process, here are a few configuration steps we need to do in order to use the 👉🏻HERE👈🏻 php file.
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-controlled input from query strings, form fields, or HTTP headers is written into HTML output without encoding or validation.
Impact
An attacker could run script in a victim's browser on the vulnerable site, but the text only shows alert boxes on the author's own test server and does not demonstrate theft of data or sessions.
What the attacker needed
A PHP web server you control; victim visits a crafted link or page
The fix
The pages should encode or sanitise all user input before writing it into HTML, and avoid assigning untrusted data to innerHTML.
How it was found
- Install PHP-FPM and configure nginx to serve PHP files.
- Create a PHP page that echoes a GET parameter back into the HTML.
- Submit a script tag as the feedback value and observe it execute.
- Repeat with a POST form, a custom header, and a stored comment file.
- For DOM XSS, load a page whose JavaScript writes the query string into innerHTML.
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) happens when a website takes something a user typed or sent and puts it straight into the page without cleaning it first. If that input is a piece of JavaScript, the browser runs it as if the site itself had written it, so an attacker can make a victim's browser do things on that site. This article builds small test pages that are intentionally unsafe so you can see the problem in action.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.