Skip to content
XSS Write-up Beginner

The Parameter That Redirects Nowhere: HTML Injection via redirect

The redirect_page parameter on the login page was reflected into HTML without encoding, allowing an attacker to inject arbitrary markup. An attacker could craft a link that renders attacker-controlled content, including links to external sites, on the legitimate domain for phishing.

Gautam Sharma Follow

Published on medium.com

Not every finding is a takeover. This one is a small, clean bug with a real phishing angle: a parameter meant to control post-login redirects reflected its value straight into the page’s HTML, letting an attacker inject arbitrary markup links, text, whatever that renders on the legitimate domain.

Gautam Sharma, 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 parameter's value was written into the HTML response without context-aware output encoding, so characters like quotes and angle brackets were treated as markup instead of text.

Impact

Reflected HTML injection on the login page could be used to render attacker-controlled content, including links to external sites, on the legitimate origin, primarily for credential phishing that borrows the target’s domain and TLS for credibility.

What the attacker needed

Victim opens a crafted link; victim interacts with injected content

The fix

The parameter's value should be context-aware output encoded, or better, not reflected into HTML at all and instead validated against an allowlist of internal paths for redirect use only.

How it was found

  1. Log in, then log out to reach the login URL with the redirect_page parameter.
  2. Craft a URL with the redirect_page parameter containing HTML markup that breaks out of the attribute.
  3. Open the crafted URL and observe the injected HTML rendering on the login page.

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 you type something into a website and it shows up on the page, the site should treat it as plain text, not as code. Here, the site put the value of a URL parameter directly into the page's HTML without cleaning it, so an attacker could add their own HTML tags. That let them show fake messages and links on the real login page, which is useful for tricking people into giving away passwords.

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 Gautam Sharma

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.