Skip to content
XSS Write-up Advanced

XSS TO SSRF INTO THE NEXT JS THAT VULNERABLE TO REACT2SHELL NEW C

A stored cross-site scripting flaw in an upload/log feature let the author steal an admin's session cookie, and the admin panel's link health checker then fetched attacker-chosen URLs, giving server-side request forgery. By pointing that fetcher at an internal Next.js service vulnerable to a React2Shell issue, the author achieved remote code execution and read the flag.

Ahmed Ibrahim Follow

Published on medium.com

there is a bot we need XSS to get admin cookie and login as admin after trying injecting payloads in the Parameters and finally An alert popped up.

Ahmed Ibrahim, 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

Likely the upload/log feature rendered user input without sanitisation, and the admin health-check feature fetched arbitrary URLs server-side without restricting internal destinations.

Impact

An attacker could take over the admin account and then use the server-side fetcher to reach an internal service and run commands, reading the flag file.

What the attacker needed

A free account to upload logs; victim (admin bot) visits the report; admin panel health-check feature; internal Next.js service reachable

The fix

The upload/log output should be sanitised or escaped, the admin fetcher should block internal addresses, and the internal Next.js service should be patched against the referenced advisory.

How it was found

  1. Inject a script into a parameter that is reflected or stored in the upload/log area.
  2. Report the uploaded log entry to the admin bot so it visits the page.
  3. The script reads the admin cookie and posts it back to the upload endpoint.
  4. Read the admin cookie from the attacker's own logs and log in as admin.
  5. Use the admin health-check feature to make the server request an internal Next.js service.
  6. Send a crafted request to that internal service to get command execution and read the flag.

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.

A web page that shows user-supplied text without cleaning it can run attacker code in a visitor's browser; that is cross-site scripting. Here the attacker's code ran in the admin's browser and copied the admin's login cookie to the attacker. Later, a feature that fetches links on the server let the attacker make the server talk to an internal machine, and that internal machine had a known bug allowing command execution.

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 Ahmed Ibrahim

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.