Skip to content
XSS Write-up Beginner

Reflected XSS via X-Forwarded-For Header on https://api.target.com/ip

An endpoint that echoes back the client IP address reflected the value of the X-Forwarded-For header without sanitising it. An attacker could craft a request with a script payload in that header and have it execute in the response, giving reflected cross-site scripting.

ugs20b126_cic.rajesh Follow

Published on medium.com

Hi, Today I will discuss about how I found this bug in a target. A clean and simple one.

Rajesh Sagar, 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

Impact

An attacker could execute script in a victim's browser through a crafted request, though the report gives no details on what that script could achieve.

What the attacker needed

Victim sends a crafted request; attacker controls the X-Forwarded-For value

How it was found

  1. Find the /ip endpoint that returns the caller's IP address
  2. Capture the request and send it to Burp Intruder
  3. Run an active scan on the request
  4. Set the X-Forwarded-For header value as the insertion point and scan it
  5. Observe the reflected XSS result

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.

Some websites show you information you send them, such as the address your request appears to come from. Here the site copied a header value straight into the page without cleaning it, so text that looks like code can run in a visitor's browser. That is called cross-site scripting, and it lets an attacker run their own code in someone else's session.

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 ugs20b126_cic.rajesh

View all

2 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.