Skip to content
XSS Write-up Beginner

Stored Cross-Site Scripting (XSS) in Accounts Manager App Using PHP and MySQL (SourceCodester)

The Accounts Manager App stores user input from the Add Account form in the database and renders it back into the page without encoding, so a script entered in the Account Name field runs whenever the page loads. An attacker could use this to run JavaScript in a victim's browser, read cookies and redirect the user to another site.

hemantrajbhati5555 Follow

Published on medium.com

In this write-up, I discovered a Stored Cross-Site Scripting (XSS) vulnerability in the Accounts Manager App Using PHP and MySQL.

Hemant Raj Bhati, 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

The application renders stored user input directly into HTML without output encoding or input validation.

Impact

An attacker could execute JavaScript in a victim's browser, steal session cookies, redirect users to malicious sites and perform phishing; the report demonstrates the redirect and cookie-reading behaviour but the attacker host was unreachable, so no data was actually captured.

What the attacker needed

Access to the Add Account form; victim loads the page showing the entry

How it was found

  1. Open the Add Account form in the application.
  2. Enter a script payload in the Account Name field and save the account.
  3. Reload the page so the stored entry is displayed.
  4. Observe the JavaScript executing automatically in the browser.

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.

The app lets you save account details and shows them again later. It puts whatever you typed straight into the page without cleaning it, so if you type code instead of a name, the browser treats it as a program and runs it. That lets an attacker make the page do things on behalf of anyone who opens it.

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 hemantrajbhati5555

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.