Skip to content
XSS Write-up Beginner

XSS through image proxy using SVG image

An image proxy endpoint accepted arbitrary remote image URLs and rendered SVG files from attacker-controlled hosts, so an SVG containing script executed in the company's origin. An attacker could run JavaScript in the victim's browser session on the company domain.

Abdullah Mohamed Follow

Published on 3bodymo.medium.com

Hi everyone, today’s story will be short because there are not many details in it.

Abdullah Abdelrazek, on 3bodymo.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 image proxy fetched and served remote content from the company's own origin without restricting the source host or blocking active content such as SVG scripts.

Impact

Script ran in the company's origin, so an attacker could act in a victim's session on that domain; the text does not show further exploitation.

What the attacker needed

Victim visits a crafted proxy URL; attacker hosts an SVG file

The fix

The proxy was fixed to only accept images from the company's own S3 bucket.

How it was found

  1. Notice image links pass a full remote URL to a proxy endpoint on the company domain
  2. Confirm the endpoint fetches images from an arbitrary external host
  3. Host an SVG file containing a script payload on an attacker-controlled server
  4. Request the proxy endpoint with the attacker SVG URL and observe the script running on the company host

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 website had a feature that fetched images from other sites and showed them as if they were its own. The author uploaded a special image format called SVG, which can contain code, and the site ran that code under its own address, letting an attacker act as the site in a visitor's browser.

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 Abdullah Mohamed

View all

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