Skip to content
XSS Disclosed report Beginner CVE-2020-8115

Reflected XSS on www/delivery/afr.php

The query string of a request to the delivery script was inserted unescaped into a JavaScript block and a meta refresh tag, allowing an attacker to inject script that runs in the victim's browser. An attacker could use this to steal session cookies or perform actions as a privileged user.

Jacopo Tediosi Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Triaged in 18 hours
  • Fixed in 23 hours
  • Disclosed after 6 days

At line 4381, $_SERVER['QUERY_STRING'], which is an untrusted user input, is assigned to the $dest variable. Then at lines 4386-4387 $dest is printed into HTML code in two separate places.

PoC:

curl "domain.com/www/delivery/afr.php?refresh=10000&\")',10000000);alert(1);setTimeout('alert(\""
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<title>Advertisement</title>

    <script type='text/javascript'><!--// <![CDATA[
        setTimeout('window.location.replace("http://domain.com/www/delivery/afr.php?refresh=10000&")',10000000);alert(1);setTimeout('alert("&loc=")', 10000000);
    // ]]> --></script><noscript><meta http-equiv='refresh' content='10000;url=http://domain.com/www/delivery/afr.php?refresh=10000&")',10000000);alert(1);setTimeout('alert("&loc='></noscript>
    <style type='text/css'>
body {margin:0; height:100%; background-color:transparent; width:100%; text-align:center;}
</style>
</head>
<body>

</body>
</html>

Suggested remediation: I suggest to change line 4381 from $dest = MAX_commonGetDeliveryUrl($conf['file']['frame']).'?'.$_SERVER['QUERY_STRING']; to $dest = MAX_commonGetDeliveryUrl($conf['file']['frame']).'?'.urlencode($_SERVER['QUERY_STRING']); in both files /www/delivery/afr.php and /www/delivery_dev/afr.php

Impact

An attacker could use this XSS to steal session cookies (if readable via javascript, I didn't check) or transform it to a CSRF and cause involuntary actions to be performed by a privileged user

The original report as published on HackerOne, by jacopotediosi. 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

The application inserted the raw query string into HTML and JavaScript contexts without encoding or escaping it.

Impact

An attacker could steal session cookies (if readable via JavaScript) or use the XSS to perform actions as a privileged user via CSRF.

What the attacker needed

Victim clicks a crafted link

The fix

The query string should be URL-encoded before being inserted into the page, as suggested in the report.

How it was found

  1. Send a crafted request to the delivery script with a malicious query string.
  2. The script assigns the query string to the $dest variable.
  3. The $dest variable is printed into the HTML page in two places.
  4. The injected JavaScript executes in the victim's browser.

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.

When a website takes part of the address you type (the query string) and puts it directly into the page without cleaning it, an attacker can add their own code. Here, the code ends up inside a script tag, so the browser runs it. This lets the attacker do things like read cookies or act as the logged-in user.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Revive Adserver

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.